本文整理汇总了PHP中FormField::removeExtraClass方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::removeExtraClass方法的具体用法?PHP FormField::removeExtraClass怎么用?PHP FormField::removeExtraClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::removeExtraClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemoveManyExtraClasses
public function testRemoveManyExtraClasses()
{
$field = new FormField('MyField');
$field->addExtraClass('class1 class2 class3 class4 class5');
//test we can remove a single class we just added
$field->removeExtraClass('class3');
$this->assertStringEndsWith('class1 class2 class4 class5', $field->extraClass());
//check we can remove many classes at once
$field->removeExtraClass('class1 class5');
$this->assertStringEndsWith('class2 class4', $field->extraClass());
//check that removing a dud class is fine
$field->removeExtraClass('dudClass');
$this->assertStringEndsWith('class2 class4', $field->extraClass());
}
示例2: removeExtraClass
/**
* Override removeExtraClass
*
* @param string $class
*/
public function removeExtraClass($class)
{
$this->fieldPostcode->removeExtraClass($class);
$this->fieldCountry->removeExtraClass($class);
return $this;
}
示例3: removeExtraClass
/**
* Override removeExtraClass
*
* @param string $class
*/
public function removeExtraClass($class)
{
$this->fieldAddress->removeExtraClass($class);
return $this;
}
示例4: removeExtraClass
/**
* Override removeExtraClass
*
* @param string $class
*/
public function removeExtraClass($class)
{
$this->fieldLatitude->removeExtraClass($class);
$this->fieldLongditude->removeExtraClass($class);
return $this;
}
示例5: apply
/**
* @param ISurveyStep $current_step
* @param ISurveyQuestionTemplate $question
* @param array $static_rules
* @param FormField $field
*/
public function apply(ISurveyStep $current_step, ISurveyQuestionTemplate $question, array $static_rules, FormField $field)
{
if (count($static_rules)) {
foreach ($static_rules as $id => $info) {
$q = $info['question'];
$values = $info['values'];
$operator = $info['operator'];
$visibility = $info['visibility'];
$default = $info['default'];
$boolean_operator = $info['boolean_operator'];
$initial_condition = $info['initial_condition'];
$answer = $current_step->survey()->findAnswerByQuestion($q);
if (is_null($answer)) {
continue;
}
//checks the condition
switch ($operator) {
case 'Equal':
foreach ($values as $vid) {
if ($boolean_operator === 'And') {
$initial_condition &= strpos($answer->value(), $vid) !== false;
} else {
$initial_condition |= strpos($answer->value(), $vid) !== false;
}
}
break;
case 'Not-Equal':
foreach ($values as $vid) {
if ($boolean_operator === 'And') {
$initial_condition &= strpos($answer->value(), $vid) === false;
} else {
$initial_condition |= strpos($answer->value(), $vid) === false;
}
}
break;
}
//visibility
switch ($visibility) {
case 'Visible':
if (!$initial_condition) {
$field->addExtraClass('hidden');
// if not visible clean it
$field->setValue('');
} else {
$field->removeExtraClass('hidden');
}
break;
case 'Not-Visible':
if ($initial_condition) {
$field->addExtraClass('hidden');
// if not visible clean it
$field->setValue('');
} else {
$field->removeExtraClass('hidden');
}
break;
}
// set the default value set on the rule
if (!empty($default)) {
$field->setValue($default);
if ($question instanceof IMultiValueQuestionTemplate) {
$value_template = $question->getValueByValue($default);
if (!is_null($value_template)) {
$field->setValue($value_template->getIdentifier());
}
}
}
}
}
}