Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSPageAddController.php 1 location

@@ 155-166 (lines=12) @@
152
        )->setHTMLID('Form_AddForm')->setStrictFormMethodCheck(false);
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

@@ 1466-1476 (lines=11) @@
1463
            new FieldList()
1464
        )->setHTMLID('Form_ListViewForm');
1465
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1466
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1467
            $request = $this->getRequest();
1468
            if ($request->isAjax() && $negotiator) {
1469
                $result = $listview->forTemplate();
1470
                return $negotiator->respond($request, array(
1471
                    'CurrentForm' => function () use ($result) {
1472
                        return $result;
1473
                    }
1474
                ));
1475
            }
1476
        });
1477
1478
        $this->extend('updateListView', $listview);
1479