@param ModelConfigurationInterface $model
@param Renderable|RedirectResponse|string $content
@param string|null $title

@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|\Illuminate\Http\RedirectResponse
169994
public function render(ModelConfigurationInterface $model, $content, $title = null)
    {
        if ($content instanceof RedirectResponse) {
            return $content;
        }

        if ($content instanceof Renderable) {
            $content = $content->render();
        }

        if (is_null($title)) {
            $title = $model->getTitle();
        }

        return $this->admin->template()->view('_layout.inner')
            ->with('title', $title)
            ->with('content', $content)
            ->with('breadcrumbKey', $this->parentBreadcrumb);
    }
997232
private function generateToggleUrl(ModelInterface $model)
    {
        $toggleUrlEvent = new AddToUrlEvent(
            'ptg=' . $model->getId() . '&amp;provider=' . $model->getProviderName()
        );
        $this->getEnvironment()->getEventDispatcher()->dispatch(ContaoEvents::BACKEND_ADD_TO_URL, $toggleUrlEvent);

        return System::getContainer()->get('router')->generate(
            'cca_dc_general_tree_toggle',
            $this->getQueryParameterFromUrl($toggleUrlEvent->getUrl()),
            UrlGenerator::ABSOLUTE_URL
        );
    }
885707
public static function setTitle(Component $model)
    {
        $title = $model->{self::behavior($model)->titleAttribute};
        if ($title)
            Yii::$app->view->title = $title;
    }
216231
protected function resolveTransformer(Model $model, $transformer = null)
    {
        $transformer = $transformer ?: $this->resolveTransformerFromModel($model);

        if (is_string($transformer)) {
            $transformer = new $transformer;
        }

        return $this->parseTransformer($transformer, $model);
    }
383727
protected function view($viewOrModel = null, $model = null, $layout = null) {
        return new ViewResult($viewOrModel, $model, $layout);
    }
842378
public function renderSelf($layout = null, $title = null)
    {
        // Verify Existence of Layout Section + Layout:
        
        if (!$this->hasEnabledChild(LayoutSection::class)) {
            return $this->renderNotFound($layout, $title, LayoutSection::singleton()->i18n_singular_name());
        } elseif (!$this->getChild(LayoutSection::class)->hasPageLayout()) {
            return $this->renderNotFound($layout, $title, Layout::singleton()->i18n_singular_name());
        }
        
        // Verify Existence of Page Component:
        
        if (!$this->hasEnabledDescendant(PageComponent::class)) {
            return $this->renderNotFound($layout, $title, PageComponent::singleton()->i18n_singular_name());
        }
        
        // Render Template Sections:
        
        return $this->renderChildren($layout, $title);
    }
1082877
public function update( $model, $config = [] ) {

		$model = parent::update( $model, $config );

		$content = isset( $config[ 'content' ] ) ? $config[ 'content' ] : null;

		if( isset( $content ) ) {

			$config[ 'publish' ] = true;

			$this->modelContentService->update( $content, $config );
		}

		return $model;
	}
1263624
public function makeRedirect($context = null, $model = null)
    {
        $redirectUrl = null;
        if (post('close') && !ends_with($context, '-close')) {
            $context .= '-close';
        }

        if (post('refresh', false)) {
            return Redirect::refresh();
        }

        if (post('redirect', true)) {
            $redirectUrl = $this->getRedirectUrl($context);
        }

        if ($model && $redirectUrl) {
            $redirectUrl = RouterHelper::replaceParameters($model, $redirectUrl);
        }

        if (starts_with($redirectUrl, 'http://') || starts_with($redirectUrl, 'https://')) {
            // Process absolute redirects
            $redirect = Redirect::to($redirectUrl);
        } else {
            // Process relative redirects
            $redirect = $redirectUrl ? Backend::redirect($redirectUrl) : null;
        }

        return $redirect;
    }
1131115
public function renderSelf($layout = null, $title = null)
    {
        return $this->renderTag($this->renderContainer($layout, $title));
    }
1090644
public function hydrate(Model $model, \Tapestry\Entities\ContentType $contentType)
    {
        $model->setName($contentType->getName());
        $model->setPath($contentType->getPath());
        $model->setTemplate($contentType->getTemplate());
        $model->setPermalink($contentType->getPermalink());
        $model->setEnabled($contentType->isEnabled());
    }
792123
public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id)
    {
        if (! $model->isRestorableModel()) {
            abort(404);
        }

        $item = $model->getRepository()->findOnlyTrashed($id);

        if (is_null($item) || ! $model->isRestorable($item)) {
            abort(404);
        }

        $model->fireDestroy($id);

        if ($model->fireEvent('destroying', true, $item, $request) === false) {
            return redirect()->back();
        }

        $model->getRepository()->forceDelete($id);

        $model->fireEvent('destroyed', false, $item, $request);

        return redirect($request->input('_redirectBack', back()->getTargetUrl()))
            ->with('success_message', $model->getMessageOnDestroy());
    }
1128585
public function includeTemplate($name = null, $module = null, $model = null)
    {
        $name = Kwc_Abstract::getTemplateFile($this->view->data->componentClass, $name);
        if (!$module) { $module = $this->view; }
        return $this->partial($name, $module, $model);
    }
808453
public function setPopover($title, $content)
    {
        $this->attributes->addAttribute('data-toggle', 'popover');
        $this->attributes->addAttribute('title', $title);
        $this->attributes->addAttribute('data-content', $content);

        return $this;
    }
403436
public function prepare(ContentInterface $content, ThemeInterface $theme, $templateTypeName = null)
    {
        $this->contextStack->push(
            $this->contextBuilder
                ->setContent($content)
                ->setTheme($theme)
                ->setTemplateTypeName($templateTypeName)
            ->createContext()
        );

        return $this;
    }
990130
public function resolve(ThemeInterface $theme, Content $content, Variation $variation, $templateName)
    {
        $templateTypes = $theme->getTemplateTypes();

        switch (true) {

            // given template name
            case $templateName :
                if (!$templateType = $templateTypes
                    ->search(array('name' => $templateName))
                    ->first()
                ) {
                    throw new InvalidTemplateException(sprintf(
                        'No template named "%s" registered under "%s" theme. Please check your configuration.',
                        $templateName,
                        $theme->getName()
                    ));
                }
            break;

            // default template type
            case $templateType = $templateTypes
                ->filter(function (TemplateType $templateType) use ($variation) {
                    return (bool) $variation->getConfiguration(
                        'templates',
                        $templateType->getName(),
                        'default'
                    );
                })
                ->first()
            :
            break;

            // first template type
            default:
                $templateType = $templateTypes->first();
        }
        if (empty($templateType)) {
            throw new InvalidTemplateException(sprintf(
                'No valid template type found under "%s" theme for "%s" content type. Please check your configuration.',
                $theme->getName(),
                $content->getType()->getName()
            ));
        }

        if (!$template = $this->templateLoader->retrieveDisplayable(
                $templateType,
                $content
            )
        ) {
            throw new InvalidTemplateException(sprintf(
                'Any "%s" template found under "%s" theme for "%s#%d" content.',
                $templateType->getName(),
                $theme->getName(),
                $content->getType()->getName(),
                $content->getContentId()
            ));
        }

        return $template->setContent($content);
    }
1041316
public function render(Model $model, $source)
    {
        if (null === $this->resolveModelSource($model, $source)) {
            return '';
        }

        return parent::render($model, $source);
    }
283899
public function renderAction(ComponentInterface $component, array $config, ContentInterface $content)
    {
        //
        // Data validation
        //
        if (!$component->getData('text')) {
            $this->container->get('logger')->warning(
                'Incomplete text component, "text" field has to be fullfilled.',
                array(
                    'component_id' => $component->getId(),
                    'content_class' => get_class($content),
                    'content_id' => $content->getId()
                )
            );

            return new Response('');
        }

        $templateParameters = array(
            'config' => $config,
            'content' => $content,
        );

        //
        // Medias
        //
        $templateParameters['images'] = (new EntityCollection((array) $component->getData('images')))
            ->map(function ($imageId) {
                return $this->get('synapse.image.loader')->retrieve($imageId);
            })
            ->filter(function ($image) {
                return (bool) $image;
            })
            ->map(function (ImageInterface $image) use ($config) {
                return $image->setDefaultFormat(
                    empty($config['images']['format']) ? null : $config['images']['format']
                );
            })
        ;
        if (!$config['images']['multiple']) {
            $templateParameters['image'] = $templateParameters['images']->first();
        }

        //
        // Resolution
        //
        return $this->get('synapse')
            ->createDecorator($component)
            ->decorate($templateParameters)
        ;
    }