Code Duplication    Length = 11-12 lines in 2 locations

code/Controllers/CMSMain.php 1 location

@@ 987-997 (lines=11) @@
984
			new FieldList()
985
		)->setHTMLID('Form_ListViewForm');
986
		$listview->setAttribute('data-pjax-fragment', 'ListViewForm');
987
		$listview->setValidationResponseCallback(function(ValidationResult $errors) use ($negotiator, $listview) {
988
			$request = $this->getRequest();
989
			if($request->isAjax() && $negotiator) {
990
				$result = $listview->forTemplate();
991
				return $negotiator->respond($request, array(
992
					'CurrentForm' => function() use($result) {
993
						return $result;
994
					}
995
				));
996
			}
997
		});
998
999
		$this->extend('updateListView', $listview);
1000

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