本文整理匯總了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()');
}
示例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'))));
}
}
示例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;
}
示例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);
}
}