当前位置: 首页>>代码示例>>PHP>>正文


PHP OptionsetField::performReadonlyTransformation方法代码示例

本文整理汇总了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());
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:14,代码来源:SiteConfigTwoStepWorkflow.php

示例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());
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-cmsworkflow,代码行数:13,代码来源:SiteTreeCMSTwoStepWorkflow.php

示例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');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:10,代码来源:OptionsetFieldTest.php

示例4: performReadonlyTransformation

 public function performReadonlyTransformation()
 {
     if ($this->fieldType == 'CheckboxSetField') {
         return CheckboxSetField::performReadonlyTransformation();
     }
     return parent::performReadonlyTransformation();
 }
开发者ID:betterbrief,项目名称:silverstripe-quickaddfield,代码行数:7,代码来源:QuickAddField.php

示例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


注:本文中的OptionsetField::performReadonlyTransformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。