diff --git a/core/lib/Drupal/Core/Page/HtmlFragment.php b/core/lib/Drupal/Core/Page/HtmlFragment.php index 486327c..d783c44 100644 --- a/core/lib/Drupal/Core/Page/HtmlFragment.php +++ b/core/lib/Drupal/Core/Page/HtmlFragment.php @@ -157,24 +157,7 @@ public function getContent() { } /** - * Sets the title of this HtmlFragment. - * - * Handling of this title varies depending on what is consuming this - * HtmlFragment object. If it's a block, it may only be used as the block's - * title; if it's at the page level, it will be used in a number of places, - * including the html title. - * - * @param string $title - * Value to assign to the page title. - * @param int $output - * (optional) normally should be left as Title::CHECK_PLAIN. Only set to - * Title::PASS_THROUGH if you have already removed any possibly dangerous - * code from $title using a function like - * \Drupal\Component\Utility\String::checkPlain() or - * \Drupal\Component\Utility\Xss::filterAdmin(). With this flag the string - * will be passed through unchanged. - * - * @return $this + * {@inheritdoc} */ public function setTitle($title, $output = Title::CHECK_PLAIN) { if ($output == Title::CHECK_PLAIN) { diff --git a/core/lib/Drupal/Core/Page/HtmlFragmentInterface.php b/core/lib/Drupal/Core/Page/HtmlFragmentInterface.php index 7b5aba0..6e3ef04 100644 --- a/core/lib/Drupal/Core/Page/HtmlFragmentInterface.php +++ b/core/lib/Drupal/Core/Page/HtmlFragmentInterface.php @@ -6,6 +6,7 @@ */ namespace Drupal\Core\Page; +use Drupal\Core\Utility\Title; /** * A domain object for a portion of an HTML page, including related data. @@ -63,6 +64,26 @@ public function getFeedLinkElements(); */ public function getMetaElements(); - + /** + * Sets the title of this HtmlFragment. + * + * Handling of this title varies depending on what is consuming this + * HtmlFragment object. If it's a block, it may only be used as the block's + * title; if it's at the page level, it will be used in a number of places, + * including the html title. + * + * @param string $title + * Value to assign to the page title. + * @param int $output + * (optional) normally should be left as Title::CHECK_PLAIN. Only set to + * Title::PASS_THROUGH if you have already removed any possibly dangerous + * code from $title using a function like + * \Drupal\Component\Utility\String::checkPlain() or + * \Drupal\Component\Utility\Xss::filterAdmin(). With this flag the string + * will be passed through unchanged. + * + * @return $this + */ + public function setTitle($title, $output = Title::CHECK_PLAIN); } diff --git a/core/modules/contact/src/Controller/ContactController.php b/core/modules/contact/src/Controller/ContactController.php index 7be24d5..34d37f2 100644 --- a/core/modules/contact/src/Controller/ContactController.php +++ b/core/modules/contact/src/Controller/ContactController.php @@ -107,7 +107,7 @@ public function contactSitePage(HtmlFragmentInterface $fragment, ContactFormInte )); $form = $this->entityFormBuilder()->getForm($message); - $fragment->setTitle($contact_form->label())); + $fragment->setTitle($contact_form->label()); return $form; }