/** * {@inheritDoc} */ public function renderExpandableChild(Model $model, $isExpanded = false) { // Check for emergency break. if (!$this->storage->emergencyHandler->checkEmergencyBreak()) { return ''; } // We need to render this one normally. $template = $this->getTemplateFileContent('expandableChildNormal'); // Replace our stuff in the partial. $template = str_replace('{name}', $model->getName(), $template); $template = str_replace('{type}', $model->getType(), $template); // Explode the type to get the class names right. $types = explode(' ', $model->getType()); $cssType = ''; foreach ($types as $singleType) { $cssType .= ' k' . $singleType; } $template = str_replace('{ktype}', $cssType, $template); $template = str_replace('{additional}', $model->getAdditional(), $template); $template = str_replace('{connector2}', $this->renderConnector($model->getConnector2()), $template); // Generating our code and adding the Codegen button, if there is // something to generate. $gencode = $this->storage->codegenHandler->generateSource($model); $template = str_replace('{gensource}', $gencode, $template); if ($gencode == ';stop;' || empty($gencode)) { // Remove the button marker, because here is nothing to add. $template = str_replace('{sourcebutton}', '', $template); } else { // Add the button. $template = str_replace('{sourcebutton}', $this->getTemplateFileContent('sourcebutton'), $template); } // Is it expanded? // This is done in the js. $template = str_replace('{isExpanded}', '', $template); $json = $model->getJson(); $json['Help'] = $this->storage->messages->getHelp($model->getHelpid()); $json = json_encode($json); $template = str_replace('{addjson}', $json, $template); return str_replace('{nest}', $this->storage->chunks->chunkMe($this->renderNest($model, false)), $template); }
/** * 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; }