예제 #1
0
	function testAttributes() {
		$field = new FormField('MyField');
		$field->setAttribute('foo', 'bar');
		$this->assertEquals('bar', $field->getAttribute('foo'));
		$attrs = $field->getAttributes();
		$this->assertArrayHasKey('foo', $attrs);
		$this->assertEquals('bar', $attrs['foo']);
	}
예제 #2
0
 /**
  * @return array
  */
 public function getAttributes()
 {
     $maxLength = $this->getMaxLength();
     $attributes = array();
     if ($maxLength) {
         $attributes['maxLength'] = $maxLength;
         $attributes['size'] = min($maxLength, 30);
     }
     return array_merge(parent::getAttributes(), $attributes);
 }
예제 #3
0
	function getAttributes() {
		return array_merge(
			parent::getAttributes(),
			array(
				'rows' => $this->rows,
				'cols' => $this->cols,
				'value' => null,
				'type' => null
			)
		);
	}
예제 #4
0
	function getAttributes() {
		return array_merge(
			parent::getAttributes(),
			array(
				'disabled' => ($this->isReadonly() || $this->isDisabled()),
				'value' => $this->Title(),
				'type' => ($this->useButtonTag) ? null : 'submit',
				'title' => ($this->useButtonTag) ? $this->description : null,
			)
		);
	}
 function getAttributes()
 {
     $attributes = parent::getAttributes();
     if (isset($attributes['name'])) {
         $attributes['data-name'] = $attributes['name'];
     }
     array_walk($this->settings, function ($value, $name) use(&$attributes) {
         $attributes['data-' . $name] = trim(json_encode($value, JSON_UNESCAPED_SLASHES), '"\'');
     });
     return array_filter($attributes, function ($name) {
         return !in_array($name, $this->inputOnlyAttributes);
     }, ARRAY_FILTER_USE_KEY);
 }
예제 #6
0
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('tabindex' => null, 'type' => null, 'value' => null, 'type' => null, 'title' => $this->tag == 'fieldset' ? null : $this->legend));
 }
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('type' => null, 'value' => null));
 }
 /**
  * Returns the field's HTML attributes
  * @return array HTML attributes
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('size' => $this->maxLength, 'class' => 'text colorField'));
 }
예제 #9
0
 /**
  * {@inheritdoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('type' => 'hidden'));
 }
예제 #10
0
 public function getAttributes()
 {
     $attributes = parent::getAttributes();
     $attributes['name'] = $this->getName() . '[url]';
     return $attributes;
 }
 public function testUpdateAttributes()
 {
     $field = new FormField('MyField');
     $this->assertArrayHasKey('extended', $field->getAttributes());
 }
예제 #12
0
 function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('maxlength' => $this->getMaxLength(), 'size' => $this->getMaxLength() ? min($this->getMaxLength(), 30) : null));
 }
 public function getAttributes()
 {
     $attributes = parent::getAttributes();
     unset($attributes['value']);
     return $attributes;
 }
 /**
  * @param array $properties
  * @return string
  */
 public function FieldHolder($properties = array())
 {
     $content = array('actions' => '', 'content' => '', 'gridfield' => '');
     /** -----------------------------------------
      * Actions
      * ----------------------------------------*/
     $newContainer = FormField::create_tag('a', array('id' => $this->ID, 'class' => 'ss-ui-action-constructive ss-ui-button js-action site-builder__actions__item site-builder__action site-builder__actions__item--new-container', 'href' => $this->Link() . '/siteBuilderAddContainer?ParentID=' . $this->PageID), _t('SiteBuilder.ADDCONTAINER', 'Add Container') . ' <i class="icon ' . $this->config()->loading_icon . '"></i>');
     $content['actions'] = FormField::create_tag('ul', array('class' => 'site-builder__actions'), $newContainer);
     /** -----------------------------------------
      * Content
      * ----------------------------------------*/
     $items = $this->getList();
     $containers = array();
     foreach ($items as $key => $item) {
         /** @var PageBuilderContainer $item */
         $containers[] = $this->newContainer($item->ID, $item->Items());
     }
     $content['content'] = FormField::create_tag('div', array('data-url' => $this->Link(), 'class' => 'site-builder'), implode("\n", $containers));
     /** -----------------------------------------
      * Attributes
      * ----------------------------------------*/
     $attributes = array_merge(parent::getAttributes(), array('data-url' => $this->Link()));
     /** -----------------------------------------
      * Return
      * ----------------------------------------*/
     return FormField::create_tag('fieldset', array(), FormField::create_tag('div', $attributes, implode('', $content)));
 }
 public function getAttributes()
 {
     $type = isset($this->attributes['src']) ? 'image' : 'submit';
     return array_merge(parent::getAttributes(), array('disabled' => $this->isReadonly() || $this->isDisabled(), 'value' => $this->Title(), 'type' => $type, 'title' => $this->useButtonTag ? $this->description : null));
 }
예제 #16
0
 function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('type' => 'file'));
 }
 public function getAttributes()
 {
     $attrs = parent::getAttributes();
     $attrs['value'] = 1;
     return array_merge($attrs, array('checked' => $this->Value() ? 'checked' : null, 'type' => 'checkbox'));
 }
예제 #18
0
 /**
  * {@inheritdoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('data-url' => $this->Link()));
 }
예제 #19
0
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('type' => 'hidden', 'value' => $this->readonly ? null : $this->value));
 }
예제 #20
0
 public function getAttributes()
 {
     return array_diff_key(parent::getAttributes(), ['value' => null]);
 }
 /**
  * {@inheritdoc}
  */
 public function getAttributes()
 {
     return array_merge(parent::getAttributes(), array('rows' => $this->getRows(), 'cols' => $this->getColumns(), 'value' => null, 'type' => null));
 }