Code Duplication    Length = 40-41 lines in 2 locations

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

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