Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSPageAddController.php 1 location

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

code/Controllers/CMSMain.php 1 location

@@ 977-987 (lines=11) @@
974
			new FieldList()
975
		)->setHTMLID('Form_ListViewForm');
976
		$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
977
		$listview->setValidationResponseCallback(function(ValidationResult $errors) use ($negotiator, $listview) {
978
			$request = $this->getRequest();
979
			if($request->isAjax() && $negotiator) {
980
				$result = $listview->forTemplate();
981
				return $negotiator->respond($request, array(
982
					'CurrentForm' => function() use($result) {
983
						return $result;
984
					}
985
				));
986
			}
987
		});
988
989
		$this->extend('updateListView', $listview);
990