Code Duplication    Length = 13-14 lines in 2 locations

code/Controllers/CMSMain.php 1 location

@@ 928-940 (lines=13) @@
925
			new FieldList()
926
		)->setHTMLID('Form_ListViewForm');
927
		$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
928
		$listview->setValidationResponseCallback(function() use ($negotiator, $listview) {
929
			$request = $this->getRequest();
930
			if($request->isAjax() && $negotiator) {
931
				$listview->setupFormErrors();
932
				$result = $listview->forTemplate();
933
934
				return $negotiator->respond($request, array(
935
					'CurrentForm' => function() use($result) {
936
						return $result;
937
					}
938
				));
939
			}
940
		});
941
942
		$this->extend('updateListView', $listview);
943

code/Controllers/CMSPageAddController.php 1 location

@@ 149-162 (lines=14) @@
146
		)->setHTMLID('Form_AddForm');
147
		$form->setAttribute('data-hints', $this->SiteTreeHints());
148
		$form->setAttribute('data-childfilter', $this->Link('childfilter'));
149
		$form->setValidationResponseCallback(function() use ($negotiator, $form) {
150
			$request = $this->getRequest();
151
			if($request->isAjax() && $negotiator) {
152
				$form->setupFormErrors();
153
				$result = $form->forTemplate();
154
155
				return $negotiator->respond($request, array(
156
					'CurrentForm' => function() use($result) {
157
						return $result;
158
					}
159
				));
160
			}
161
			return null;
162
		});
163
		$form->addExtraClass('cms-add-form cms-content center cms-edit-form ' . $this->BaseCSSClasses());
164
		$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
165