/**
  * 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;
 }
Beispiel #2
0
 /**
  * Convert entities to HTML characters.
  *
  * @param string $value
  * @return string 
  * @static 
  */
 public static function decode($value)
 {
     return \Illuminate\Html\HtmlBuilder::decode($value);
 }