/** * Get the label for a given column if it is set * * @author tspencer * @param string $col Column name to get the field from * @return string Label for this column if it is set *****************************************************/ public function get_label($col) { if (!$this->_orm) { throw new Missing_ORM_Exception("There is no ORM object linked to this Entity instance"); } $labels = $this->_orm->labels(); return isset($labels[$col]) ? $labels[$col] : ''; }
public function __construct(ORM $orm, array $columns = array(), $options = array()) { $this->_options = $options; $this->set_name($orm->object_name()); foreach ($columns as $name => $column) { if (!is_array($column)) { $column = array('type' => $column); } $column_cfg = array('name' => $name, 'header' => Arr::get($orm->labels(), $name), 'params' => Arr::get($column, 'params', array())); $column = Arr::merge($column_cfg, (array) $column); $column = Grid_Column::factory($column); $this[$name] = $column; } $this->_orm = $orm; }
protected function __construct(ORM $object, array $fields = array()) { $this->_object = $object; $this->set_name($object->object_name()); $hash = ''; foreach ($fields as $name => $field) { if (!is_array($field)) { $field = array('type' => $field); } $field_cfg = array('name' => $name, 'label' => Arr::get($object->labels(), $name), 'value' => $object[$name]); $field = Arr::merge($field_cfg, (array) $field); $field = Form_Field::factory($field); $field->set_object($object); $this[$name] = $field; $hash .= $field->hash(); } $this->_hash = md5($hash); }
public function labels() { if (!$this->_z_inited) { return parent::labels(); } return $this->_z_labels; }