private function getControlsFromInclude($node, &$controls, $handleChildren = false) { if ($node) { if ($this->ignoreElement($node)) { return NULL; } $attributes = $node->attributes(); if ($attributes['file']) { $fileName = $attributes['file']; $file = $this->path . '/' . $this->processValue($fileName); } elseif ($attributes['component']) { $fileName = $attributes['component']; $file = Manager::getAppPath('components/' . $fileName); } $extension = pathinfo($file, PATHINFO_EXTENSION); if ($extension == 'xml') { $xmlControls = new MXMLControls(); $xmlControls->loadFile($file, $this->context); foreach ($xmlControls->get() as $c) { $controls->addControl($c); } } elseif ($extension == 'html') { $control = new MBaseControl('mhtml'); $control->tag = 'div'; $template = new \Maestro\UI\MTemplate(dirname($file)); $template->multicontext(['page' => Manager::getPage(), 'data' => Manager::getData(), 'template' => $template, 'painter' => Manager::getPainter()]); $control->inner = $template->fetch($fileName); $controls->addControl($control); } elseif ($extension == 'php') { include_once $file; $fileName = end(explode('/', $fileName)) ?: $fileName; $className = str_replace('.' . $extension, '', $fileName); $c = new $className(); $this->getPropertiesFromNode($c, $node); if ($handleChildren) { $controls->addControl($c); } else { $controls[] = $c; } } } }