Code Duplication    Length = 13-14 lines in 2 locations

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

code/Controllers/CMSMain.php 1 location

@@ 920-932 (lines=13) @@
917
			new FieldList()
918
		)->setHTMLID('Form_ListViewForm');
919
		$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
920
		$listview->setValidationResponseCallback(function() use ($negotiator, $listview) {
921
			$request = $this->getRequest();
922
			if($request->isAjax() && $negotiator) {
923
				$listview->setupFormErrors();
924
				$result = $listview->forTemplate();
925
926
				return $negotiator->respond($request, array(
927
					'CurrentForm' => function() use($result) {
928
						return $result;
929
					}
930
				));
931
			}
932
		});
933
934
		$this->extend('updateListView', $listview);
935