protected method

Converts a set of parameters to HTML attributes into a string.


  • array|string $params

    The parameters where key is the attribute name and the value the attribute value. When string will simply prepend with the prepend-string (by default ' ') unless $params is falsey in which case an empty string is returned. This alternative syntax is used by the method internally.

  • string $method

    When used as a context handler, the method the handler was called for I.e. 'wrap'. Currently not used by the method.

  • array $options

    Available options are:

    • 'escape' boolean: Indicates whether the output should be HTML-escaped. Defaults to true.
    • 'prepend' string: String to prepend to each attribute pair. and the final result. Defaults to ' '.
    • 'append' string: String to append to result. Defaults to ''.



Attribute string.


	protected function _attributes($params, $method = null, array $options = array()) {
		$defaults = array('escape' => true, 'prepend' => ' ', 'append' => '');
		$options += $defaults;
		$result = array();

		if (!is_array($params)) {
			return !$params ? '' : $options['prepend'] . $params;
		foreach ($params as $key => $value) {
			if ($next = $this->_attribute($key, $value, $options)) {
				$result[] = $next;
		return $result ? $options['prepend'] . implode(' ', $result) . $options['append'] : '';