public function decorateInputs($crossReferenceTable, $crossReferenceField, $sortField, $parentField, $filters = []) { foreach ($this->meta->getMetaFields($crossReferenceTable, $crossReferenceField, $sortField, $parentField, $filters) as $key => $field) { /* @var $field Ajde_Crud_Options_Fields_Field */ $this->addField($key, $field->values()); } }
public function prepareCrudSave(Ajde_Controller $controller, Ajde_Crud $crud) { $meta = new Ajde_Crud_Cms_Meta(); $options = []; foreach ($meta->getFieldNames() as $fieldName) { if ($this->has($fieldName)) { $options[$fieldName] = $this->get($fieldName); } } $this->set('options', json_encode($options)); }
public function saveMetaValue($metaId, $value) { if (!is_numeric($metaId)) { $metaId = $this->lookupMetaName($metaId); } $this->deleteMetaValue($metaId); // Get meta stuff $meta = new MetaModel(); $meta->loadByPK($metaId); $metaType = Ajde_Crud_Cms_Meta::fromType($meta->getType()); // Before save $value = $metaType->beforeSave($meta, $value, $this); // Insert new ones $sql = 'INSERT INTO ' . $this->getMetaTable() . ' (' . $this->getTable() . ', meta, VALUE) VALUES (?, ?, ?)'; $statement = $this->getConnection()->prepare($sql); $statement->execute([$this->getPK(), $metaId, $value]); // After save $metaType->afterSave($meta, $value, $this); $this->_metaValues[$metaId] = $value; }