本文整理汇总了PHP中FormField::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::getAttributes方法的具体用法?PHP FormField::getAttributes怎么用?PHP FormField::getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::getAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAttributes
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: getAttributes
/**
* @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: getAttributes
function getAttributes() {
return array_merge(
parent::getAttributes(),
array(
'rows' => $this->rows,
'cols' => $this->cols,
'value' => null,
'type' => null
)
);
}
示例4: getAttributes
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,
)
);
}
示例5: getAttributes
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: getAttributes
public function getAttributes()
{
return array_merge(parent::getAttributes(), array('tabindex' => null, 'type' => null, 'value' => null, 'type' => null, 'title' => $this->tag == 'fieldset' ? null : $this->legend));
}
示例7: getAttributes
public function getAttributes()
{
return array_merge(parent::getAttributes(), array('type' => null, 'value' => null));
}
示例8: getAttributes
/**
* 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: getAttributes
/**
* {@inheritdoc}
*/
public function getAttributes()
{
return array_merge(parent::getAttributes(), array('type' => 'hidden'));
}
示例10: getAttributes
public function getAttributes()
{
$attributes = parent::getAttributes();
$attributes['name'] = $this->getName() . '[url]';
return $attributes;
}
示例11: testUpdateAttributes
public function testUpdateAttributes()
{
$field = new FormField('MyField');
$this->assertArrayHasKey('extended', $field->getAttributes());
}
示例12: getAttributes
function getAttributes()
{
return array_merge(parent::getAttributes(), array('maxlength' => $this->getMaxLength(), 'size' => $this->getMaxLength() ? min($this->getMaxLength(), 30) : null));
}
示例13: getAttributes
public function getAttributes()
{
$attributes = parent::getAttributes();
unset($attributes['value']);
return $attributes;
}
示例14: FieldHolder
/**
* @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)));
}
示例15: getAttributes
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));
}