예제 #1
0
 /**
  * Process DT Row Data and Attr.
  *
  * @param string $attribute
  * @param array $template
  * @return $this
  */
 public function rowData($attribute, array $template)
 {
     if (count($template)) {
         $this->data[$attribute] = [];
         foreach ($template as $key => $value) {
             $this->data[$attribute][$key] = Helper::compileContent($value, $this->data, $this->row);
         }
     }
     return $this;
 }
 public function test_compile_content_callable()
 {
     $content = function ($obj) {
         return $obj->id;
     };
     $data = ['id' => 2];
     $obj = new stdClass();
     $obj->id = 2;
     $compiled = Helper::compileContent($content, $data, $obj);
     $this->assertEquals(2, $compiled);
 }
예제 #3
0
 /**
  * Process edit columns.
  *
  * @param array $data
  * @param mixed $row
  * @return array
  */
 protected function editColumns(array $data, $row)
 {
     foreach ($this->editColumns as $key => $value) {
         $value['content'] = Helper::compileContent($value['content'], $data, $row);
         $data[$value['name']] = $value['content'];
     }
     return $data;
 }
예제 #4
0
 /**
  * Process edit columns.
  *
  * @param mixed $data
  * @param mixed $row
  * @return array
  */
 protected function editColumns($data, $row)
 {
     foreach ($this->editColumns as $key => $value) {
         $value['content'] = Helper::compileContent($value['content'], $data, $row);
         Arr::set($data, $value['name'], $value['content']);
     }
     return $data;
 }