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


PHP HiddenField::addExtraClass方法代码示例

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


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

示例1: HiddenField

 /**
  * Initiate the standard Metadata catalogue search form. The 
  * additional parameter $defaults defines the default values for the form.
  * 
  * @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 FieldSet $fields All of the fields in the form - a {@link FieldSet} of {@link FormField} objects.
  * @param FieldSet $actions All of the action buttons in the form - a {@link FieldSet} of {@link FormAction} objects
  * @param Validator $validator Override the default validator instance (Default: {@link RequiredFields})
  * @param Array $defaults Override the default values of the form.		 
  */
 function __construct($controller, $name, FieldSet $fields = null, FieldSet $actions = null, $validator = null, $defaults = null)
 {
     $format = $defaults['format'];
     $searchTerm = $defaults['searchTerm'];
     $bboxUpper = $bboxLower = null;
     if (isset($defaults['bboxUpper']) && isset($defaults['bboxLower'])) {
         $bboxUpper = $defaults['bboxUpper'];
         $bboxLower = $defaults['bboxLower'];
     }
     $values = CataloguePage_Controller::get_standard_names();
     $upperField = new HiddenField('bboxUpper', _t('SearchForm.SEARCH', 'bboxUpper'), $bboxUpper);
     $upperField->addExtraClass('upper');
     $lowerField = new HiddenField('bboxLower', _t('SearchForm.SEARCH', 'bboxLower'), $bboxLower);
     $lowerField->addExtraClass('lower');
     if (!$fields) {
         $fields = new FieldSet(new TextField('searchTerm', _t('SearchForm.SEARCH', 'Search'), $searchTerm), $upperField, $lowerField, new OptionsetField('format', _t('SearchForm.MetadataStandard', 'Metadata Standard'), $values, $format));
     }
     if (singleton('SiteTree')->hasExtension('Translatable')) {
         $fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale()));
     }
     if (!$actions) {
         $actions = new FieldSet(new FormAction("submit", _t('SearchForm.Search', 'Search')));
     }
     parent::__construct($controller, $name, $fields, $actions);
     $this->setFormMethod('get');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-geocatalogue,代码行数:37,代码来源:CatalogueSearchForm.php

示例2: GameSignupFields

 public function GameSignupFields($reg)
 {
     $fields = new FieldList();
     $currentID = $this->getCurrentEvent()->ID;
     $event = Event::get()->byID($currentID);
     $prefNum = $event->PreferencesPerSession;
     $reg = $this->getCurrentRegistration();
     $fields->push(new HiddenField('RegistrationID', 'Reg', $reg->ID));
     $fields->push($fav = new HiddenField('FavouriteID', 'Favourite'));
     $fav->addExtraClass('favourite-id');
     $fields->push(new LiteralField('no-js', '<p class="js-hide">This page works better with javascript. If you can\'t use javascript, rank the items below in your order of preference. 1 for your first choice, 2 for your second. Note, only the top ' . $prefNum . ' will be recorded</p>'));
     for ($session = 1; $session <= $event->NumberOfSessions; $session++) {
         $evenOdd = $session % 2 == 0 ? 'even' : 'odd';
         $fieldset = '<fieldset id="round' . $session . '" class="preference-group preference-' . $prefNum . ' data-preference-select="preference-select-group">';
         $fields->push(new LiteralField('Heading_' . $session, '<h5>Round ' . $session . ' preferences</h5>' . $fieldset));
         $games = Game::get()->filter(array('Session' => $session, 'ParentID' => $currentID, 'Status' => true))->sort('RAND()');
         $i = 1;
         foreach ($games as $game) {
             $gameOptions = new NumericField("GameID_" . $game->ID, '');
             $gameOptions->setValue($i)->setRightTitle($game->Title)->setAttribute('type', 'number')->setAttribute('data-id', $game->ID)->addExtraClass('small-input js-hide-input');
             $fields->push($gameOptions);
             $i++;
         }
         // Add not playing option
         $gameOptions = new NumericField("NotPlaying_" . $session, '');
         $gameOptions->setValue($i)->setRightTitle("No game (or Facilitating)")->setAttribute('type', 'number')->addExtraClass('small-input js-hide-input not-playing');
         $fields->push($gameOptions);
         $fields->push(new LiteralField('fieldset', '</fieldset>'));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:adrexia-gamesevent,代码行数:31,代码来源:GameSignupPage.php

示例3: getColumnContent

 public function getColumnContent($grid, $record, $col)
 {
     // In case you are using GridFieldEditableColumns, this ensures that
     // the correct sort order is saved. If you are not using that component,
     // this will be ignored by other components, but will still work for this.
     $sortFieldName = sprintf('%s[GridFieldEditableColumns][%s][%s]', $grid->getName(), $record->ID, $this->getSortField());
     $sortField = new HiddenField($sortFieldName, false, $record->getField($this->getSortField()));
     $sortField->addExtraClass('ss-orderable-hidden-sort');
     $sortField->setForm($grid->getForm());
     return ViewableData::create()->customise(array('SortField' => $sortField))->renderWith('GridFieldOrderableRowsDragHandle');
 }
开发者ID:ajshort,项目名称:silverstripe-gridfieldextensions,代码行数:11,代码来源:GridFieldOrderableRows.php

示例4: getCountryField

 /**
  * put together a dropdown for the country field
  *
  * @param String $name - name of the field
  * @return DropdownField
  **/
 protected function getCountryField($name)
 {
     $countriesForDropdown = EcommerceCountry::list_of_allowed_entries_for_dropdown();
     $title = _t("OrderAddress." . strtoupper($name), "Country");
     $countryField = new DropdownField($name, $title, $countriesForDropdown, EcommerceCountry::get_country());
     $countryField->setRightTitle(_t("OrderAddress." . strtoupper($name) . "_RIGHT", ""));
     if (count($countriesForDropdown) < 2) {
         $countryField = $countryField->performReadonlyTransformation();
         if (count($countriesForDropdown) < 1) {
             $countryField = new HiddenField($name, '', "not available");
         }
     }
     $prefix = EcommerceConfig::get("OrderAddress", "field_class_and_id_prefix");
     $countryField->addExtraClass($prefix . 'ajaxCountryField');
     //important, otherwise loadData will override the default value....
     $this->{$name} = EcommerceCountry::get_country();
     return $countryField;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:24,代码来源:OrderAddress.php

示例5: getCountryField

 /**
  * put together a dropdown for the country field
  * @param String $name - name of the field
  * @return DropdownField
  **/
 protected function getCountryField($name)
 {
     $countriesForDropdown = EcommerceCountry::list_of_allowed_entries_for_dropdown();
     $countryField = new DropdownField($name, EcommerceCountry::i18n_singular_name(), $countriesForDropdown, EcommerceCountry::get_country());
     if (count($countriesForDropdown) < 2) {
         $countryField = $countryField->performReadonlyTransformation();
         if (count($countriesForDropdown) < 1) {
             $countryField = new HiddenField($name, '', "not available");
         }
     }
     $prefix = EcommerceConfig::get("OrderAddress", "field_class_and_id_prefix");
     $countryField->addExtraClass($prefix . 'ajaxCountryField');
     return $countryField;
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:19,代码来源:OrderAddress.php


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