コード例 #1
0
ファイル: jsonForm.php プロジェクト: jazzee/foundation
/**
 * 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;
}
コード例 #2
0
ファイル: Field.php プロジェクト: jazzee/foundation
 /**
  * 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;
 }
コード例 #3
0
ファイル: ListItem.php プロジェクト: jazzee/foundation
 public function __construct()
 {
     parent::__construct();
     $this->attributes['disabled'] = 'disabled';
     $this->attributes['value'] = 'value';
     $this->attributes['metadataString'] = 'data-metadata';
     $this->clearMetadata();
 }
コード例 #4
0
ファイル: AbstractElement.php プロジェクト: jazzee/foundation
 /**
  * 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]);
 }
コード例 #5
0
ファイル: Menu.php プロジェクト: jazzee/foundation
 /**
  * Construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->links = array();
 }
コード例 #6
0
ファイル: Link.php プロジェクト: jazzee/foundation
 /**
  * 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;
 }