Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSMain.php 1 location

@@ 1041-1051 (lines=11) @@
1038
            new FieldList()
1039
        )->setHTMLID('Form_ListViewForm');
1040
        $listview->setAttribute('data-pjax-fragment', 'ListViewForm');
1041
        $listview->setValidationResponseCallback(function (ValidationResult $errors) use ($negotiator, $listview) {
1042
            $request = $this->getRequest();
1043
            if ($request->isAjax() && $negotiator) {
1044
                $result = $listview->forTemplate();
1045
                return $negotiator->respond($request, array(
1046
                    'CurrentForm' => function () use ($result) {
1047
                        return $result;
1048
                    }
1049
                ));
1050
            }
1051
        });
1052
1053
        $this->extend('updateListView', $listview);
1054

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