/**
  * execure the condition stored in this instance
  * @return bool
  */
 protected function execCondition()
 {
     if (class_exists('RuleEvaluator')) {
         return RuleEvaluator::create()->Execute($this->condition, $this->field->getForm()->Fields());
     }
     return true;
 }
예제 #2
0
 /**
  * Create a new nullable field
  * @param $valueField
  * @return NullableField
  */
 function __construct(FormField $valueField, $isNullLabel = null)
 {
     $this->valueField = $valueField;
     $this->isNullLabel = $isNullLabel;
     if (is_null($this->isNullLabel)) {
         // Set a default label if one is not provided.
         $this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
     }
     parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value(), $valueField->getForm(), $valueField->RightTitle());
     $this->readonly = $valueField->isReadonly();
 }
예제 #3
0
 /**
  * Create a new nullable field
  *
  * @param FormField $valueField
  * @param null|string $isNullLabel
  */
 public function __construct(FormField $valueField, $isNullLabel = null)
 {
     $this->valueField = $valueField;
     if (isset($isNullLabel)) {
         $this->setIsNullLabel($isNullLabel);
     } else {
         $this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
     }
     parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value());
     $this->setForm($valueField->getForm());
     $this->setRightTitle($valueField->RightTitle());
     $this->setReadonly($valueField->isReadonly());
 }
 /**
  * Get the form, checks for a current ContentModuleField first
  * @return Form
  */
 public function getForm()
 {
     $cModField = ContentModuleField::curr();
     if ($cModField) {
         return $cModField->getForm();
     }
     return parent::getForm();
 }
	/**
	 * Get the form our field belongs to
	 *
	 * @return FormField
	 */
	function getForm() {
		return $this->field->getForm();
	}