Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSPageAddController.php 1 location

@@ 156-167 (lines=12) @@
153
        )->setHTMLID('Form_AddForm');
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

@@ 1026-1036 (lines=11) @@
1023
            new FieldList()
1024
        )->setHTMLID('Form_ListViewForm');
1025
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1026
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1027
            $request = $this->getRequest();
1028
            if ($request->isAjax() && $negotiator) {
1029
                $result = $listview->forTemplate();
1030
                return $negotiator->respond($request, array(
1031
                    'CurrentForm' => function () use ($result) {
1032
                        return $result;
1033
                    }
1034
                ));
1035
            }
1036
        });
1037
1038
        $this->extend('updateListView', $listview);
1039