public function createComponent() { $box = new SelectBox(); $labeler = new \Psc\CMS\Labeler(); $labeler->label('v1', 'label1'); $labeler->label('v2', 'label2'); $box->dpi($this->values, $labeler); return $box; }
/** * @return Psc\CMS\EntityPropertyMeta */ public function getPropertyMeta($name, Labeler $labeler = NULL) { if (!array_key_exists($name, $this->properties)) { if (!isset($labeler)) { $labeler = new \Psc\CMS\Labeler(); } try { $type = $this->getSetMeta()->getFieldType($name); // schmeiss exception wenns das property nicht gibt } catch (\Psc\Data\FieldNotDefinedException $e) { throw \Psc\Doctrine\FieldNotDefinedException::entityField($this->getClass(), $name); } $this->properties[$name] = $meta = new EntityPropertyMeta($name, $type, $labeler->getLabel($name)); if ($this->classMetadata->isIdentifier($name) && $this->getClassMetadata()->usesIdGenerator()) { $meta->setAutogeneratedValue(TRUE); } } elseif (isset($labeler)) { // update $this->properties[$name]->setLabel($labeler->getLabel($name)); } return $this->properties[$name]; }
public function label($property, $label) { $this->labeler->addLabelMapping($property, $label); return $this; }