Code Duplication    Length = 40-41 lines in 2 locations

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

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