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

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