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


PHP FieldList::push方法代码示例

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


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

示例1: getFormFields

 public function getFormFields()
 {
     $fieldList = new FieldList();
     $fieldList->push(new NumericField('Amount', 'Amount', ''));
     $fieldList->push(new DropDownField('Currency', 'Select currency :', $this->gateway->getSupportedCurrencies()));
     return $fieldList;
 }
开发者ID:vinstah,项目名称:body,代码行数:7,代码来源:ChequeProcessor.php

示例2: Member

 function __construct($controller, $name, $title = "Training")
 {
     if ($member = Member::currentUser()) {
     } else {
         $member = new Member();
     }
     $fields = new FieldList(new HeaderField($title));
     $extraFields = $member->getTrainingFields();
     foreach ($extraFields as $field) {
         if ("Password" == $field->title() && $member->ID) {
         } elseif ("Password" == $field->title()) {
             $fields->push(new ConfirmedPasswordField("Password"));
         } else {
             $fields->push($field);
         }
     }
     $actions = new FieldList(new FormAction("doSave", "Sign Up Now"));
     $requiredFields = new RequiredFields("FirstName", "Surname", "Email", "Password");
     if ($controller->Options) {
         $array = array();
         $explodedOptions = explode(",", $controller->Options);
         foreach ($explodedOptions as $option) {
             $option = trim(Convert::raw2att($option));
             $array[$option] = $option;
         }
         if (count($array)) {
             $fields->push(new DropdownField("SelectedOption", "Select Option", $array));
         }
     }
     $fields->push(new TextField("BookingCode", "Booking Code (if any)"));
     parent::__construct($controller, $name, $fields, $actions, $requiredFields);
     $this->loadNonBlankDataFrom($member);
     return $this;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-traininglistingsandsignup,代码行数:34,代码来源:TrainingSignupForm.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(TextField::create("TwitterHandle", "Twitter Handle"));
     $fields->push(NumericField::create("NumberOfTweets", "Number of Tweets"));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:micmania1-sstwitter,代码行数:7,代码来源:LatestTweetsWidget.php

示例4: parameterFields

 public function parameterFields()
 {
     $fields = new FieldList();
     // Check if any order exist
     if (Order::get()->exists()) {
         $first_order = Order::get()->sort('Created ASC')->first();
         $months = array('All');
         $statuses = Order::config()->statuses;
         array_unshift($statuses, 'All');
         for ($i = 1; $i <= 12; $i++) {
             $months[] = date("F", mktime(0, 0, 0, $i + 1, 0, 0));
         }
         // Get the first order, then count down from current year to that
         $firstyear = new SS_Datetime('FirstDate');
         $firstyear->setValue($first_order->Created);
         $years = array();
         for ($i = date('Y'); $i >= $firstyear->Year(); $i--) {
             $years[$i] = $i;
         }
         //Result Limit
         $result_limit_options = array(0 => 'All', 50 => 50, 100 => 100, 200 => 200, 500 => 500);
         $fields->push(DropdownField::create('Filter_Month', 'Filter by month', $months));
         $fields->push(DropdownField::create('Filter_Year', 'Filter by year', $years));
         $fields->push(DropdownField::create('Filter_Status', 'Filter By Status', $statuses));
         $fields->push(DropdownField::create("ResultsLimit", "Limit results to", $result_limit_options));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-orders,代码行数:28,代码来源:OrdersReport.php

示例5: updateCMSFields

 /**
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     $tabName = Config::inst()->get('Downloadable', 'tab_name');
     $tabFields = array();
     $upload = new UploadField('DownloadableFiles', '');
     $upload->setFolderName(Config::inst()->get('Downloadable', 'source_folder'));
     $tabFields[] = $upload;
     // For certain types of products, it makes sense to include downloads
     // from parent (ProductVariation) or child products (GroupedProduct)
     // NOTE: there could be better ways to do this that don't involve checking
     // for specific classes. The advantage here is that the fields show up
     // even if the product has not yet been saved or doesn't yet have a
     // parent or child products.
     $p = $this->owner instanceof ProductVariation ? $this->owner->Product() : $this->owner->Parent();
     if ($p && $p->exists() && $p->hasExtension('Downloadable')) {
         $tabFields[] = new CheckboxField('IncludeParentDownloads', 'Include downloads from parent product in purchase');
     } elseif (class_exists('GroupedProduct') && $this->owner instanceof GroupedProduct) {
         $tabFields[] = new CheckboxField('IncludeChildDownloads', 'Include downloads from child products in purchase');
     }
     // this will just add unnecessary queries slowing down the page load
     //$tabFields[] = new LiteralField('DownloadCount', '<p>Total Downloads: <strong>' . $this->owner->getDownloads()->count() . '</strong></p>');
     // Product variations don't have tabs, so we need to be able
     // to handle either case.
     if ($fields->first() instanceof TabSet) {
         $fields->addFieldsToTab("Root.{$tabName}", $tabFields);
     } else {
         $fields->push(new HeaderField('DownloadsHeader', $tabName));
         foreach ($tabFields as $f) {
             $fields->push($f);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-downloadable,代码行数:35,代码来源:Downloadable.php

示例6: FieldList

 /**
  * Constructor
  *
  * @param Controller $controller The parent controller, necessary to
  *                               create the appropriate form action tag.
  * @param string $name The method on the controller that will return this
  *                     form object.
  * @param FieldList|FormField $fields All of the fields in the form - a
  *                                   {@link FieldList} of {@link FormField}
  *                                   objects.
  * @param FieldList|FormAction $actions All of the action buttons in the
  *                                     form - a {@link FieldList} of
  */
 function __construct($controller, $name, $fields = null, $actions = null)
 {
     if (isset($_REQUEST['BackURL'])) {
         $backURL = $_REQUEST['BackURL'];
     } else {
         $backURL = Session::get('BackURL');
     }
     if (!$fields) {
         $fields = new FieldList();
         // Security/changepassword?h=XXX redirects to Security/changepassword
         // without GET parameter to avoid potential HTTP referer leakage.
         // In this case, a user is not logged in, and no 'old password' should be necessary.
         if (Member::currentUser()) {
             $fields->push(new PasswordField("OldPassword", _t('Member.YOUROLDPASSWORD', "Your old password")));
         }
         $fields->push(new PasswordField("NewPassword1", _t('Member.NEWPASSWORD', "New Password")));
         $fields->push(new PasswordField("NewPassword2", _t('Member.CONFIRMNEWPASSWORD', "Confirm New Password")));
     }
     if (!$actions) {
         $actions = new FieldList(new FormAction("doChangePassword", _t('Member.BUTTONCHANGEPASSWORD', "Change Password")));
     }
     if (isset($backURL)) {
         $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:39,代码来源:ChangePasswordForm.php

示例7: getCustomFields

 public function getCustomFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('SmallWidth', 'Small Width'));
     $fields->push(new TextField('MediumWidth', 'Medium Width'));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:moosylvania-silverstripe-responsive-image,代码行数:7,代码来源:ResponsiveImage.php

示例8: __construct

 public function __construct($controller, $name, Order $order)
 {
     $this->order = $order;
     $fields = new FieldList(HiddenField::create('OrderID', '', $order->ID));
     $actions = new FieldList();
     //payment
     if (self::config()->allow_paying && $order->canPay()) {
         $gateways = GatewayInfo::get_supported_gateways();
         //remove manual gateways
         foreach ($gateways as $gateway => $gatewayname) {
             if (GatewayInfo::is_manual($gateway)) {
                 unset($gateways[$gateway]);
             }
         }
         if (!empty($gateways)) {
             $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MAKEPAYMENT", "Make Payment")));
             $outstandingfield = Currency::create();
             $outstandingfield->setValue($order->TotalOutstanding());
             $fields->push(LiteralField::create("Outstanding", sprintf(_t("OrderActionsForm.OUTSTANDING", "Outstanding: %s"), $outstandingfield->Nice())));
             $fields->push(OptionsetField::create('PaymentMethod', 'Payment Method', $gateways, key($gateways)));
             $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PAYORDER', 'Pay outstanding balance')));
         }
     }
     //cancelling
     if (self::config()->allow_cancelling && $order->canCancel()) {
         $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CANCELORDER', 'Cancel this order')));
     }
     parent::__construct($controller, $name, $fields, $actions);
     $this->extend("updateForm");
 }
开发者ID:8secs,项目名称:cocina,代码行数:30,代码来源:OrderActionsForm.php

示例9: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new LiteralField("Course Prerequisite", "<h2>Course Prerequisite</h2>"));
     $fields->push(new TextField("Name", "Name"));
     return $fields;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:7,代码来源:TrainingCoursePrerequisite.php

示例10: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList([TextField::create('Title')]);
     if ($this->exists()) {
         $folderName = 'Documents';
         $config = $this->Page()->exists() ? $this->Page()->config()->get('page_documents') : null;
         if (is_array($config)) {
             if (isset($config['folder'])) {
                 $folderName = $config['folder'];
             }
             if (isset($config['section']) && $config['section']) {
                 $filter = new URLSegmentFilter();
                 $section = implode('-', array_map(function ($string) {
                     return ucfirst($string);
                 }, explode('-', $filter->filter($this->Title))));
                 $folderName .= '/' . $section;
             }
         }
         $fields->push(SortableUploadField::create('Documents', 'Documents')->setDescription('Drag documents by thumbnail to sort')->setFolderName($folderName));
     } else {
         $fields->push(LiteralField::create('DocumentsNotSaved', '<p>Save category to add documents</p>'));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:webfox,项目名称:silverstripe-page-documents,代码行数:25,代码来源:PageDocumentCategory.php

示例11: __construct

 public function __construct($name, $title = null, $value = '', $extension = null, $areaCode = null, $countryCode = null)
 {
     $this->areaCode = $areaCode;
     $this->ext = $extension;
     $this->countryCode = $countryCode;
     // Build fields
     $fields = new FieldList();
     if ($this->countryCode !== null) {
         $countryField = NumericField::create($name . '[Country]', false, $countryCode, 4)->addExtraClass('phonenumber-field__country');
         $fields->push($countryField);
     }
     if ($this->areaCode !== null) {
         $areaField = NumericField::create($name . '[Area]', false, $areaCode, 4)->addExtraClass('phonenumber-field__area');
         $fields->push($areaField);
     }
     $numberField = NumericField::create($name . '[Number]', false, null, 10)->addExtraClass('phonenumber-field__number');
     $fields->push($numberField);
     if ($this->ext !== null) {
         $extensionField = NumericField::create($name . '[Extension]', false, $extension, 6)->addExtraClass('phonenumber-field__extension');
         $fields->push($extensionField);
     }
     parent::__construct($title, $fields);
     $this->setName($name);
     if (isset($value)) {
         $this->setValue($value);
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:27,代码来源:PhoneNumberField.php

示例12: updateSettingsFields

 public function updateSettingsFields(FieldList $fields)
 {
     $changeFreq = Singleton('Page')->dbObject('ChangeFreq')->enumValues();
     $fields->push(DropDownField::create('ChangeFreq', 'Change Frequency', $changeFreq));
     $priority = Singleton('Page')->dbObject('Priority')->enumValues();
     $fields->push(DropDownField::create('Priority', 'Priority', $priority));
 }
开发者ID:helpfulrobot,项目名称:marketo-silverstripe-performable-sitemaps,代码行数:7,代码来源:SiteMapExtension.php

示例13: getEditForm

 /**
  * Returns the edit form for this admin.
  * 
  * @param type $id
  * @param type $fields
  * 
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $fields = new FieldList();
     $desc = _t('SilvercartProductImageAdmin.Description');
     $descriptionField = new SilvercartAlertInfoField('SilvercartProductImagesDescription', str_replace(PHP_EOL, '<br/>', $desc));
     $uploadField = new UploadField('SilvercartProductImages', _t('SilvercartProductImageAdmin.UploadProductImages', 'Upload product images'));
     $uploadField->setFolderName(SilvercartProductImageImporter::get_relative_upload_folder());
     $fields->push($uploadField);
     $fields->push($descriptionField);
     if (!SilvercartProductImageImporter::is_installed()) {
         $cronTitle = _t('SilvercartProductImageAdmin.CronNotInstalledTitle') . ':';
         $cron = _t('SilvercartProductImageAdmin.CronNotInstalledDescription');
         $cronjobInfoField = new SilvercartAlertDangerField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
         $fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
     } elseif (SilvercartProductImageImporter::is_running()) {
         $cronTitle = _t('SilvercartProductImageAdmin.CronIsRunningTitle') . ':';
         $cron = _t('SilvercartProductImageAdmin.CronIsRunningDescription');
         $cronjobInfoField = new SilvercartAlertSuccessField('SilvercartProductImagesCronjobInfo', str_replace(PHP_EOL, '<br/>', $cron), $cronTitle);
         $fields->insertAfter('SilvercartProductImages', $cronjobInfoField);
     }
     $uploadedFiles = $this->getUploadedFiles();
     if (count($uploadedFiles) > 0) {
         $uploadedFilesInfo = '<br/>' . implode('<br/>', $uploadedFiles);
         $fileInfoField = new SilvercartAlertWarningField('SilvercartProductImagesFileInfo', $uploadedFilesInfo, _t('SilvercartProductImageAdmin.FileInfoTitle'));
         $fields->insertAfter('SilvercartProductImages', $fileInfoField);
     }
     $actions = new FieldList();
     $form = new Form($this, "EditForm", $fields, $actions);
     $form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses());
     $form->loadDataFrom($this->request->getVars());
     $this->extend('updateEditForm', $form);
     return $form;
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:41,代码来源:SilvercartProductImageAdmin.php

示例14: getCMSFields

 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Value'));
     $fields->push(new TextField('RawValue'));
     return $fields;
 }
开发者ID:gordonbanderson,项目名称:flickr-editor,代码行数:7,代码来源:FlickrTag.php

示例15: getCMSFields

 /**
  * Get CMS fields
  *
  * @return FieldList
  */
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->push(new TextField('Title', _t('Block.TITLE', 'Title')));
     $imageField = new UploadField('Image', _t('Block.IMAGE', 'Image'));
     $imageField->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
     $fields->push($imageField);
     $fields->push(new TextField('FeedURL', _t('FeedBlock.FEEDURL', 'FeedURL')));
     $fields->push(new NumericField('Results', _t('FeedBlock.RESULTS', 'Results')));
     $fields->push(new NumericField('SummaryMaxLength', _t('FeedBlock.SUMMARYMAXLENGTH', 'SummaryMaxLength')));
     $fields->push(new NumericField('CacheTime', _t('FeedBlock.CACHETIME', 'CacheTime')));
     $fields->push(new CheckboxField('Striptags', _t('FeedBlock.STRIPTAGS', 'Striptags')));
     // Add modifier field (select function to run feed item through before displaying it)
     if ($this->modifier_functions) {
         if (isset($this->modifier_functions)) {
             $options = array('' => 'None');
             foreach ($this->modifier_functions as $f) {
                 $options[$f] = $f;
             }
             $fields->push(new DropdownField('Modifier', _t('FeedBlock.MODIFIER', 'Feed item filter'), $options));
         }
     }
     $fields->push(new TextField('LinkExternal', _t('FeedBlock.LINKEXTERNAL', 'External link URL')));
     if (class_exists('OptionalTreeDropdownField')) {
         $treeField = new OptionalTreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
         $treeField->setEmptyString('No page');
     } else {
         $treeField = new TreeDropdownField('LinkInternalID', _t('Block.LINKINTERNAL', 'Internal link'), 'SiteTree');
     }
     $fields->push($treeField);
     return $fields;
 }
开发者ID:richardsjoqvist,项目名称:silverstripe-blocks,代码行数:37,代码来源:FeedBlock.php


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