public function s(FieldConfigInterface $conf, FieldTypeInterface $_fieldType) { $_fieldSets = []; $_joins = []; $_fieldType->label = isset($conf->label) ? $conf->label : ucfirst($this->getName()); if (isset($conf->group)) { $_fieldSets[$conf->group]['elements'][$this->getName()] = $_fieldType->label; $_fieldType->group = $conf->group; } //FIXME this does not work for lookup fields, only for source fields. Need update. $_fieldType->default = isset($conf->default) ? $conf->default : ''; $_fieldType->source = $this->getName(); $_fields = [$this->getName() => $_fieldType->toArray()]; $_labels = [$this->getName() => $_fieldType->label]; $_fields = Arr::merge($_fields, [$this->getName() . '_id' => ['type' => 'field', 'fieldtype' => 'source', 'datatype' => 'string', 'default' => 0, 'label' => '']]); $result = ['labels' => $_labels, 'fields' => $_fields, 'joins' => $_joins, 'fieldsets' => $_fieldSets]; return $result; }
public function s(FieldConfigInterface $conf, FieldTypeInterface $_fieldType) { $_fieldSets = []; $_joins = []; $_fieldType->label = isset($conf->label) ? $conf->label : ucfirst($this->getName()); if (isset($conf->group)) { $_fieldSets[$conf->group]['elements'][$this->getName()] = $_fieldType->label; $_fieldType->group = $conf->group; } //FIXME this does not work for lookup fields, only for source fields. Need update. $_fieldType->default = isset($conf->default) ? $conf->default : ''; $_fieldType->source = $this->getName(); $_fields = [$this->getName() => $_fieldType->toArray()]; $_labels = [$this->getName() => $_fieldType->label]; /* :FIXME: */ // $_utility = $this->getFieldPart($conf->type, 'utility'); // // if (count($_utility)) { // $_fields = array_merge($_fields, $_utility); // } /**/ $result = ['labels' => $_labels, 'fields' => $_fields, 'joins' => $_joins, 'fieldsets' => $_fieldSets]; return $result; }
public function s(FieldConfigInterface $conf, FieldTypeInterface $_fieldType) { $_fieldSets = []; $_joins = []; $_fieldType->label = isset($conf->label) ? $conf->label : ucfirst($this->getName()); $_labels = []; $_sign = '_'; $_joinfields = []; $_i = 0; $_fields = []; foreach ($conf->fields as $_jfield => $_jlabel) { if (!$_i++) { $_fieldType->alias = $this->getName() . $_sign . $_jfield; } $_fields[$this->getName() . $_sign . $_jfield] = ['type' => 'alias', 'fieldtype' => 'alias', 'datatype' => 'string', 'default' => '', 'label' => $_jlabel, 'group' => isset($conf->group) ? $conf->group : 'fields']; $_labels[$this->getName() . $_sign . $_jfield] = $_jlabel; $_joinfields[$this->getName() . $_sign . $_jfield] = $_jfield; if (isset($conf->group)) { $_fieldSets[$conf->group]['elements'][$this->getName() . $_sign . $_jfield] = $_jlabel; $_fieldType->group = $conf->group; } } $_joins[] = ['model' => $conf->model, 'on' => [$this->getName() . $_sign . 'id' => '_id'], 'fields' => $_joinfields, 'type' => 'lookup']; $_fieldType->source = $this->getName(); $_fieldType->default = isset($conf->default) ? $conf->default : ''; $_fields[$this->getName() . $_sign . 'id'] = $_fieldType->toArray(); $_labels[$this->getName() . $_sign . 'id'] = $_jlabel; // $this->getName() .= '_id'; $_fieldSets[$conf->group]['elements'][$this->getName() . $_sign . 'id'] = $_jlabel; $result = ['labels' => $_labels, 'fields' => $_fields, 'joins' => $_joins, 'fieldsets' => $_fieldSets]; return $result; }