Code Duplication    Length = 13-13 lines in 3 locations

code/Controllers/AssetAdmin.php 1 location

@@ 521-533 (lines=13) @@
518
					->setTitle(_t('AssetAdmin.ActionAdd', 'Add folder'))
519
			)
520
		)->setHTMLID('Form_AddForm');
521
		$form->setValidationResponseCallback(function() use ($negotiator, $form) {
522
			$request = $this->getRequest();
523
			if($request->isAjax() && $negotiator) {
524
				$form->setupFormErrors();
525
				$result = $form->forTemplate();
526
527
				return $negotiator->respond($request, array(
528
					'CurrentForm' => function() use($result) {
529
						return $result;
530
					}
531
				));
532
			}
533
		});
534
		$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
535
		// TODO Can't merge $FormAttributes in template at the moment
536
		$form->addExtraClass('add-form cms-add-form cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());

code/Controllers/CMSPageAddController.php 1 location

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

code/Controllers/CMSMain.php 1 location

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