本文整理汇总了PHP中OptionsetField::performReadonlyTransformation方法的典型用法代码示例。如果您正苦于以下问题:PHP OptionsetField::performReadonlyTransformation方法的具体用法?PHP OptionsetField::performReadonlyTransformation怎么用?PHP OptionsetField::performReadonlyTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsetField
的用法示例。
在下文中一共展示了OptionsetField::performReadonlyTransformation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCMSFields
/**
* Update SiteConfig with the top level fields
*
* @param FieldSet $fields
* @return void
*/
function updateCMSFields(&$fields)
{
$fields->addFieldsToTab("Root.Access", array(new HeaderField(_t('SiteConfigCMSWorkflow.PUBLISHAPPROVEDHEADER', "Who can publish requests inside the CMS?"), 2), $actionTypeField = new OptionsetField("CanPublishType", "", array("LoggedInUsers" => _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS"), "OnlyTheseUsers" => _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)")), "OnlyTheseUsers"), $actionerGroupsField = new TreeMultiselectField("PublisherGroups", "Publisher groups")));
if (!Permission::check('ADMIN')) {
$fields->replaceField('CanPublishType', $actionTypeField->performReadonlyTransformation());
$fields->replaceField('PublisherGroups', $actionerGroupsField->performReadonlyTransformation());
}
}
示例2: updateCMSFields
/**
* Implement permissions for TwoStep
*
* @return void
*/
public function updateCMSFields(&$fields)
{
$fields->addFieldsToTab("Root.Access", array(new HeaderField(_t('SiteTreeCMSWorkflow.PUBLISHHEADER', "Who can publish this inside the CMS?"), 2), $publishTypeField = new OptionsetField("CanPublishType", "", array("Inherit" => _t('SiteTree.EDITINHERIT', "Inherit from parent page"), "LoggedInUsers" => _t('SiteTree.EDITANYONE', "Anyone who can log-in to the CMS"), "OnlyTheseUsers" => _t('SiteTree.EDITONLYTHESE', "Only these people (choose from list)")), "Inherit"), $publisherGroupsField = new TreeMultiselectField("PublisherGroups", $this->owner->fieldLabel('PublisherGroups'))));
if (!$this->owner->canPublish() || !Permission::check('SITETREE_GRANT_ACCESS')) {
$fields->replaceField('CanPublishType', $publishTypeField->performReadonlyTransformation());
$fields->replaceField('PublisherGroups', $publisherGroupsField->performReadonlyTransformation());
}
}
示例3: testReadonlyField
public function testReadonlyField()
{
$sourceArray = array(0 => 'No', 1 => 'Yes');
$field = new OptionsetField('FeelingOk', 'are you feeling ok?', $sourceArray, 1);
$field->setEmptyString('(Select one)');
$field->setValue(1);
$readonlyField = $field->performReadonlyTransformation();
preg_match('/Yes/', $field->Field(), $matches);
$this->assertEquals($matches[0], 'Yes');
}
示例4: performReadonlyTransformation
public function performReadonlyTransformation()
{
if ($this->fieldType == 'CheckboxSetField') {
return CheckboxSetField::performReadonlyTransformation();
}
return parent::performReadonlyTransformation();
}
示例5: performReadonlyTransformation
/**
* Return a readonly version of this field. Keeps the composition but returns readonly
* versions of all the child {@link FormField} objects.
*
* @return CompositeField
*/
public function performReadonlyTransformation()
{
parent::performReadonlyTransformation();
$newChildren = new FieldList();
$clone = clone $this;
if ($clone->getChildren()) {
foreach ($clone->getChildren() as $idx => $child) {
if (is_object($child)) {
$child = $child->transform(new ReadonlyTransformation());
}
$newChildren->push($child, $idx);
}
}
$clone->children = $newChildren;
$clone->readonly = true;
$clone->addExtraClass($this->extraClass());
$clone->setDescription($this->getDescription());
return $clone;
}
开发者ID:spekulatius,项目名称:silverstripe-bootstrap_extra_fields,代码行数:25,代码来源:BootstrapOptionsetToggleField.php