title = $title; $this->url = $url; $this->controller = $controller; $this->priority = $priority; parent::__construct(); } /** * @param array $attributes */ public function setAttributes($attributes) { $this->attributes = $attributes; } /** * @param array $attrs * @return DBHTMLText */ public function getAttributesHTML($attrs = null) { $excludeKeys = (is_string($attrs)) ? func_get_args() : null; if (!$attrs || is_string($attrs)) { $attrs = $this->attributes; } // Remove empty or excluded values foreach ($attrs as $key => $value) { if (($excludeKeys && in_array($key, $excludeKeys)) || (!$value && $value !== 0 && $value !== '0') ) { unset($attrs[$key]); continue; } } // Create markkup $parts = array(); foreach ($attrs as $name => $value) { $parts[] = ($value === true) ? "{$name}=\"{$name}\"" : "{$name}=\"" . Convert::raw2att($value) . "\""; } return DBField::create_field('HTMLFragment', implode(' ', $parts)); } }