public function __toString() { if (empty($this->href) && !empty($this->events)) { $this->voidHref(); } return parent::__toString(); }
public function __toString() { $label = parent::__toString(); if ($this->required) { $label .= ' <i class="required fa fa-asterisk"></i>'; } return $label; }
/** * * @return string */ public function __toString() { $string = ''; if ($this->title() != '' || $this->items()->size() > 1) { $string = parent::__toString(); } return $string; }
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(); }
/** * 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; }
/** * Returns the img tag string * @return string */ public function __toString() { if (!$this->width && !$this->height) { $this->loadDimensions(); } return parent::__toString(); }
/** * 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; } }
/** * * @return string */ public function __toString() { $string = '<!DOCTYPE ' . $this->doctype() . '>'; $string .= parent::__toString(); return $string; }
public function __toString() { $this->addIconClass(); return parent::__toString(); }