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


PHP FieldList类代码示例

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


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

示例1: __construct

 /**
  * Returns an instance of this class
  *
  * @param Controller $controller
  * @param string $name
  */
 public function __construct($controller, $name)
 {
     $fields = new FieldList(array(new HiddenField('AuthenticationMethod', null, $this->authenticator_class)));
     $actions = new FieldList(array(FormAction::create('redirectToRealMe', _t('RealMeLoginForm.LOGINBUTTON', 'LoginAction'))->setUseButtonTag(true)->setButtonContent('<span class="realme_button_padding">Login or register with RealMe<span class="realme_icon_new_window"></span> <span class="realme_icon_padlock"></span>')->setAttribute('class', 'realme_button')));
     // Taken from MemberLoginForm
     if (isset($_REQUEST['BackURL'])) {
         $backURL = $_REQUEST['BackURL'];
     } elseif (Session::get('BackURL')) {
         $backURL = Session::get('BackURL');
     }
     if (isset($backURL)) {
         // Ensure that $backURL isn't redirecting us back to login form or a RealMe authentication page
         if (strpos($backURL, 'Security/login') === false && strpos($backURL, 'Security/realme') === false) {
             $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
         }
     }
     // optionally include requirements {@see /realme/_config/config.yml}
     if ($this->config()->include_jquery) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     if ($this->config()->include_javascript) {
         Requirements::javascript(REALME_MODULE_PATH . "/javascript/realme.js");
     }
     if ($this->config()->include_css) {
         Requirements::css(REALME_MODULE_PATH . "/css/realme.css");
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-realme,代码行数:34,代码来源:RealMeLoginForm.php

示例2: updateCMSFields

 /**
  * Adds the field editor to the page.
  *
  * @return FieldList
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fieldEditor = $this->getFieldEditorGrid();
     $fields->insertAfter(new Tab('FormFields', _t('UserFormFieldEditorExtension.FORMFIELDS', 'Form Fields')), 'Main');
     $fields->addFieldToTab('Root.FormFields', $fieldEditor);
     return $fields;
 }
开发者ID:camfindlay,项目名称:silverstripe-userforms,代码行数:12,代码来源:UserFormFieldEditorExtension.php

示例3: updateCMSFields

 public function updateCMSFields(\FieldList $fields)
 {
     if (!$this->owner->exists()) {
         return;
     }
     $fields->addFieldsToTab('Root.Recommended', [\TextField::create('Recommended_Title', _t('Product.Recommended_Title', 'Title'))->setAttribute('placeholder', $this->owner->config()->recommended_title ?: _t('Product.Default-Recommended_Title', 'Recommended Products')), \CheckboxField::create('Recommended_AlsoBought', _t('Product.Recommended_AlsoBought', 'Prioritise products that were bought with this product?'))->setDescription(_t('Product.Desc-Recommended_AlsoBought', 'This will use products that previous customers have bought with this product, otherwise it will select from your choice below.')), \SelectionGroup::create('Recommended_FindBy', $this->getMethodFormFields())]);
 }
开发者ID:milkyway-multimedia,项目名称:ss-shop-recommended,代码行数:7,代码来源:HasRecommendedProducts.php

示例4: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->removeByName('Country');
     $fields->removeByName("DefaultShippingAddressID");
     $fields->removeByName("DefaultBillingAddressID");
     $fields->addFieldToTab('Root.Main', DropdownField::create('Country', _t('Address.db_Country', 'Country'), SiteConfig::current_site_config()->getCountriesList()));
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:7,代码来源:ShopMember.php

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

示例6: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->Site()->hasFeature('PageThumbnails')) {
         $fields->addFieldToTab('Root.Main', $thumb = UploadField::create('PageThumbnail', 'Page Thumbnail'));
         $thumb->getValidator()->allowedExtensions = array('jpg', 'gif', 'png');
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ba-sis,代码行数:7,代码来源:PageThumbnailExtension.php

示例7: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $sortable = singleton('CleanTeaser')->hasExtension('SortableDataExtension');
     $config = GridFieldConfig_RelationEditor::create();
     $config->addComponent($gridFieldForm = new GridFieldDetailForm());
     $dataFields = array();
     if (singleton('CleanTeaser')->hasExtension('CMSPublishableDataExtension')) {
         $dataFields['PublishIndicator'] = 'Published';
     }
     $dataFields = array_merge($dataFields, array('Thumbnail' => 'Thumbnail', 'Title' => 'Title', 'CleanDescription' => 'Description'));
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields($dataFields);
     $gridFieldForm->setTemplate('CMSGridFieldPopupForms');
     if ($sortable) {
         $config->addComponent(new GridFieldSortableRows('SortOrder'));
     }
     if (ClassInfo::exists('GridFieldBulkUpload')) {
         $iu = new GridFieldBulkUpload('ImageID');
         if (singleton('CleanTeaser')->hasExtension('ControlledFolderDataExtension')) {
             $iu->setUfConfig('folderName', singleton('CleanTeaser')->getUploadFolder());
         } else {
             $iu->setUfConfig('folderName', CleanTeaser::$upload_folder);
         }
         $config->addComponent($iu);
     }
     if ($sortable) {
         $data = $this->owner->CleanTeasers("ClassName = 'CleanTeaser'")->sort('SortOrder');
     } else {
         $data = $this->owner->CleanTeasers("ClassName = 'CleanTeaser'");
     }
     // $config->removeComponentsByType('GridFieldAddNewButton');
     // if (ClassInfo::exists('GridFieldBulkUpload')) {
     // 	$config->addComponent(new GridFieldAddNewMultiClass());
     // }
     $fields->addFieldToTab("Root.Teasers", GridField::create('CleanTeasers', 'CleanTeaser', $data, $config));
 }
开发者ID:arillo,项目名称:silverstripe-cleanutilities,代码行数:35,代码来源:CleanTeasersExtension.php

示例8: __construct

 function __construct($controller, $name)
 {
     $fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
     $t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
     $t1->addExtraClass('event-brite-order-number');
     $attendees = Session::get('attendees');
     if (count($attendees) > 0) {
         $t1->setValue(Session::get('ExternalOrderId'));
         $t1->setReadonly(true);
         $checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
         $fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
         $options = array();
         foreach ($attendees as $attendee) {
             $ticket_external_id = intval($attendee['ticket_class_id']);
             $ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
             if (is_null($ticket_type)) {
                 continue;
             }
             $options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
         }
         $attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
         $fields->add($attendees_ctrl);
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
         $btn->addExtraClass('btn btn-default active');
         $btn_clear->addExtraClass('btn btn-danger active');
     } else {
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
         $btn->addExtraClass('btn btn-default active');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:35,代码来源:SummitAttendeeInfoForm.php

示例9: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Orders", GridField::create("OrderNotifications", "Order status notifications", $this->owner->OrderNotifications(), GridFieldConfig_RecordEditor::create()));
     $fields->addFieldToTab("Root.Orders", HTMLEditorField::create("OrdersHeader", _t("Orders.QuoteInvoiceHeader", "Quote and Invoice Header")));
     $fields->addFieldToTab("Root.Orders", HTMLEditorField::create("QuoteFooter"));
     $fields->addFieldToTab("Root.Orders", HTMLEditorField::create("InvoiceFooter"));
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-orders,代码行数:7,代码来源:OrdersSiteConfigExtension.php

示例10: getEditForm

 /**
  * Gets the form used for viewing a time log
  */
 public function getEditForm($id = null, $fields = null)
 {
     $record = $this->currentPage();
     if ($this->action == 'view' && $record) {
         $fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
         $refObj = $record->ReferenceObject;
         if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
             if (method_exists($refObj, 'CMSEditLink')) {
                 $fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
             } else {
                 if ($refObj instanceof File) {
                     $refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
                     $fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
                 }
             }
         }
     } else {
         $fields = new FieldList();
     }
     $form = new CMSForm($this, 'EditForm', $fields, new FieldList());
     $form->setResponseNegotiator($this->getResponseNegotiator());
     $form->addExtraClass('cms-edit-form center');
     $form->setAttribute('data-layout-type', 'border');
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     $form->setAttribute('data-pjax-fragment', 'CurrentForm');
     $form->setHTMLID('Form_EditForm');
     if ($record) {
         $form->loadDataFrom($record);
     }
     return $form;
 }
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge-logger,代码行数:34,代码来源:KapostBridgeLogViewer.php

示例11: __construct

 function __construct($controller, $name, $poll)
 {
     if (!$poll) {
         user_error("The poll doesn't exist.", E_USER_ERROR);
     }
     $this->poll = $poll;
     $data = array();
     foreach ($poll->Choices() as $choice) {
         $data[$choice->ID] = $choice->Title;
     }
     if ($poll->MultiChoice) {
         $choiceField = new CheckboxSetField('PollChoices', '', $data);
     } else {
         $choiceField = new OptionsetField('PollChoices', '', $data);
     }
     $fields = new FieldList($choiceField);
     if (PollForm::$show_results_link) {
         $showResultsURL = Director::get_current_page()->Link() . '?poll_results';
         $showResultsLink = new LiteralField('ShowPollLink', '<a class="show-results" href="' . $showResultsURL . '">Show results</a>');
         $fields->push($showResultsLink);
     }
     $actions = new FieldList(new FormAction('submitPoll', 'Submit', null, null, 'button'));
     $validator = new PollForm_Validator('PollChoices');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
开发者ID:helpfulrobot,项目名称:mateusz-silverstripe-polls,代码行数:25,代码来源:PollForm.php

示例12: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.PageElements", $editor = new HTMLEditorField($name = "CopyrightNotice", $title = "Copyright notice."));
     $fields->addFieldToTab("Root.PageElements", new UploadField($name = "BackgroundImage", $title = "Background Image"));
     $editor->setRows(10);
     return $fields;
 }
开发者ID:sunnysideup,项目名称:mysite_ssu_flava,代码行数:7,代码来源:SiteConfigExtras.php

示例13: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
     $fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
     $fields->removeByName("CreateTopLevelGroups");
     $countriestab->setTitle("Allowed Countries");
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:7,代码来源:ShopConfig.php

示例14: updateCMSFields

 /**
  * Returns a FieldList with which to create the editing form. {@link SiteTree::getCMSFields()}
  */
 public function updateCMSFields(FieldList $fields)
 {
     $placeholderImageUploadField = new UploadField('PlaceholderImage', _t('PlaceholderImageSiteConfigExtension.PLACEHOLDERIMAGE', 'Placeholder Image'));
     $placeholderImageUploadField->allowedExtensions = array('jpg', 'gif', 'png');
     $fields->findOrMakeTab('Root.Images', _t('PlaceholderImageSiteConfigExtension.IMAGES', 'Images'));
     $fields->addFieldToTab('Root.Images', $placeholderImageUploadField);
 }
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-imagefunctions,代码行数:10,代码来源:PlaceholderImageSiteConfigExtension.php

示例15: updateSettingsFields

 /**
  * @param FieldList $fields
  * @return FieldList
  */
 public function updateSettingsFields(FieldList $fields)
 {
     /** @var FieldGroup $hideDefaultSlider */
     $fields->addFieldToTab('Root.Settings', $hideDefaultSlider = FieldGroup::create(CheckboxField::create('HideDefaultSlider', 'Hide the slider from this page')));
     $hideDefaultSlider->setTitle('Slider');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:11,代码来源:SliderConfig.php


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