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


PHP FormField::removeExtraClass方法代码示例

本文整理汇总了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());
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:14,代码来源:FormFieldTest.php

示例2: removeExtraClass

 /**
  * Override removeExtraClass
  * 
  * @param string $class
  */
 public function removeExtraClass($class)
 {
     $this->fieldPostcode->removeExtraClass($class);
     $this->fieldCountry->removeExtraClass($class);
     return $this;
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-geoform,代码行数:11,代码来源:PostCodeLocationField.php

示例3: removeExtraClass

 /**
  * Override removeExtraClass
  * 
  * @param string $class
  */
 public function removeExtraClass($class)
 {
     $this->fieldAddress->removeExtraClass($class);
     return $this;
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-geoform,代码行数:10,代码来源:BackendGeoLocationField.php

示例4: removeExtraClass

 /**
  * Override removeExtraClass
  * 
  * @param string $class
  */
 public function removeExtraClass($class)
 {
     $this->fieldLatitude->removeExtraClass($class);
     $this->fieldLongditude->removeExtraClass($class);
     return $this;
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-geoform,代码行数:11,代码来源:LocationField.php

示例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());
                     }
                 }
             }
         }
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:76,代码来源:AbstractSurveyQuestionTemplateUIBuilder.php


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