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


PHP FieldList::renameField方法代码示例

本文整理汇总了PHP中FieldList::renameField方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::renameField方法的具体用法?PHP FieldList::renameField怎么用?PHP FieldList::renameField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FieldList的用法示例。


在下文中一共展示了FieldList::renameField方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Main", new UploadField('Image', 'Main Image'), 'Content');
     $fields->removeByName("Author");
     if ($this->owner->ClassName == "BlogEntry") {
         $fields->removeByName("Date");
     } else {
         $fields->renameField("Date", "Published Date");
     }
 }
开发者ID:javeriaaali,项目名称:student-org-kit,代码行数:10,代码来源:BlogFieldExtension.php

示例2: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     //change Page Name label to Primary Heading - H1 - Only if the title hasn't already been changed
     /** @var TextField $titleField */
     $titleField = $fields->dataFieldByName('Title');
     if ($titleField->Title() == 'Page name') {
         $fields->renameField('Title', 'Primary Heading');
     }
     //Add secondary heading - H2
     $fields->insertAfter(TextField::create('SubTitle', 'Secondary Heading'), 'Title');
     $traits = $this->traitsUsedRecursive($this->owner->ClassName);
     if ($this->owner->config()->get('has_on_after_update_cms_fields')) {
         $traits[] = 'HasOnAfterUpdateCMSFieldsExtensionPoint';
     }
     if (!in_array('HasOnAfterUpdateCMSFieldsExtensionPoint', $traits)) {
         $this->afterUpdateCMSFields($fields);
     }
 }
开发者ID:webfox,项目名称:silverstripe-helpers,代码行数:18,代码来源:ExtraPageFieldsExtension.php

示例3: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $gridFieldConfig = GridFieldConfig_RecordEditor::create();
     $gridFieldConfig->addComponent(new GridFieldBulkUpload());
     $gridFieldConfig->addComponent(new GridFieldGalleryTheme('Image'));
     $bulkUpload = $gridFieldConfig->getComponentByType('GridFieldBulkUpload');
     $bulkUpload->setUfSetup('setFolderName', "Managed/PhotoGalleries/" . $this->owner->ID . "-" . $this->owner->URLSegment);
     $bulkUpload->setUfConfig('canAttachExisting', false);
     $bulkUpload->setUfConfig('canPreviewFolder', false);
     $gridFieldConfig->removeComponentsByType('GridFieldPaginator');
     $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     $gridFieldConfig->addComponent(new GridFieldPaginator(100));
     $gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
     $gridfield = new GridField("PhotoGalleryImages", "Image Gallery", $this->owner->PhotoGalleryImages()->sort("SortOrder"), $gridFieldConfig);
     $fields->addFieldToTab('Root.ImageGallery', $gridfield);
     $fields->addFieldToTab('Root.ImageGallery', new LiteralField('help', "\n\t\t\t<h2>To upload new images:</h2>\n\t\t\t<ol>\n\t\t\t<li>1. Click the <strong>From your computer</strong> button above.</li>\n\t\t\t<li>2. <strong>Locate and select</strong> the image(s) you wish to upload.</li>\n\t\t\t<li>3. Click on <strong>Open/Choose</strong> and the image(s) will begin to upload.</li>\n\t\t\t<li>4. Click <strong>Finish</strong>.</li> \n\t\t\t</ol>"));
     $fields->renameField("Content", "Top Content");
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:purplespider-basic-galleries,代码行数:19,代码来源:PhotoGalleryExtension.php

示例4: updateCMSFields

    public function updateCMSFields(FieldList $fields)
    {
        //change Page Name label to Primary Heading - H1 - Only if the title hasn't already been changed
        /** @var TextField $titleField */
        $titleField = $fields->dataFieldByName('Title');
        if ($titleField->Title() == 'Page Name') {
            $fields->renameField('Title', 'Primary Heading');
        }
        //Add secondary heading - H2
        $fields->insertAfter(TextField::create('SubTitle', 'Secondary Heading'), 'Title');
        //Move meta fields to their own tab
        /** @var ToggleCompositeField $metaDataChildren */
        $metaDataChildren = $fields->fieldByName('Root.Main.Metadata');
        $children = array_merge([$metaTitle = TextField::create('MetaTitle')], $metaDataChildren->getChildren()->toArray());
        $fields->removeFieldFromTab('Root.Main', 'Metadata');
        $fields->addFieldToTab('Root', Tab::create('Metadata'), 'Content');
        //Add META Title tag to METADATA
        $fields->addFieldsToTab('Root.Metadata', $children);
        $metaTitle->setDescription('Displayed as the tab/window name; Also displayed in search engine result listings as the page title.<br />
									Falls back to the Primary Heading field if not provided.');
    }
开发者ID:helpfulrobot,项目名称:webfox-silverstripe-helpers,代码行数:21,代码来源:ExtraPageFieldsExtension.php

示例5: testRenameField

 public function testRenameField()
 {
     $fields = new FieldList();
     $nameField = new TextField('Name', 'Before title');
     $fields->push($nameField);
     /* The title of the field object is the same as what we put in */
     $this->assertSame('Before title', $nameField->Title());
     /* The field gets renamed to a different title */
     $fields->renameField('Name', 'After title');
     /* The title of the field object is the title we renamed to, this
     			includes the original object we created ($nameField), and getting
     			the field back out of the set */
     $this->assertSame('After title', $nameField->Title());
     $this->assertSame('After title', $fields->dataFieldByName('Name')->Title());
 }
开发者ID:normann,项目名称:sapphire,代码行数:15,代码来源:FieldListTest.php

示例6: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->renameField('SkipToMainContentAccessKey', _t('AccessKey.SKIP_TO_MAIN_CONTENT_ACCESS_KEY'));
     $fields->addFieldToTab('Root.FacebookMetadata', new UploadField('FacebookLogo', _t('Facebook.METADATA_LOGO', 'Image that will show in facebook when linking to this site. The image should be a square of minimum size 200px')));
 }
开发者ID:gordonbanderson,项目名称:facebook-tools,代码行数:5,代码来源:FacebookMetadataSiteConfig.php


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