當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet::dataFieldByName方法代碼示例

本文整理匯總了PHP中FieldSet::dataFieldByName方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::dataFieldByName方法的具體用法?PHP FieldSet::dataFieldByName怎麽用?PHP FieldSet::dataFieldByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FieldSet的用法示例。


在下文中一共展示了FieldSet::dataFieldByName方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateCMSFields

 public function updateCMSFields(FieldSet $fields)
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
     Requirements::javascript('newsletter-pagesource/javascript/NewsletterAdmin.js');
     $source = new OptionsetField('ContentSource', 'Content Source', array('content' => 'A content block', 'page' => 'A page in the site tree'));
     $fields->insertBefore($source, 'Content');
     $page = new TreeDropdownField('SourcePageID', '', 'SiteTree');
     $fields->insertBefore($page, 'Content');
     $fields->dataFieldByName('Content')->setTitle('');
 }
開發者ID:nyeholt,項目名稱:silverstripe-newsletter-pagesource,代碼行數:11,代碼來源:NewsletterPageSourceExtension.php

示例2: testMakeFieldReadonly

 function testMakeFieldReadonly()
 {
     $fieldSet = new FieldSet(new TabSet('Root', new Tab('Main', new TextField('A'), new TextField('B'))));
     $fieldSet->makeFieldReadonly('A');
     $this->assertTrue($fieldSet->dataFieldByName('A')->isReadonly(), 'Field nested inside a TabSet and FieldSet can be marked readonly by FieldSet->makeFieldReadonly()');
 }
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:6,代碼來源:FieldSetTest.php

示例3: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     $allForums = DataObject::get('Forum');
     $fields->removeByName('ModeratedForums');
     $fields->addFieldToTab('Root.ModeratedForums', new CheckboxSetField('ModeratedForums', _t('ForumRole.MODERATEDFORUMS', 'Moderated forums'), $allForums ? $allForums->map('ID', 'Title') : array()));
     $suspend = $fields->dataFieldByName('SuspendedUntil');
     $suspend->setConfig('showcalendar', true);
     if (Permission::checkMember($this->owner->ID, "ACCESS_FORUM")) {
         $fields->addFieldToTab('Root.Forum', new ImageField("Avatar", _t('ForumRole.UPLOADAVATAR', "Upload avatar")));
         $fields->addFieldToTab('Root.Forum', new DropdownField("ForumRank", _t('ForumRole.FORUMRANK', "User rating"), array("Community Member" => _t('ForumRole.COMMEMBER'), "Administrator" => _t('ForumRole.ADMIN', 'Administrator'), "Moderator" => _t('ForumRole.MOD', 'Moderator'))));
     }
 }
開發者ID:nicmart,項目名稱:comperio-site,代碼行數:12,代碼來源:ForumRole.php

示例4: validate

	function validate($validator) {
		$errorMessage = '';
		$valid = true;
		$fields = $this->SubmittedFieldSet($sourceItemsNew);
		$fields = new FieldSet($fields);
		foreach($fields as $field){
			$valid = $field->validate($validator)&&$valid;
		}

		//debug::show($this->form->Message());
		if($this->requiredFields&&$sourceItemsNew&&$sourceItemsNew->count()) {
			foreach ($this->requiredFields as $field) {
				foreach($sourceItemsNew as $item){
					$cellName = $this->Name().'['.$item->ID.']['.$field.']';
					$cName =  $this->Name().'[new]['.$field.'][]';
					
					if($fieldObj = $fields->dataFieldByName($cellName)) {
						if(!trim($fieldObj->Value())){
							$title = $fieldObj->Title();
							$errorMessage .= sprintf(
								_t('TableField.ISREQUIRED', "In %s '%s' is required."),
								$this->name,
								$title
							);
							$errorMessage .= "<br />";
						}
					}
				}
			}
		}

		if($errorMessage){
			$messageType .= "validation";
			$message .= "<br />".$errorMessage;
		
			$validator->validationError($this->name, $message, $messageType);
		}

		return $valid;
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:40,代碼來源:TableField.php

示例5: updateFieldSet

	/**
	 * Make a readonly transformation on all fields in the given
	 * FieldSet which have a name corresponding to a key in the
	 * given $values array.
	 * 
	 * @param FieldSet &$fields
	 * @param array $values
	 */
	public function updateFieldSet(FieldSet &$fields, array $values) {
		foreach ($values as $field => $value) {
			if ($fields->dataFieldByName($field))
				$fields->makeFieldReadonly($field);
		}
	}
開發者ID:redema,項目名稱:silverstripe-handyman,代碼行數:14,代碼來源:DataObjectEnforceDBValueDecorator.php


注:本文中的FieldSet::dataFieldByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。