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


PHP OptionsetField::Field方法代码示例

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


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

示例1: testReadonlyField

 public function testReadonlyField()
 {
     $sourceArray = array(0 => 'No', 1 => 'Yes');
     $field = new OptionsetField('FeelingOk', 'are you feeling ok?', $sourceArray, 1);
     $field->setEmptyString('(Select one)');
     $field->setValue(1);
     $readonlyField = $field->performReadonlyTransformation();
     preg_match('/Yes/', $field->Field(), $matches);
     $this->assertEquals($matches[0], 'Yes');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:10,代码来源:OptionsetFieldTest.php

示例2: testSetDisabledItems

 public function testSetDisabledItems()
 {
     $f = new OptionsetField('Test', false, array(0 => 'Zero', 1 => 'One'));
     $f->setDisabledItems(array(0));
     $p = new CSSContentParser($f->Field());
     $item0 = $p->getBySelector('#Test_0');
     $item1 = $p->getBySelector('#Test_1');
     $this->assertEquals((string) $item0[0]['disabled'], 'disabled');
     $this->assertEquals((string) $item1[0]['disabled'], '');
 }
开发者ID:normann,项目名称:sapphire,代码行数:10,代码来源:OptionsetFieldTest.php

示例3: testSafelyCast

 public function testSafelyCast()
 {
     $field1 = new OptionsetField('Options', 'Options', array(1 => 'One', 2 => 'Two & Three', 3 => DBField::create_field('HTMLText', 'Four & Five & Six')));
     $fieldHTML = (string) $field1->Field();
     $this->assertContains('One', $fieldHTML);
     $this->assertContains('Two & Three', $fieldHTML);
     $this->assertNotContains('Two & Three', $fieldHTML);
     $this->assertContains('Four & Five & Six', $fieldHTML);
     $this->assertNotContains('Four & Five & Six', $fieldHTML);
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:10,代码来源:OptionsetFieldTest.php

示例4: Field

 /**
  * Standard SS method - returns the string for the Field.
  * Note that we include JS from this method.
  * @return HTML
  */
 function Field()
 {
     $jsArray = array();
     $js = '';
     $jsonCompare = array();
     if ($this->addresses) {
         foreach ($this->addresses as $address) {
             $js .= " EcomSelectOrderAddressField.set_data(" . $address->ID . ", " . $address->JSONData() . ");\r\n";
         }
     }
     Requirements::javascript("ecommerce/javascript/EcomSelectOrderAddressField.js");
     Requirements::customScript($js, "Update_" . $this->Name());
     return parent::Field();
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:19,代码来源:SelectOrderAddressField.php

示例5: Field

 /**
  * @param array $properties
  * @return HTMLText
  */
 public function Field($properties = array())
 {
     $this->addExtraClass('prettyoptionsetfield')->setAttribute('data-prettyoptionsetconfig', Convert::array2json($this->pretty_optionset_config));
     //allow for not including default styles
     if ($this->config()->get('require_css') == true) {
         Requirements::css(PRETTY_CHECKABLE_FIELD_THIRDPARTY . '/prettyCheckable-2.1.2/dist/prettyCheckable.css');
     }
     Requirements::javascript(PRETTY_CHECKABLE_FIELD_THIRDPARTY . '/prettyCheckable-2.1.2/dist/prettyCheckable.min.js');
     if (is_a($this->Form, 'BootstrapForm')) {
         Requirements::javascript(PRETTY_CHECKABLE_FIELD_JAVASCRIPT . 'pretty.optionset.field.bootstrap.js');
     } else {
         Requirements::javascript(PRETTY_CHECKABLE_FIELD_JAVASCRIPT . 'pretty.optionset.field.js');
     }
     return parent::Field($properties);
 }
开发者ID:muskie9,项目名称:silverstripe-pretty-checkable-field,代码行数:19,代码来源:PrettyOptionsetField.php

示例6: testFieldHasExtraClass

 function testFieldHasExtraClass()
 {
     /* TextField has an extra class name and is in the HTML the field returns */
     $textField = new TextField('Name');
     $textField->addExtraClass('thisIsMyClassNameForTheFormField');
     preg_match('/thisIsMyClassNameForTheFormField/', $textField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyClassNameForTheFormField');
     /* EmailField has an extra class name and is in the HTML the field returns */
     $emailField = new EmailField('Email');
     $emailField->addExtraClass('thisIsMyExtraClassForEmailField');
     preg_match('/thisIsMyExtraClassForEmailField/', $emailField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyExtraClassForEmailField');
     /* OptionsetField has an extra class name and is in the HTML the field returns */
     $optionsetField = new OptionsetField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)');
     $optionsetField->addExtraClass('thisIsMyExtraClassForOptionsetField');
     preg_match('/thisIsMyExtraClassForOptionsetField/', $optionsetField->Field(), $matches);
     $this->assertTrue($matches[0] == 'thisIsMyExtraClassForOptionsetField');
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:18,代码来源:FormFieldTest.php

示例7: Field

 function Field($properties = array())
 {
     Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/SexyOptionsetField.js');
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-form-extras,代码行数:5,代码来源:SexyOptionsetField.php

示例8: Field

 public function Field()
 {
     $this->getSource();
     //die($this->Link('findOrAdd'));
     //Requirements::javascript(THIRDPARTY_DIR."/jquery-livequery/jquery.livequery.js");
     Requirements::javascript(MOD_QA_DIR . '/javascript/quickAddField.js');
     Requirements::CSS(MOD_QA_DIR . '/css/quickaddfield.css');
     if ($this->fieldType == 'CheckboxSetField') {
         $selectAll = '';
         if ($this->selectAll) {
             $selectAll = '<a class="selectAll" href="#">Select All</a>';
         }
         return $selectAll . CheckboxSetField::Field();
     }
     return parent::Field();
 }
开发者ID:betterbrief,项目名称:silverstripe-quickaddfield,代码行数:16,代码来源:QuickAddField.php

示例9: Field

 /**
  * @param array $properties
  * @return HTMLText
  */
 public function Field($properties = array())
 {
     Requirements::css(COLORPALETTE_DIR . '/css/ColorPaletteField.css');
     return parent::Field($properties);
 }
开发者ID:heyday,项目名称:silverstripe-colorpalette,代码行数:9,代码来源:ColorPaletteField.php

示例10: Field

 /**
  * @param array $properties
  * @return HTMLText
  */
 public function Field($properties = [])
 {
     Requirements::css(IMAGEOPTIONSETFIELD_PATH . '/css/imageoptionsetfield.css');
     return parent::Field($properties);
 }
开发者ID:unclecheese,项目名称:silverstripe-image-optionset,代码行数:9,代码来源:ImageOptionsetField.php

示例11: Field

	function Field() {
		OptionsetShowHideField::include_files();
		return parent::Field();
	}
开发者ID:nathancox,项目名称:silverstripe-showhidefield,代码行数:4,代码来源:OptionsetShowHideField.php


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