/** * Sets the runtimeComponentName property, depending on the type of * Input tag * @return void */ function prepare() { $type = strtolower($this->getAttribute('type')); switch ($type) { case 'text': $this->runtimeComponentName = 'WactInputComponent'; break; case 'password': $this->runtimeComponentName = 'WactFormElementComponent'; break; case 'checkbox': $this->runtimeComponentName = 'WactCheckableInputComponent'; break; case 'submit': $this->runtimeComponentName = 'WactFormElementComponent'; break; case 'radio': $this->runtimeComponentName = 'WactCheckableInputComponent'; break; case 'reset': $this->runtimeComponentName = 'WactFormElementComponent'; break; case 'file': $this->runtimeComponentName = 'WactFileInputComponent'; $this->runtimeIncludeFile = 'limb/wact/src/components/form/WactFileInputComponent.class.php'; break; case 'hidden': $this->runtimeComponentName = 'WactInputComponent'; break; case 'image': $this->runtimeComponentName = 'WactInputComponent'; break; case 'button': $this->runtimeComponentName = 'WactInputComponent'; break; default: $this->raiseCompilerError('Unrecognized type attribute for input tag'); } parent::prepare(); }
function prepare() { if ($this->getBoolAttribute('multiple')) { $this->runtimeIncludeFile = 'limb/wact/src/components/form/WactSelectMultipleComponent.class.php'; $this->runtimeComponentName = 'WactSelectMultipleComponent'; // Repetition of ControlTag::prepare but required for special case // of SelectMultiple to provide meaningful error messages if (!$this->getBoolAttribute('name')) { if ($this->getBoolAttribute('id')) { $this->setAttribute('name', $this->getAttribute('id') . '[]'); } else { $this->raiseRequiredAttributeError('name'); } } if (!is_integer(strpos($this->getAttribute('name'), '[]'))) { $this->raiseCompilerError('Array brackets "[]" required in name attribute, e.g. name="foo[]"', array('name' => $this->getAttribute('name'))); } } else { $this->runtimeIncludeFile = 'limb/wact/src/components/form/WactSelectSingleComponent.class.php'; $this->runtimeComponentName = 'WactSelectSingleComponent'; } parent::prepare(); }
function prepare() { $this->setAttribute('type', 'hidden'); parent::prepare(); }