/** * Loads the macro with the name specified by the `macro` property. * * @param array|null $props * @param Component $parent */ protected function onCreate(array $props = null, Component $parent = null) { // inspect("Macro: ".get ($props, 'macro')); // $z = get_object_vars($this); // foreach ($z as &$v) // $v = is_object($v) ? 'ID='.Debug::objectId($v) : $v; // inspect ($z); $this->parent = $parent; $name = get($props, 'macro'); if (exists($name)) { try { $frag = $this->context->getMacrosService()->loadMacro($name, $path); $this->macroInstance = $frag->getFirstChild(); $this->props->setMacro($this->macroInstance); $this->setShadowDOM($this->macroInstance); } catch (FileIOException $e) { /** @noinspection PhpUndefinedVariableInspection */ self::throwUnknownComponent($this->context, $name, $parent, $filename); } } parent::onCreate($props, $parent); }