/** * {@inheritDoc} */ public function parse($raw, $tag, $params = null, $cache = true) { if ($params === null) { return ''; } list($domain, $key) = explode(':', $params, 2); if ($key === null) { $key = $domain; $page = $this->getPage(); if ($page) { $domain = 'page_'; if ($page->alias) { $domain .= str_replace('/', '_', $page->alias); } else { $domain .= $page->id; } } else { $domain = 'website'; } } $result = $this->translator->translate($key, $domain); // Fallback to global website domain. if ($domain !== 'website' && $result === $key) { $result = $this->translator->translate($key, 'website'); } // Translator won't check if content is a string. if (is_array($result)) { return false; } return $this->replacer->replace($result, $cache); }
/** * Filter a value so it can be passed to the frontend. * * The idea behind this extra method is that we just have to change one place if anything else than the * insert tags has to be replaced. * * @param string $value The given value. * * @return string */ public function filter($value) { return $this->insertTagReplacer->replace($value); }