/** * Prepare data grid columns. * * @param bool $results * @return array */ protected function prepareColumns($model) { $el = []; foreach ($this->dataGridColumns as $attributes) { $type = array_pull($attributes, 'type'); if ($type) { if ($type === 'a') { $elementContent = '<%= r.' . array_pull($attributes, 'content') . ' %>'; $link = $this->html->decode($this->html->link('#', $elementContent, $attributes)); $link = str_replace('href="#"', 'href="<%= r.edit_uri %>"', $link); $el[] = $link; } elseif ($type === 'checkbox') { $checkBoxName = array_pull($attributes, 'name'); $value = array_pull($attributes, 'value'); $value = '<%= r.' . $value . ' %>'; $el[] = $this->html->decode($this->form->checkbox($checkBoxName, $value, null, $attributes)); } } else { $el[] = '<%= r.' . array_pull($attributes, 'content') . ' %>'; } } return $el; }
/** * Generate a HTML link. * * @param string $url * @param string $title * @param array $attributes * @param bool $secure * @return string * @static */ public static function link($url, $title = null, $attributes = array(), $secure = null) { return \Illuminate\Html\HtmlBuilder::link($url, $title, $attributes, $secure); }
/** * Generate a HTML link. * * @param string $url * @param string $title * @param array $attributes * @param bool $secure * @return \Illuminate\Support\HtmlString */ public function link($url, $title = null, $attributes = array(), $secure = null) { return new HtmlString(parent::link($url, $title, $attributes, $secure)); }