本文整理汇总了PHP中Tag::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::__toString方法的具体用法?PHP Tag::__toString怎么用?PHP Tag::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::__toString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
if (empty($this->href) && !empty($this->events)) {
$this->voidHref();
}
return parent::__toString();
}
示例2: __toString
public function __toString()
{
$label = parent::__toString();
if ($this->required) {
$label .= ' <i class="required fa fa-asterisk"></i>';
}
return $label;
}
示例3: __toString
/**
*
* @return string
*/
public function __toString()
{
$string = '';
if ($this->title() != '' || $this->items()->size() > 1) {
$string = parent::__toString();
}
return $string;
}
示例4: __toString
public function __toString()
{
if (!$this->width || !$this->height) {
$this->loadDimensions();
}
if (empty($this->alt)) {
$path = explode('/', $this->src);
$this->alt = end($path);
}
if (empty($this->title)) {
$this->title = $this->alt;
}
return parent::__toString();
}
示例5: getInputStringArray
/**
* Returns an associative array containing all the elements of the form.
* @return array
*/
public function getInputStringArray($choice_as_array = true)
{
if (!empty(self::$css_addition)) {
$this->loadCSSAddition();
}
$value['form_start'] = str_replace('</form>', '', parent::__toString());
if (!empty($this->inputs)) {
foreach ($this->inputs as $input_name => $input_list) {
$multiple = count($input_list) > 1;
foreach ($input_list as $input) {
$group_name = $input_name . '_group';
if ($input instanceof \Form\Choice\Radio || $input instanceof \Form\Choice\Checkbox) {
$choice_array = $input->getStringArray();
if ($choice_as_array) {
$value[$input_name] = $choice_array;
} else {
foreach ($choice_array as $k => $cval) {
$iname = $input_name . '_' . $k;
$value[$iname] = $cval;
}
}
} elseif ($input->getType() == 'hidden') {
$value['hidden'][] = $input->__toString();
} else {
if ($input->getLabelLocation()) {
$label = $input_name . '_label';
if ($multiple) {
$value[$label][] = $input->getLabel();
} else {
$value[$label] = $input->getLabel();
}
$group_label = $input->getLabel();
} else {
$group_label = null;
}
if ($multiple) {
$value[$input_name][] = $input->__toString();
} else {
$value[$input_name] = $input->__toString();
}
if ($input->getLabelLocation() == -1) {
$groups[$group_name][] = $group_label . ' ' . $input->__toString();
} else {
$groups[$group_name][] = $input->__toString() . ' ' . $group_label;
}
}
}
}
} else {
throw new \Exception(t('No inputs in current Form object'));
}
if (!empty($groups)) {
foreach ($groups as $gname => $g) {
$gclass = str_replace('_', '-', $gname);
$value[$gname] = '<div class="' . $gclass . ' ' . implode("\n", $this->group_class) . '">' . implode("\n", $g) . '</div>';
}
}
if (isset($value['hidden'])) {
$value['form_start'] .= "\n" . implode("\n", $value['hidden']);
}
$value['form_end'] = '</form>';
return $value;
}
示例6: __toString
/**
* Returns the img tag string
* @return string
*/
public function __toString()
{
if (!$this->width && !$this->height) {
$this->loadDimensions();
}
return parent::__toString();
}
示例7: printWithLabel
/**
* Returns input object's output with label alongside.
* @return string
*/
public function printWithLabel()
{
switch ($this->label_location) {
case -1:
return $this->getLabel() . ' ' . $this->__toString();
break;
case 0:
return parent::__toString();
break;
case 1:
return parent::__toString() . ' ' . $this->getLabel();
break;
}
}
示例8: __toString
/**
*
* @return string
*/
public function __toString()
{
$string = '<!DOCTYPE ' . $this->doctype() . '>';
$string .= parent::__toString();
return $string;
}
示例9: __toString
public function __toString()
{
$this->addIconClass();
return parent::__toString();
}