Get the headline for the template.

@param TranslatorInterface $translator The translator.
@param ModelInterface      $model      The model.

@return string
558348
protected function getHeadline(TranslatorInterface $translator, $model)
    {
        $headline = $translator->translate(
            'MSC.showRecord',
            $model->getProviderName(),
            ['ID ' . $model->getId()]
        );

        if ('MSC.showRecord' !== $headline) {
            return $headline;
        }

        return $translator->translate(
            'MSC.showRecord',
            null,
            ['ID ' . $model->getId()]
        );
    }
281620
public function setTranslator(TranslatorInterface $translator)
    {
        $args = \func_get_args();
        if (isset($args[1]) && $args[1]) {
            @trigger_error(
                'The '.__METHOD__.' method is deprecated since version 3.9 and will be removed in 4.0.',
                E_USER_DEPRECATED
            );
        }

        $this->translator = $translator;
    }
1036982
private function swiftEventFilter(TranslatorInterface $translator, $event): string
    {
        switch ($event) {
            case \Swift_Events_SendEvent::RESULT_SUCCESS:
                return $translator->trans('RESULT_SUCCESS');
            case \Swift_Events_SendEvent::RESULT_FAILED:
                return $translator->trans('RESULT_FAILED');
            case \Swift_Events_SendEvent::RESULT_SPOOLED:
                return $translator->trans('RESULT_SPOOLED');
            case \Swift_Events_SendEvent::RESULT_PENDING:
                return $translator->trans('RESULT_PENDING');
            case \Swift_Events_SendEvent::RESULT_TENTATIVE:
                return $translator->trans('RESULT_TENTATIVE');
            case -1:
                return $translator->trans('RESULT_DELETED');
        }

        return '';
    }
8083
public static function getLogTitle($id, $model)
    {
        $key                = 'USERCONFIG_' . strtoupper($model->type) . '_PROVIDER';
        $provider           = last($model->related_data['provider']);
        $html               = app('html');
        $params             = [];
        $params['owner_id'] = $html->link(handles('antares::foundation/settings/security'), array_get($provider, 'name'));
        $params['user']     = $html->link(handles('antares::foundation/users/' . $model->user->id), '#' . $model->user->id . ' ' . $model->user->fullname);

        return trans('antares/two_factor_auth::operations.' . $key, $params);
    }
990992
public function labelPlural($translated = true)
    {
        if ($translated && $key = $this->getAttribute('translated_name_plural')) {
            if (($label = cms_trans($key)) !== $key) {
                return $label;
            }
        }

        return $this->getAttribute('verbose_name_plural');
    }
502070
private function getPageTitle(ArticleInterface $document)
    {
        $pageTitleProperty = $this->getPageTitleProperty($document);
        if (!$pageTitleProperty) {
            return;
        }

        $stagedData = $document->getStructure()->getStagedData();
        if (array_key_exists($pageTitleProperty->getName(), $stagedData)) {
            return $stagedData[$pageTitleProperty->getName()];
        }

        if (!$document->getStructure()->hasProperty($pageTitleProperty->getName())) {
            return;
        }

        return $document->getStructure()->getProperty($pageTitleProperty->getName())->getValue();
    }
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);
    }
1251511
public static function get(Model $model)
    {
        return Mention::where('model_type', get_class($model))
            ->where('model_id', $model->getKey())
            ->get();
    }
879222
public function render(\Erebot\Intl\TranslatorInterface $translator)
    {
        $locale = $translator->getLocale();
        $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
        $currency = ($this->currency !== null)
                    ? $this->currency
                    : $formatter->getSymbol(\NumberFormatter::INTL_CURRENCY_SYMBOL);
        return (string) $formatter->formatCurrency($this->value, $currency);
    }
1323081
public function outputIconTitle($model, $title = null) {
        if ($model instanceof Model) {
            $model = $model->admin;
        }

        if (!$title && isset($model['title'])) {
            $title = $model['title'];
        }

        if ($model['iconClass']) {
            $title = $this->Html->tag('span', '&nbsp;', array(
                'class' => 'model-icon fa ' . str_replace('icon-', 'fa-', $model['iconClass']) // FontAwesome 4.0 fix
            )) . ' ' . $title;
        }

        return $title;
    }
862743
public function getTextMessageBody(ParserInterface $parser)
    {
        $message = $this->getMessageBody(
            $parser,
            $this->getTextMessage(),
            $this->getTextLayoutFileName(),
            $this->getTextTemplateFileName(),
            true // Do not compress the output, and keep empty lines.
        );

        // Replaced all <br> by newlines.
        return preg_replace("/<br>/i", "\n", $message);
    }
802591
public function parseTemplateText($viewText, &$model) {

        $twigLoader = new \Twig_Loader_Array(array("template" => $viewText));

        $twig = new \Twig_Environment($twigLoader);

        $newModel = SerialisableArrayUtils::convertSerialisableObjectsToAssociativeArrays($model);

        return $twig->render("template", $newModel);

    }
1260284
public function getAvailableRenderMode(RenderableInterface $object)
    {
        $templatePath = $this->getTemplatePath($object);
        $templates = $this->getTemplatesByPattern($templatePath.'.*');
        foreach ($templates as &$template) {
            $template = basename(str_replace($templatePath.'.', '', $template));
        }

        unset($template);

        return $templates;
    }
776412
private function getPageTitleProperty(ArticleInterface $document)
    {
        $metadata = $this->structureMetadataFactory->getStructureMetadata(
            'article',
            $document->getStructureType()
        );

        if ($metadata->hasPropertyWithTagName(self::PAGE_TITLE_TAG_NAME)) {
            return $metadata->getPropertyByTagName(self::PAGE_TITLE_TAG_NAME);
        }

        if ($metadata->hasProperty(self::PAGE_TITLE_PROPERTY_NAME)) {
            return $metadata->getProperty(self::PAGE_TITLE_PROPERTY_NAME);
        }

        return null;
    }
315999
public static function getModelName( $model, $bean = null ) {
		if (isset(self::$modelCache[$model])) return self::$modelCache[$model];
		if (self::$modelFormatter){
			$modelID = self::$modelFormatter->formatModel($model,$bean);
		}
		else {
			$modelID = 'Model_'.ucfirst($model);
		}
		self::$modelCache[$model] = $modelID;
		return self::$modelCache[$model];
	}
401181
public static function renderOption($option, TranslatorInterface $translator = null) {

        if (null === $option) {
            return null !== $translator ? $translator->trans("label.empty_selection") : "Empty selection";
        }

        // Check the implementation.
        if (true === ($option instanceof TranslatedChoiceLabelInterface)) {
            $output = $option->getTranslatedChoiceLabel($translator);
        } else if (true === ($option instanceof ChoiceLabelInterface)) {
            $output = $option->getChoiceLabel();
        } else {
            $output = "This option must implements [Translated]ChoiceLabelInterface";
        }

        if (true === ($option instanceof AlphabeticalTreeNodeInterface)) {
            $multiplier = AlphabeticalTreeNodeHelper::getLevel($option);
            $nbsp       = html_entity_decode("&nbsp;");
            $symbol     = html_entity_decode(0 === $multiplier ? "&#9472;" : "&#9492;");
            $output     = implode("", [str_repeat($nbsp, $multiplier * 3), $symbol, $nbsp, $output]);
        }

        return $output;
    }
239151
private function makeTemplate($transformer, $model, $template)
    {
        $template = !empty($template) ? "-{$template}" : "";
        $file = __DIR__ . "/../templates/transformer/transformer{$template}.php.dist";

        if (file_exists($file))
        {
            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{transformer}}' => $transformer,
                '{{model}}' => $model,
                '{{model_small}}' => strtolower($model),
            ]);

            if (!file_exists(app_path("Transformers")))
            {
                mkdir(app_path("Transformers"), 0755, true);
            }

            $file_path = app_path("Transformers/{$transformer}.php");

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);
        }

        return false;
    }