diff --git a/core/modules/update/src/Form/UpdateManagerUpdate.php b/core/modules/update/src/Form/UpdateManagerUpdate.php index f4d7cfb..1b6a1f1 100644 --- a/core/modules/update/src/Form/UpdateManagerUpdate.php +++ b/core/modules/update/src/Form/UpdateManagerUpdate.php @@ -11,6 +11,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Render\RendererInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -35,16 +36,26 @@ class UpdateManagerUpdate extends FormBase { protected $state; /** + * The rendering service. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + /** * Constructs a new UpdateManagerUpdate object. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. * @param \Drupal\Core\State\StateInterface $state * The state service. + * @param \Drupal\Core\Render\RendererInterface $renderer + * The rendering service. */ - public function __construct(ModuleHandlerInterface $module_handler, StateInterface $state) { + public function __construct(ModuleHandlerInterface $module_handler, StateInterface $state, RendererInterface $renderer) { $this->moduleHandler = $module_handler; $this->state = $state; + $this->renderer = $renderer; } /** @@ -60,7 +71,8 @@ public function getFormID() { public static function create(ContainerInterface $container) { return new static( $container->get('module_handler'), - $container->get('state') + $container->get('state'), + $container->get('renderer') ); } @@ -75,7 +87,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#last' => $this->state->get('update.last_check') ?: 0, ); $form['last_check'] = array( - '#markup' => drupal_render($last_markup), + '#markup' => $this->renderer->render($last_markup), ); if (!_update_manager_check_backends($form, 'update')) { diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index 0c7b0af..d6c7238 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -53,7 +53,7 @@ function update_manager_download_batch_finished($success, $results) { '#title' => t('Downloading updates failed:'), '#items' => $results['errors'], ); - drupal_set_message(drupal_render($item_list), 'error'); + drupal_set_message(\Drupal::service('renderer')->render($item_list), 'error'); } elseif ($success) { drupal_set_message(t('Updates downloaded successfully.'));