本文整理汇总了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');
}
示例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'], '');
}
示例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);
}
示例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();
}
示例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);
}
示例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');
}
示例7: Field
function Field($properties = array())
{
Requirements::javascript(FORM_EXTRAS_PATH . '/javascript/SexyOptionsetField.js');
return parent::Field($properties);
}
示例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();
}
示例9: Field
/**
* @param array $properties
* @return HTMLText
*/
public function Field($properties = array())
{
Requirements::css(COLORPALETTE_DIR . '/css/ColorPaletteField.css');
return parent::Field($properties);
}
示例10: Field
/**
* @param array $properties
* @return HTMLText
*/
public function Field($properties = [])
{
Requirements::css(IMAGEOPTIONSETFIELD_PATH . '/css/imageoptionsetfield.css');
return parent::Field($properties);
}
示例11: Field
function Field() {
OptionsetShowHideField::include_files();
return parent::Field();
}