public function renderAttributes(array $options) { if (!empty($options)) { return $options = $this->html->attributes($options); } else { return ''; } }
/** * Create a button element. * * @param string $value * @param array $options * @return string */ public function button($value = null, $options = array()) { if (!array_key_exists('type', $options)) { $options['type'] = 'button'; } return '<button' . $this->html->attributes($options) . '>' . $value . '</button>'; }
/** * Generate a link to a JavaScript file. * * @param string $url * @param array $attributes * @param bool $secure * @return string */ public static function scriptmod($url, $attributes = array(), $secure = null) { $HtmlBuilder = new HtmlBuilder(); $filemtime = @filemtime(@dirname(@$_SERVER['SCRIPT_FILENAME']) . "/" . $url); $attributes['src'] = asset($url, $secure) . ($filemtime > 0 ? "?" . $filemtime : ""); return '<script' . $HtmlBuilder->attributes($attributes) . '></script>' . PHP_EOL; }
/** * Create an alert item with optional emphasis. * * @param string $type * @param string $content * @param string $emphasis * @param boolean $dismissible * @param array $attributes * * @return string */ protected function alert($type = 'message', $content = null, $emphasis = null, $dismissible = false, array $attributes = array()) { $attributes = array_merge(array('class' => 'alert' . ($dismissible ? ' alert-dismissable' : '') . ' alert-' . ($type != 'message' ? $type : 'default')), $attributes); $return = '<div ' . $this->html->attributes($attributes) . '>'; if ($dismissible !== null) { $return .= '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'; } $return .= ($emphasis !== null && is_string($emphasis) ? '<strong>' . $emphasis . '</strong> ' : '') . $content . '</div>'; return $return; }
/** * Build an HTML attribute string from an array. * * @param array $attributes * @return string * @static */ public static function attributes($attributes) { return \Illuminate\Html\HtmlBuilder::attributes($attributes); }
/** * Generate a link to a JavaScript file. * * @param string $name * @param string $url * @param array $attributes * @return string */ public function script($name, $url, $attributes = array(), $secure = false) { $attributes['src'] = $this->asset($name, $url, $secure); return '<script' . $this->html->attributes($attributes) . '></script>' . PHP_EOL; }
/** * Convert HTML attributes into "property = value" pairs. * * @param array $attributes * * @return string */ public function attributes($attributes = array()) { return $this->html->attributes($attributes); }
/** * @param Element $row * @return string */ public function rowOpen(Element $row) { $_atts = $this->htmlBuilder->attributes($row->getAttributes()); return '<div' . $_atts . '><div class="row">'; }
/** * Generate a self-closing tag * @param $tagName * @param $tagContent * @param array $tagAttributes * @return array */ private function pairedTag($tagName, $tagContent, $tagAttributes = []) { return ['type' => MetaFacade::PAIRED_TAG, 'tag' => $tagName, 'content' => $tagContent, 'attributes' => $this->htmlBuilder->attributes($tagAttributes)]; }