Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSPageAddController.php 1 location

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

code/Controllers/CMSMain.php 1 location

@@ 1518-1528 (lines=11) @@
1515
            new FieldList()
1516
        )->setHTMLID('Form_ListViewForm');
1517
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1518
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1519
            $request = $this->getRequest();
1520
            if ($request->isAjax() && $negotiator) {
1521
                $result = $listview->forTemplate();
1522
                return $negotiator->respond($request, array(
1523
                    'CurrentForm' => function () use ($result) {
1524
                        return $result;
1525
                    }
1526
                ));
1527
            }
1528
        });
1529
1530
        $this->extend('updateListView', $listview);
1531