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


PHP ListboxField::Field方法代码示例

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


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

示例1: Field

 public function Field($properties = array())
 {
     Requirements::javascript(BOLTTOOLS_DIR . '/javascript/addnewlistboxfield.js');
     $this->setTemplate('AddNewListboxField');
     $this->addExtraClass('has-chzn');
     return parent::Field($properties);
 }
开发者ID:christopherbolt,项目名称:silverstripe-bolttools,代码行数:7,代码来源:AddNewListboxField.php

示例2: Field

 public function Field($properties = array())
 {
     FormExtraJquery::include_jquery();
     // Use updated version of Chosen
     Requirements::block(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.css');
     Requirements::block(FRAMEWORK_ADMIN_DIR . '/thirdparty/chosen/chosen/chosen.jquery.js');
     Requirements::css(FORM_EXTRAS_PATH . '/javascript/chosen/chosen.min.css');
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/chosen/chosen.jquery.js');
     if ($this->use_order) {
         Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/chosen_order/chosen.order.jquery.js');
     }
     // Init
     $opts = array('no_results_text' => $this->no_results_text, 'allow_single_deselect' => $this->allow_single_deselect ? true : false);
     if (self::config()->rtl) {
         $this->addExtraClass('chosen-rtl');
     }
     if ($this->allow_max_selected) {
         $opts['allow_max_selected'] = $this->allow_max_selected;
     }
     if ($this->use_order) {
         $stringValue = $this->value;
         if (is_array($stringValue)) {
             $stringValue = implode(',', $stringValue);
         }
         $this->setAttribute('data-chosen-order', $stringValue);
     }
     $this->setAttribute('data-chosen', json_encode($opts));
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/ChosenField.js');
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-form-extras,代码行数:30,代码来源:ChosenField.php

示例3: Field

    /**
     * @param array $parameters
     * @return string
     */
    public function Field($parameters = array())
    {
        $field = parent::Field($parameters);
        if ($this->autocomplete) {
            $this->addExtraClass("chosenAutocompleteField");
            $field = parent::Field($parameters);
            Requirements::css("dropdown2autocomplete/javascript/chosen/chosen.min.css");
            Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
            Requirements::javascript("dropdown2autocomplete/javascript/chosen/chosen.jquery.min.js");
            Requirements::customScript('
					jQuery("#' . $this->ID() . '").chosen(' . $this->Config()->get("js_settings") . ');
					jQuery("body").on(
						"focus",
						".chosenAutocompleteField:visible",
						function(){
							jQuery(this).chosen(' . $this->Config()->get("js_settings") . ');
						}
					);
				', $this->ID() . "_chosen_setup");
        }
        return $field;
    }
开发者ID:sunnysideup,项目名称:dropdown2autocomplete,代码行数:26,代码来源:Listbox2AutocompleteField.php

示例4: Field

 public function Field($properties = array())
 {
     FormExtraJquery::include_jquery();
     $use_v3 = self::config()->use_v3;
     if ($use_v3) {
         Requirements::css(FORM_EXTRAS_PATH . '/javascript/select2-v3/select2.css');
         Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/select2-v3/select2.min.js');
         // Locale support
         $lang = i18n::get_lang_from_locale(i18n::get_locale());
         if ($lang != 'en') {
             Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/select2-v3/select2_locale_' . $lang . '.js');
         }
     } else {
         // Locale support
         $lang = i18n::get_lang_from_locale(i18n::get_locale());
         if ($lang != 'en') {
             Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/select2-v4/i18n/' . $lang . '.js');
         }
         // Use full release
         Requirements::css(FORM_EXTRAS_PATH . '/javascript/select2-v4/css/select2.min.css');
         FormExtraJquery::include_mousewheel();
         Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/select2-v4/js/select2.full.min.js');
     }
     // Build options
     $opts = array();
     if ($this->allow_single_deselect) {
         if ($use_v3) {
             $opts['allowClear'] = $this->allow_single_deselect;
         } else {
             $opts['allow_clear'] = $this->allow_single_deselect;
         }
     }
     if ($this->allow_max_selected) {
         if ($use_v3) {
             $opts['maximumSelectionSize'] = $this->allow_max_selected;
         } else {
             $opts['maximumSelectionLength'] = $this->allow_max_selected;
         }
     }
     if ($this->tags) {
         if ($use_v3) {
             if (is_array($this->source)) {
                 $source = array_values($this->source);
             } else {
                 $source = array();
             }
             // Tags is an array
             $opts['tags'] = $source;
             $opts['tokenSeparators'] = $this->token_separators;
             // Not compatible with select
             $this->multiple = false;
             $this->template = 'HiddenField';
         } else {
             // Tags are calculated from options
             $opts['tags'] = $this->tags;
             $opts['token_separators'] = $this->token_separators;
             $opts['free_order'] = $this->free_order;
         }
     }
     if (self::config()->rtl && !$use_v3) {
         $opts['dir'] = 'rtl';
     }
     if ($this->ajax) {
         $opts['ajax'] = $this->ajax;
     }
     if (FormExtraJquery::isAdminBackend()) {
         Requirements::customScript('var select2_' . $this->ID() . ' = ' . json_encode($opts));
         Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/Select2Field.js');
     } else {
         Requirements::customScript('jQuery("#' . $this->ID() . '").select2(' . json_encode($opts) . ');');
     }
     if ($use_v3) {
         // If you need to adjust the size, it's better to use the field container instead
         $this->setAttribute('style', 'width:100%');
     }
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-form-extras,代码行数:77,代码来源:Select2Field.php

示例5: testFieldRenderingMultipleOn

 public function testFieldRenderingMultipleOn()
 {
     $choices = array('a' => 'a value', 'b' => 'b value', 'c' => 'c value');
     $field = new ListboxField('Choices', 'Choices', $choices);
     $field->multiple = true;
     $field->setValue('a,c');
     $parser = new CSSContentParser($field->Field());
     $optEls = $parser->getBySelector('option');
     $this->assertEquals(3, count($optEls));
     $this->assertEquals('selected', (string) $optEls[0]['selected']);
     $this->assertEquals('', (string) $optEls[1]['selected']);
     $this->assertEquals('selected', (string) $optEls[2]['selected']);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:13,代码来源:ListboxFieldTest.php

示例6: Field

 /**
  * @param array $properties
  * @return HTMLText
  */
 public function Field($properties = array())
 {
     Requirements::css(MULTISELECT_BASE . '/thirdparty/multiselect/css/ui.multiselect.css');
     Requirements::css(MULTISELECT_BASE . '/css/MultiSelectField.css');
     Requirements::javascript(MULTISELECT_BASE . '/thirdparty/multiselect/js/ui.multiselect.js');
     Requirements::javascript(MULTISELECT_BASE . '/javascript/MultiSelectField.js');
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-multiselectfield,代码行数:12,代码来源:MultiSelectField.php


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