本文整理匯總了PHP中TextField::extraClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP TextField::extraClass方法的具體用法?PHP TextField::extraClass怎麽用?PHP TextField::extraClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TextField
的用法示例。
在下文中一共展示了TextField::extraClass方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testDefaultClasses
public function testDefaultClasses()
{
Config::nest();
Config::inst()->update('FormField', 'default_classes', array('class1'));
$field = new FormField('MyField');
$this->assertContains('class1', $field->extraClass(), 'Class list does not contain expected class');
Config::inst()->update('FormField', 'default_classes', array('class1', 'class2'));
$field = new FormField('MyField');
$this->assertContains('class1 class2', $field->extraClass(), 'Class list does not contain expected class');
Config::inst()->update('FormField', 'default_classes', array('class3'));
$field = new FormField('MyField');
$this->assertContains('class3', $field->extraClass(), 'Class list does not contain expected class');
$field->removeExtraClass('class3');
$this->assertNotContains('class3', $field->extraClass(), 'Class list contains unexpected class');
Config::inst()->update('TextField', 'default_classes', array('textfield-class'));
$field = new TextField('MyField');
//check default classes inherit
$this->assertContains('class3', $field->extraClass(), 'Class list does not contain inherited class');
$this->assertContains('textfield-class', $field->extraClass(), 'Class list does not contain expected class');
Config::unnest();
}
示例2: extraClass
public function extraClass()
{
return 'text ' . parent::extraClass();
}
示例3: extraClass
public function extraClass()
{
$class = parent::extraClass();
return 'text ' . $class;
}
示例4: extraClass
function extraClass()
{
return parent::extraClass() . " autocomplete";
}