/** * Render a dump for an object. * * @param Model $model * The object we want to analyse. * * @return string * The generated markup. */ public function analyseObject(Model $model) { $output = ''; $model->setType($model->getAdditional() . 'class')->addParameter('data', $model->getData())->addParameter('name', $model->getName())->setAdditional(get_class($model->getData()))->setDomid($this->generateDomIdFromObject($model->getData()))->initCallback('Analyse\\Objects'); // Output data from the class. $output .= $this->storage->render->renderExpandableChild($model); return $output; }
/** * Renders a simple editable child node. * * @param Model $model * The model, which hosts all the data we need. * * @return string * The generated markup from the template files. */ public function renderSingleEditableChild(Model $model) { $template = $this->getTemplateFileContent('singleEditableChild'); $element = $this->getTemplateFileContent('single' . $model->getType()); $element = str_replace('{name}', $model->getData(), $element); $element = str_replace('{value}', $model->getName(), $element); // For dropdown elements, we need to render the options. if ($model->getType() === 'Select') { $option = $this->getTemplateFileContent('single' . $model->getType() . 'Options'); // Here we store what the list of possible values. switch ($model->getData()) { case "destination": // Frontend or file. $valueList = array('frontend', 'file'); break; case "skin": // Get a list of all skin folders. $valueList = $this->getSkinList(); break; default: // true/false $valueList = array('true', 'false'); break; } // Paint it. $options = ''; foreach ($valueList as $value) { if ($value === $model->getName()) { // This one is selected. $selected = 'selected="selected"'; } else { $selected = ''; } $options .= str_replace(array('{text}', '{value}', '{selected}'), array($value, $value, $selected), $option); } // Now we replace the options in the output. $element = str_replace('{options}', $options, $element); } $template = str_replace('{name}', $model->getData(), $template); $template = str_replace('{source}', $model->getNormal(), $template); $template = str_replace('{normal}', $element, $template); $template = str_replace('{type}', 'editable', $template); $template = str_replace('{help}', $this->renderHelp($model->getHelpid()), $template); return $template; }