Code Duplication    Length = 13-14 lines in 2 locations

code/Controllers/CMSMain.php 1 location

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

code/Controllers/CMSPageAddController.php 1 location

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