/** * Get JSON attributes * @package Foundation\form */ function getAttributes(\Foundation\HTMLElement $object) { $attributes = array(); foreach ($object->getAttributes() as $memberName => $htmlName) { $method = 'get' . ucfirst($memberName); if (!method_exists($object, $method)) { throw new \Foundation\Exception("Unable to access {$memberName} using {$method} on " . get_class($f)); } $value = $object->{$method}(); if (!is_null($value)) { $attributes[] = array('name' => $htmlName, 'value' => $value); } } return $attributes; }
/** * Constructor * @param \Foundation\Form $form the form that contains this field */ public function __construct(\Foundation\Form $form) { parent::__construct(); $this->addClass('field'); $this->elements = array(); $this->form = $form; }
public function __construct() { parent::__construct(); $this->attributes['disabled'] = 'disabled'; $this->attributes['value'] = 'value'; $this->attributes['metadataString'] = 'data-metadata'; $this->clearMetadata(); }
/** * Constructor * @param \Foundation\Form\Field $field */ public function __construct(\Foundation\Form\Field $field) { $this->field = $field; parent::__construct(); $this->messages = array(); $this->attributes['name'] = 'name'; $this->attributes['accesskey'] = 'accesskey'; $this->attributes['tabindex'] = 'tabindex'; $this->validators = array(); $this->filters = array(); $this->addClass('field'); //add the Element class without its namespace $class = \explode('\\', \get_class($this)); $this->addClass($class[count($class) - 1]); }
/** * Construct */ public function __construct() { parent::__construct(); $this->links = array(); }
/** * Add current to classes if we are current * @see Foundation.HTMLElement::getClass() */ public function getClass() { $class = parent::getClass(); if ($this->current) { $class = $class . ' current'; } return $class; }