Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSPageAddController.php 1 location

@@ 155-166 (lines=12) @@
152
        )->setHTMLID('Form_AddForm');
153
        $form->setAttribute('data-hints', $this->SiteTreeHints());
154
        $form->setAttribute('data-childfilter', $this->Link('childfilter'));
155
        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $form) {
156
            $request = $this->getRequest();
157
            if ($request->isAjax() && $negotiator) {
158
                $result = $form->forTemplate();
159
                return $negotiator->respond($request, array(
160
                    'CurrentForm' => function () use ($result) {
161
                        return $result;
162
                    }
163
                ));
164
            }
165
            return null;
166
        });
167
        $form->addExtraClass('flexbox-area-grow fill-height cms-add-form cms-content cms-edit-form ' . $this->BaseCSSClasses());
168
        $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
169

code/Controllers/CMSMain.php 1 location

@@ 1459-1469 (lines=11) @@
1456
            new FieldList()
1457
        )->setHTMLID('Form_ListViewForm');
1458
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1459
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1460
            $request = $this->getRequest();
1461
            if ($request->isAjax() && $negotiator) {
1462
                $result = $listview->forTemplate();
1463
                return $negotiator->respond($request, array(
1464
                    'CurrentForm' => function () use ($result) {
1465
                        return $result;
1466
                    }
1467
                ));
1468
            }
1469
        });
1470
1471
        $this->extend('updateListView', $listview);
1472