public function getViewForForm(Content $content = null) { $relation = $this; $relationKey = $this->getKey(); $relationType = $this->getType(); $relationDefault = $this->get('default'); $view = 'relationtypes/form/' . strtolower($relationType); $contentTypeKey = $content->getContentType()->getKey(); $otherKey = $relation->getOther()->getKey(); $id = $content->getId(); $name = $contentTypeKey . '[' . $id . '][links][' . $otherKey . '][]'; $id = $contentTypeKey . '-' . $id . '-' . $otherKey; $context = compact('relationType', 'relation', 'content', 'view', 'id', 'name'); return $this->app['view.factory']->create($view, $context); }
/** * Set the current project * * @param Bolt\Core\Config\Object\Content $project The new project */ public function setCurrentProject(Content $project) { $this->app['project'] = $project; $this->app['session']->set('project_id', $project->getId()); $this->app['session']->set('project_namespace', str_replace('.', '', $project->get('namespace'))); }