コード例 #1
0
ファイル: Lists.php プロジェクト: swantrace/OctoberCMS
 /**
  * Creates a list column object from it's name and configuration.
  */
 protected function makeListColumn($name, $config)
 {
     if (is_string($config)) {
         $label = $config;
     } elseif (isset($config['label'])) {
         $label = $config['label'];
     } else {
         $label = studly_case($name);
     }
     if (strpos($name, '[') !== false && strpos($name, ']') !== false) {
         $config['valueFrom'] = $name;
         $config['sortable'] = false;
         $config['searchable'] = false;
     }
     $columnType = isset($config['type']) ? $config['type'] : null;
     $column = new ListColumn($name, $label);
     $column->displayAs($columnType, $config);
     return $column;
 }
コード例 #2
0
ファイル: Lists.php プロジェクト: GoldBest/october
 /**
  * Creates a list column object from it's name and configuration.
  */
 protected function makeListColumn($name, $config)
 {
     if (is_string($config)) {
         $label = $config;
     } elseif (isset($config['label'])) {
         $label = $config['label'];
     } else {
         $label = studly_case($name);
     }
     if (starts_with($name, 'pivot[') && strpos($name, ']') !== false) {
         $_name = HtmlHelper::nameToArray($name);
         $config['relation'] = array_shift($_name);
         $config['valueFrom'] = array_shift($_name);
         $config['searchable'] = false;
     } elseif (strpos($name, '[') !== false && strpos($name, ']') !== false) {
         $config['valueFrom'] = $name;
         $config['sortable'] = false;
         $config['searchable'] = false;
     }
     $columnType = isset($config['type']) ? $config['type'] : null;
     $column = new ListColumn($name, $label);
     $column->displayAs($columnType, $config);
     return $column;
 }
コード例 #3
0
ファイル: Lists.php プロジェクト: coderkid/october
 /**
  * Creates a list column object from it's name and configuration.
  */
 protected function makeListColumn($name, $config)
 {
     if (is_string($config)) {
         $label = $config;
     } elseif (isset($config['label'])) {
         $label = $config['label'];
     } else {
         $label = studly_case($name);
     }
     $columnType = isset($config['type']) ? $config['type'] : null;
     $column = new ListColumn($name, $label);
     $column->displayAs($columnType, $config);
     return $column;
 }