Commit 45b11fbc authored by Harumi Jang's avatar Harumi Jang 🤠 Committed by Tim Plunkett
Browse files

Issue #3282732 by hooroomoo, chrisfromredfin, tim.plunkett, thejimbirch,...

Issue #3282732 by hooroomoo, chrisfromredfin, tim.plunkett, thejimbirch, drumm, leslieg, bnjmnm: Add UI text indicating that the current data may be stale or incomplete
parent c91276c4
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\project_browser\EnabledSourceHandler;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Drupal\Core\Messenger\MessengerInterface;

/**
 * Defines a controller to provide the Project Browser UI.
@@ -64,13 +65,16 @@ class BrowserController extends ControllerBase {
   *   The request stack.
   * @param \Drupal\project_browser\EnabledSourceHandler $enabled_source
   *   The enabled source.
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger.
   */
  public function __construct(ModuleHandlerInterface $module_handler, ModuleExtensionList $module_list, RequestStack $request_stack, EnabledSourceHandler $enabled_source) {
  public function __construct(ModuleHandlerInterface $module_handler, ModuleExtensionList $module_list, RequestStack $request_stack, EnabledSourceHandler $enabled_source, MessengerInterface $messenger) {
    $this->moduleHandler = $module_handler;
    $this->moduleList = $module_list;
    $this->requestStack = $request_stack;
    $this->enabledSource = $enabled_source;
    $this->cacheBin = $this->cache('project_browser');
    $this->messenger = $messenger;
  }

  /**
@@ -82,6 +86,7 @@ class BrowserController extends ControllerBase {
      $container->get('extension.list.module'),
      $container->get('request_stack'),
      $container->get('project_browser.enabled_source'),
      $container->get('messenger'),
    );
  }

@@ -95,6 +100,13 @@ class BrowserController extends ControllerBase {
    $modules_status = $this->getModuleStatuses();
    $request = $this->requestStack->getCurrentRequest();

    $current_source = $this->enabledSource->getCurrentSource();
    if ($current_source && $current_source->getPluginId() === 'drupalorg_mockapi') {
      $this->messenger
        ->addStatus($this->t('Project Browser is currently a prototype, and the projects listed may not be up to date with Drupal.org. For the most updated list of projects, please visit <a href=":url">:url</a>', [':url' => 'https://www.drupal.org/project/project_module']))
        ->addStatus($this->t('Your feedback and input are welcome at <a href=":url">:url</a>', [':url' => 'https://www.drupal.org/project/issues/project_browser']));
    }

    return [
      '#markup' => '<div id="project-browser"></div>',
      '#attached' => [