core/modules/media/src/Plugin/Filter/MediaEmbed.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/core/modules/media/src/Plugin/Filter/MediaEmbed.php b/core/modules/media/src/Plugin/Filter/MediaEmbed.php index ea1fe9d132..83e0a2126c 100644 --- a/core/modules/media/src/Plugin/Filter/MediaEmbed.php +++ b/core/modules/media/src/Plugin/Filter/MediaEmbed.php @@ -5,7 +5,6 @@ use Drupal\Component\Utility\Html; use Drupal\Core\Entity\EntityRepositoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Logger\RfcLogLevel; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Render\RenderContext; @@ -28,28 +27,28 @@ * * @internal */ -final class MediaEmbed extends FilterBase implements ContainerFactoryPluginInterface { +class MediaEmbed extends FilterBase implements ContainerFactoryPluginInterface { /** * The entity repository. * * @var \Drupal\Core\Entity\EntityRepositoryInterface */ - private $entityRepository; + protected $entityRepository; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - private $entityTypeManager; + protected $entityTypeManager; /** * The renderer. * * @var \Drupal\Core\Render\RendererInterface */ - private $renderer; + protected $renderer; /** * Constructs a MediaEmbed object. @@ -101,7 +100,7 @@ public static function create(ContainerInterface $container, array $configuratio * @return array * A render array. */ - private function renderMedia(MediaInterface $media, $view_mode, $langcode) { + protected function renderMedia(MediaInterface $media, $view_mode, $langcode) { $build = $this->entityTypeManager ->getViewBuilder('media') ->view($media, $view_mode, $langcode); @@ -129,7 +128,7 @@ private function renderMedia(MediaInterface $media, $view_mode, $langcode) { * @return array * A render array. */ - private function renderMissingMedia() { + protected function renderMissingMedia() { return [ '#type' => 'html_tag', '#tag' => 'img', @@ -159,12 +158,12 @@ public function process($text, $langcode) { $media = $this->entityRepository->loadEntityByUuid('media', $uuid); assert($media === NULL || $media instanceof MediaInterface); if (!$media) { - \Drupal::logger('media')->log(RfcLogLevel::ERROR, 'The media item with UUID "@uuid" does not exist.', ['@uuid' => $uuid]); + \Drupal::logger('media')->error('The media item with UUID "@uuid" does not exist.', ['@uuid' => $uuid]); } $view_mode = $this->entityRepository->loadEntityByConfigTarget('entity_view_mode', "media.$view_mode_id"); if (!$view_mode) { - \Drupal::logger('media')->log(RfcLogLevel::ERROR, 'The view mode "@view-mode-id" does not exist.', ['@view-mode-id' => $view_mode_id]); + \Drupal::logger('media')->error('The view mode "@view-mode-id" does not exist.', ['@view-mode-id' => $view_mode_id]); } // @todo recursive embedding protection @@ -211,7 +210,7 @@ public function tips($long = FALSE) { * The accumulated result of filter processing, updated with the metadata * bubbled during rendering. */ - private function renderIntoDomNode(array $build, \DOMNode $node, FilterProcessResult &$result) { + protected function renderIntoDomNode(array $build, \DOMNode $node, FilterProcessResult &$result) { // We need to render the embedded entity: // - without replacing placeholders, so that the placeholders are // only replaced at the last possible moment. Hence we cannot use @@ -236,7 +235,7 @@ private function renderIntoDomNode(array $build, \DOMNode $node, FilterProcessRe * @param string $content * The text or HTML that will replace the contents of $node. */ - private static function replaceNodeContent(\DOMNode &$node, $content) { + protected static function replaceNodeContent(\DOMNode &$node, $content) { if (strlen($content)) { // Load the content into a new DOMDocument and retrieve the DOM nodes. $replacement_nodes = Html::load($content)->getElementsByTagName('body')