Code Duplication    Length = 40-41 lines in 2 locations

src/Kunstmaan/NodeBundle/Helper/Menu/ActionsMenuBuilder.php 2 locations

@@ 177-217 (lines=41) @@
174
        $isSuperAdmin = $this->authorizationChecker->isGranted(UserInterface::ROLE_SUPER_ADMIN);
175
176
        if ($activeNodeVersion->isDraft() && $this->isEditableNode) {
177
            if ($canEdit) {
178
                $menu->addChild(
179
                    'action.saveasdraft',
180
                    [
181
                        'linkAttributes' => [
182
                            'type' => 'submit',
183
                            'class' => 'js-save-btn btn btn--raise-on-hover btn-primary',
184
                            'value' => 'save',
185
                            'name' => 'save',
186
                        ],
187
                        'extras' => ['renderType' => 'button'],
188
                    ]
189
                );
190
                if ($this->enableExportPageTemplate && $isSuperAdmin && is_subclass_of($node->getRefEntityName(), HasPageTemplateInterface::class)) {
191
                    $menu->addChild(
192
                        'action.exportpagetemplate',
193
                        [
194
                            'linkAttributes' => [
195
                                'class' => 'btn btn-default btn--raise-on-hover',
196
                                'data-toggle' => 'modal',
197
                                'data-keyboard' => 'true',
198
                                'data-target' => '#exportPagetemplate',
199
                            ],
200
                        ]
201
                    );
202
                }
203
                if ($canRecopy) {
204
                    $menu->addChild(
205
                        'action.recopyfromlanguage',
206
                        [
207
                            'linkAttributes' => [
208
                                'class' => 'btn btn-default btn--raise-on-hover',
209
                                'data-toggle' => 'modal',
210
                                'data-keyboard' => 'true',
211
                                'data-target' => '#recopy',
212
                            ],
213
                        ]
214
                    );
215
                }
216
                $isFirst = false;
217
            }
218
219
            $menu->addChild(
220
                'action.preview',
@@ 315-354 (lines=40) @@
312
                    );
313
                }
314
315
                if ($canEdit) {
316
                    $menu->addChild(
317
                        'action.saveasdraft',
318
                        [
319
                            'linkAttributes' => [
320
                                'type' => 'submit',
321
                                'class' => 'btn btn--raise-on-hover'.($isFirst ? ' btn-primary btn-save' : ' btn-default'),
322
                                'value' => 'saveasdraft',
323
                                'name' => 'saveasdraft',
324
                            ],
325
                            'extras' => ['renderType' => 'button'],
326
                        ]
327
                    );
328
                    if ($this->enableExportPageTemplate && $isSuperAdmin && is_subclass_of($node->getRefEntityName(), HasPageTemplateInterface::class)) {
329
                        $menu->addChild(
330
                            'action.exportpagetemplate',
331
                            [
332
                                'linkAttributes' => [
333
                                    'class' => 'btn btn-default btn--raise-on-hover',
334
                                    'data-toggle' => 'modal',
335
                                    'data-keyboard' => 'true',
336
                                    'data-target' => '#exportPagetemplate',
337
                                ],
338
                            ]
339
                        );
340
                    }
341
                    if ($canRecopy) {
342
                        $menu->addChild(
343
                            'action.recopyfromlanguage',
344
                            [
345
                                'linkAttributes' => [
346
                                    'class' => 'btn btn-default btn--raise-on-hover',
347
                                    'data-toggle' => 'modal',
348
                                    'data-keyboard' => 'true',
349
                                    'data-target' => '#recopy',
350
                                ],
351
                            ]
352
                        );
353
                    }
354
                }
355
            }
356
        }
357