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

@@ 1539-1549 (lines=11) @@
1536
            new FieldList()
1537
        )->setHTMLID('Form_ListViewForm');
1538
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1539
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1540
            $request = $this->getRequest();
1541
            if ($request->isAjax() && $negotiator) {
1542
                $result = $listview->forTemplate();
1543
                return $negotiator->respond($request, array(
1544
                    'CurrentForm' => function () use ($result) {
1545
                        return $result;
1546
                    }
1547
                ));
1548
            }
1549
        });
1550
1551
        $this->extend('updateListView', $listview);
1552