function prop($key) { if (!$this->props) { return null; } $v = $this->props->getComputed($key); if ($v && $v instanceof RenderableInterface) { return $v->getRendering(); } return $v; }
/** * Initializes a newly created component with the given properties, if any. * * > **Warning:** for some components this method will not be called (ex: Text). * * @param array|null $props A map of the component instance's properties being applied. * @throws ComponentException */ function setProps(array $props = null) { if ($this->supportsProperties()) { if ($props) { $this->props->apply($props); } } else { if ($props) { throw new ComponentException($this, 'This component does not support properties.'); } } }
function __construct(Component $ownerComponent) { parent::__construct($ownerComponent); $this->metadata = Reflection::instance()->of(get_class($this)); $this->metadata->init($this); }