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


PHP FieldList::fieldByName方法代码示例

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


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

示例1: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $extFields = self::$db;
     $fields->removeByName(array_keys($extFields));
     if (!$this->owner->WordpressID) {
         return;
     }
     $compositeFields = array();
     foreach ($extFields as $name => $type) {
         $value = $this->owner->getField($name);
         $compositeFields[$name] = ReadonlyField::create($name . '_Readonly', FormField::name_to_label($name), $value);
     }
     if ($compositeFields) {
         $wordpressCompositeField = ToggleCompositeField::create('WordpressCompositeField', 'Wordpress', $compositeFields)->setHeadingLevel(4);
         if ($fields->fieldByName('Metadata')) {
             $fields->insertBefore($wordpressCompositeField, 'Metadata');
         } else {
             if ($fields->fieldByName('Root')) {
                 $fields->addFieldToTab('Root.Main', $wordpressCompositeField);
             } else {
                 $fields->push($wordpressCompositeField);
             }
         }
     }
 }
开发者ID:silbinarywolf,项目名称:silverstripe-wordpressmigrationtools,代码行数:25,代码来源:WordpressImportDataExtension.php

示例2: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if (get_class($fields->fieldByName('Root.Main')) == 'TabSet') {
         $fields->addFieldsToTab('Root.Main.Metadata', $this->getTagFields());
     } else {
         if (get_class($fields->fieldByName('Root')) == 'TabSet') {
             $fields->addFieldsToTab('Root.Metadata', $this->getTagFields());
         } else {
             if (get_class($fields) == 'FieldSet' || get_class($fields) == 'FieldList') {
                 foreach ($this->getTagFields() as $f) {
                     $fields->push($f);
                 }
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:azt3k-abc-silverstripe-taggable,代码行数:16,代码来源:Taggable.php

示例3: updateCMSFields

 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     /** =========================================
          * @var TextareaField $address
          * @var TextareaField $postalAddress
          * @var TextField $mailChimpAPI
          * @var TextareaField $mailChimpSuccessMessage
         ===========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', TabSet::create('Settings'));
     }
     /** -----------------------------------------
      * Details
      * ----------------------------------------*/
     $address = TextareaField::create('Address', 'Address');
     $address->setRows(8);
     $postalAddress = TextareaField::create('PostalAddress', 'Postal Address');
     $postalAddress->setRows(8);
     $fields->findOrMakeTab('Root.Settings.Details');
     $fields->addFieldsToTab('Root.Settings.Details', array(HeaderField::create('', 'Company Details'), Textfield::create('Phone', 'Phone Number'), Textfield::create('Email', 'Public Email Address'), $address, $postalAddress, TextField::create('Facebook', 'Facebook'), TextField::create('LinkedIn', 'LinkedIn'), TextField::create('Pinterest', 'Pinterest'), TextField::create('TwitterHandle', 'Twitter Handle')));
     /** -----------------------------------------
      * Subscription
      * ----------------------------------------*/
     $mailChimpAPI = TextField::create('MailChimpAPI', 'API Key');
     $mailChimpSuccessMessage = TextareaField::create('MailChimpSuccessMessage', 'Success Message (optional)');
     $mailChimpAPI->setRightTitle('<a href="https://us9.admin.mailchimp.com/account/api-key-popup/" target="_blank"><i>How do I get my MailChimp API Key?</i></a>');
     $mailChimpSuccessMessage->setRows(2)->setRightTitle('Message displayed when a user has successfully subscribed to a list.');
     $fields->findOrMakeTab('Root.Settings.Subscription', 'Subscription');
     $fields->addFieldsToTab('Root.Settings.Subscription', array(HeaderField::create('', 'Newsletter Subscription'), LiteralField::create('', '<p>The API key, and list ID are necessary for the Newsletter Subscription form to function.</p>'), $mailChimpAPI, TextField::create('MailChimpListID', 'List ID'), $mailChimpSuccessMessage));
 }
开发者ID:toastnz,项目名称:quicksilver,代码行数:33,代码来源:SiteConfigExtension.php

示例4: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     /* -----------------------------------------
         * Color Picker
        ------------------------------------------*/
     Requirements::css('boilerplate/css/colorpicker.css');
     Requirements::javascript('boilerplate/javascript/colorpicker.min.js');
     Requirements::javascript('boilerplate/javascript/colorpicker.init.js');
     /* =========================================
        * Settings
        =========================================*/
     if (!$fields->fieldByName('Root.Settings')) {
         $fields->addFieldToTab('Root', new TabSet('Settings'));
     }
     /* -----------------------------------------
         * Images
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Images', 'Images');
     $fields->addFieldsToTab('Root.Settings.Images', array($logo = new UploadField('LogoImage', _t('BoilerplateConfig.LogoImageLabel', 'Logo')), $favicon = new UploadField('Favicon', _t('BoilerplateConfig.FaviconLabel', 'Favicon'))));
     $logo->setRightTitle('Choose an Image For Your Logo');
     $favicon->setRightTitle('Choose an Image For Your Favicon (16x16)');
     /* -----------------------------------------
         * Company Details
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.Details', 'Details');
     $fields->addFieldsToTab('Root.Settings.Details', array(new Textfield('Phone', _t('BoilerplateConfig.PhoneLabel', 'Phone Number')), new Textfield('Email', _t('BoilerplateConfig.EmailLabel', 'Public Email Address')), $PhysicalAddress = new HtmlEditorField('PhysicalAddress', _t('BoilerplateConfig.PhysicalAddressLabel', 'Physical Address'))));
     $PhysicalAddress->setRows(3);
     /* -----------------------------------------
         * Tracking Code
        ------------------------------------------*/
     $fields->findOrMakeTab('Root.Settings.TrackingCode', 'Tracking Code');
     $fields->addFieldsToTab('Root.Settings.TrackingCode', array($trackingCode = new TextareaField('TrackingCode', _t('BoilerplateConfig.TrackingCodeLabel', 'Tracking Code'))));
     $trackingCode->setRows(20);
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:34,代码来源:BoilerplateConfig.php

示例5: updateFieldsForFile

 public function updateFieldsForFile(FieldList $fields, $url, $file)
 {
     if (!($apiKey = Config::inst()->get('Aviary', 'ClientID'))) {
         return;
     }
     // load Aviary (js+css)
     Aviary::loadAviary();
     // Image pointer
     $aviaryImage = LiteralField::create('AviaryImage', '<img class="aviary_image" id="aviary_image_' . $file->ID . '" src="/' . $url . '" style="display: none;" />');
     // create edit button
     $editButton = FormAction::create('AviaryEditImage', _t('Aviary.EditImage', 'Edit Image'))->setAttribute('data-apikey', $apiKey)->setAttribute('data-localprocessing', Config::inst()->get('Aviary', 'LocalProcessing'));
     if (!$fields->fieldByName('FilePreview.FilePreviewImage.AviaryEditImageWrapper') && ($previewRoot = $fields->fieldByName('FilePreview.FilePreviewImage.ImageFull'))) {
         $fields->insertAfter(CompositeField::create($editButton)->setName('AviaryEditImageWrapper'), $previewRoot->getName());
         $fields->insertAfter($aviaryImage, 'FilePreviewImage');
     }
 }
开发者ID:novatio,项目名称:silverstripe-aviary,代码行数:16,代码来源:AviaryHtmlEditorFieldToolbarExtension.php

示例6: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     if ($attributes = $fields->fieldByName("ProductAttributeType")) {
         $attributes->getConfig()->removeComponentsByType("GridFieldAddNewButton")->addComponent($multiclass = new GridFieldAddNewMultiClass());
         $multiclass->setClasses(array_values(ClassInfo::subclassesFor("ProductAttributeType")));
     }
 }
开发者ID:helpfulrobot,项目名称:silvershop-coloredvariations,代码行数:7,代码来源:ColoredProductAttributeAdmin.php

示例7: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     foreach (['primary', 'secondary'] as $lower) {
         $upper = ucfirst($lower);
         $config = $this->owner->config()->get("{$lower}_gallery");
         if (is_null($config) || isset($config['enabled']) && $config['enabled'] === false) {
             continue;
         }
         $config['title'] = isset($config['title']) ? $config['title'] : "{$upper} Gallery";
         $config['folder'] = isset($config['folder']) ? $config['folder'] : "{$upper}-Gallery-Images";
         $GridFieldConfig = new GridFieldConfig_RecordEditor();
         $GridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
         $GridFieldConfig->addComponent($bulkUploadConfig = new GridFieldBulkUpload());
         $GridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
         $GridFieldConfig->addComponent(new GridFieldGalleryTheme('Image'));
         $bulkUploadConfig->setUfSetup('setFolderName', "Images/{$config['folder']}");
         $GridField = new GridField("{$upper}GalleryGridField", $config['title'], $this->owner->{"{$upper}GalleryImages"}(), $GridFieldConfig);
         /** @var TabSet $rootTab */
         //We need to repush Metadata to ensure it is the last tab
         $rootTab = $fields->fieldByName('Root');
         $rootTab->push($tab = Tab::create("{$upper}Gallery"));
         if ($rootTab->fieldByName('Metadata')) {
             $metaChildren = $rootTab->fieldByName('Metadata')->getChildren();
             $rootTab->removeByName('Metadata');
             $rootTab->push(Tab::create('Metadata')->setChildren($metaChildren));
         }
         $tab->setTitle($config['title']);
         $fields->addFieldToTab("Root.{$upper}Gallery", $GridField);
     }
 }
开发者ID:helpfulrobot,项目名称:webfox-silverstripe-gallery,代码行数:30,代码来源:GalleryExtension.php

示例8: setValue

 /**
  * Value is sometimes an array, and sometimes a single value, so we need
  * to handle both cases.
  *
  * @param mixed $value
  * @param mixed $data
  * @return $this
  */
 public function setValue($value, $data = null)
 {
     // If $data is a DataObject, don't use the value, since it's a hashed value
     if ($data && $data instanceof DataObject) {
         $value = '';
     }
     //store this for later
     $oldValue = $this->value;
     if (is_array($value)) {
         $this->value = $value['_Password'];
         $this->confirmValue = $value['_ConfirmPassword'];
         $this->currentPasswordValue = $this->getRequireExistingPassword() && isset($value['_CurrentPassword']) ? $value['_CurrentPassword'] : null;
         if ($this->showOnClick && isset($value['_PasswordFieldVisible'])) {
             $this->children->fieldByName($this->getName() . '[_PasswordFieldVisible]')->setValue($value['_PasswordFieldVisible']);
         }
     } else {
         if ($value || !$value && $this->canBeEmpty) {
             $this->value = $value;
             $this->confirmValue = $value;
         }
     }
     //looking up field by name is expensive, so lets check it needs to change
     if ($oldValue != $this->value) {
         $this->children->fieldByName($this->getName() . '[_Password]')->setValue($this->value);
         $this->children->fieldByName($this->getName() . '[_ConfirmPassword]')->setValue($this->confirmValue);
     }
     return $this;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:36,代码来源:ConfirmedPasswordField.php

示例9: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // check if the insertbefore field is present (may be added later, in which case the above
     // fields never get added
     //$insertOnTab = $this->owner->getFilterableArchiveConfigValue('pagination_control_tab');
     //$insertBefore = $this->owner->getFilterableArchiveConfigValue('pagination_insert_before');
     $insertOnTab = Config::inst()->get($this->owner->className, 'pagination_control_tab');
     $insertBefore = Config::inst()->get($this->owner->className, 'pagination_insert_before');
     if (!$fields->fieldByName("{$insertOnTab}.{$insertBefore}")) {
         $insertBefore = null;
     }
     //if($this->owner->getFilterableArchiveConfigValue('datearchive_active')){
     if (Config::inst()->get($this->owner->className, 'datearchive_active')) {
         //$fields->addFieldToTab($this->owner->getFilterableArchiveConfigValue('pagination_control_tab'),
         $fields->addFieldToTab(Config::inst()->get($this->owner->className, 'pagination_control_tab'), DropdownField::create('ArchiveUnit', _t('filterablearchive.ARCHIVEUNIT', 'Archive unit'), array('year' => _t('filterablearchive.YEAR', 'Year'), 'month' => _t('filterablearchive.MONTH', 'Month'), 'day' => _t('filterablearchive.DAY', 'Day'))), $insertBefore);
     }
     $pagerField = NumericField::create("ItemsPerPage", _t("filterablearchive.ItemsPerPage", "Pagination: items per page"))->setRightTitle(_t("filterablearchive.LeaveEmptyForNone", "Leave empty or '0' for no pagination"));
     $fields->addFieldToTab($insertOnTab, $pagerField, $insertBefore);
     //
     // Create categories and tag config
     //
     //		$config = GridFieldConfig_RecordEditor::create();
     //		$config->removeComponentsByType("GridFieldAddNewButton");
     //		$config->addComponent(new GridFieldAddByDBField("buttons-before-left"));
     // Lets just use what others have made already...
     $config = GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldAddNewInlineButton('toolbar-header-right'));
     //if($this->owner->getFilterableArchiveConfigValue('categories_active')){
     if (Config::inst()->get($this->owner->className, 'categories_active')) {
         $fields->addFieldToTab($insertOnTab, $categories = GridField::create("Categories", _t("FilterableArchive.Categories", "Categories"), $this->owner->Categories(), $config), $insertBefore);
     }
     //if($this->owner->getFilterableArchiveConfigValue('tags_active')){
     if (Config::inst()->get($this->owner->className, 'tags_active')) {
         $fields->addFieldToTab($insertOnTab, $tags = GridField::create("Tags", _t("FilterableArchive.Tags", "Tags"), $this->owner->Tags(), $config), $insertBefore);
     }
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-filterablearchive,代码行数:35,代码来源:FilterableArchiveHolderExtension.php

示例10: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $metaData = $fields->fieldByName('Root.Main.Metadata');
     $metaFieldTitle = new TextareaField("MetaKeywords", $this->owner->fieldLabel('MetaKeywords'));
     $metaData->insertAfter($metaFieldTitle, 'MetaDescription');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:arnhoe-metakeywords,代码行数:7,代码来源:MetaKeywordsExtension.php

示例11: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // Add back metatitle
     $fields->fieldByName('Root.Main.Metadata')->insertBefore($metaTitle = new TextField('MetaTitle', 'Meta Title'), 'MetaDescription');
     $metaTitle->setDescription('Browsers will display this in the title bar and search engines use this for displaying search results (although it may not influence their ranking).');
     // Record current CMS page, quite useful for sorting etc
     self::$current_cms_page = $this->owner->ID;
 }
开发者ID:christopherbolt,项目名称:silverstripe-bolttools,代码行数:8,代码来源:BoltSiteTree.php

示例12: updateCMSFields

 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     if ($fields->fieldByName('Root.Content')) {
         $tab = 'Root.Content.' . _t('Profileable.PROFILE ', 'Profile');
     } else {
         $tab = 'Root.' . _t('Profileable.PROFILE ', 'Profile');
     }
     $fields->addFieldsToTab($tab, $this->getProfileFields());
 }
开发者ID:ivoba,项目名称:silverstripe-profileable,代码行数:12,代码来源:Profileable.php

示例13: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // The Extra.GraphiteServers
     $graphiteServerField = $fields->fieldByName('Root.Main.GraphiteServers');
     $fields->removeByName('Root.Main.GraphiteServers');
     $graphiteServerField->setDescription('Find the relevant graphite servers at ' . '<a href="http://graphite.silverstripe.com/" target="_blank">graphite.silverstripe.com</a>' . ' and enter them one per line, e.g. "server.wgtn.oscar"');
     $fields->addFieldToTab('Root.Extra', $graphiteServerField);
     return $fields;
 }
开发者ID:silverstripe,项目名称:deploynaut-graphite,代码行数:9,代码来源:GraphiteEnvironmentExtension.php

示例14: Fields

 /**
  * Return the form's fields - used by the templates
  *
  * @return FieldList The form fields
  */
 public function Fields()
 {
     foreach ($this->getExtraFields() as $field) {
         if (!$this->fields->fieldByName($field->getName())) {
             $this->fields->push($field);
         }
     }
     return $this->fields;
 }
开发者ID:rasstislav,项目名称:silverstripe-framework,代码行数:14,代码来源:Form.php

示例15: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     if ($tab = $fields->fieldByName("Root.Pricing")) {
         $fields = $tab->Fields();
     }
     if ($this->owner->isInDB() && ($fields->fieldByName("BasePrice") || $fields->fieldByName("Price"))) {
         $fields->push(GridField::create("SpecificPrices", "Specific Prices", $this->owner->SpecificPrices(), GridFieldConfig_RecordEditor::create()));
     }
 }
开发者ID:burnbright,项目名称:silverstripe-shop-discount,代码行数:9,代码来源:ProductSpecificPricingExtension.php


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