本文整理汇总了PHP中Zend\Form\Element::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Element::getValue方法的具体用法?PHP Element::getValue怎么用?PHP Element::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Form\Element
的用法示例。
在下文中一共展示了Element::getValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValue
/**
* {@inheritDoc}
*/
public function getValue()
{
if (null === $this->value) {
$this->value = __('Submit');
}
return parent::getValue();
}
示例2: getValue
/**
* Retrieve the element value
*
* If the value is a DateTime object, and $returnFormattedValue is true
* (the default), we return the string
* representation using the currently registered format.
*
* If $returnFormattedValue is false, the original value will be
* returned, regardless of type.
*
* @param bool $returnFormattedValue
* @return mixed
*/
public function getValue($returnFormattedValue = true)
{
$value = parent::getValue();
if (!$value instanceof PhpDateTime || !$returnFormattedValue) {
return $value;
}
$format = $this->getFormat();
return $value->format($format);
}
示例3: __invoke
public function __invoke(Element $element)
{
$value = $element->getValue();
if (!$value) {
$value = 'default';
}
$view = $this->getView();
$default = $view->escapeHtmlAttr($view->basePath('img/avatars/' . $value . '.png'));
$id = uniqid('dialog-', false);
$element->setOption('dialog_id', $id);
$name = $view->escapeHtmlAttr($element->getName());
$html = <<<EOT
<div class="zource-avatar-selection zui-file-selection-trigger-container" data-zui-file-selection-trigger="#file-selection-{$id}">
<input type="hidden" name="{$name}" value="{$value}">
<p>
<img src="{$default}" alt="Avatar" tabindex="1" class="zui-file-selection-trigger-thumb">
</p>
</div>
EOT;
return $html;
}
示例4: getValue
/**
* Get value
*
* If element type is one of the button types, returns the label.
*
* @param \Zend\Form\Element $element
* @return string|null
*/
public function getValue($element)
{
if (!$element instanceof Element) {
return null;
}
foreach ($this->_buttonTypes as $type) {
if ($element instanceof $type) {
if (stristr($type, 'button')) {
$element->content = $element->getLabel();
return null;
}
return $element->getLabel();
}
}
return $element->getValue();
}
示例5: testPassingConfigObjectToConstructorSetsObjectState
public function testPassingConfigObjectToConstructorSetsObjectState()
{
$config = new Config($this->getOptions());
$element = new Element($config);
$this->assertEquals('changed', $element->getName());
$this->assertEquals('foo', $element->getValue());
$this->assertEquals('bar', $element->getLabel());
$this->assertEquals(50, $element->getOrder());
$this->assertFalse($element->isRequired());
$this->assertEquals('bar', $element->foo);
$this->assertEquals('bat', $element->baz);
}
示例6: getValue
/**
* @inheritdoc
*/
public function getValue()
{
return $this->element->getValue();
}
示例7: getUser
/**
* Gets the user entity or null.
*
* @return UserInterface|null
*/
public function getUser()
{
$value = parent::getValue();
return $value instanceof UserInterface ? $value : null;
}