Skip to content
Snippets Groups Projects
Commit 89e0836d authored by Tim Plunkett's avatar Tim Plunkett
Browse files

Move message setting from helper method to main entry point

parent 92c91a09
No related branches found
No related tags found
No related merge requests found
......@@ -54,13 +54,6 @@ class BrowserController extends ControllerBase {
*/
protected $cacheBin;
/**
* The messenger.
*
* @var \Drupal\Core\Messenger\MessengerInterface
*/
protected $messenger;
/**
* Build the project browser controller.
*
......@@ -107,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' => [
......@@ -181,11 +181,6 @@ class BrowserController extends ControllerBase {
protected function getDataFromPlugin($cache_key, $method): array {
$data = [];
$current_source = $this->enabledSource->getCurrentSource();
if ($current_source->getPluginId() === 'drupalorg_mockapi') {
$plugin_status = $current_source->getPluginDefinition()['status_message'];
$url = 'https://www.drupal.org/project/issues/project_browser';
$this->messenger->addStatus($plugin_status)->addMessage($this->t("Your feedback and input are welcome at <a href=$url>$url</a>"), 'status');
}
if ($current_source) {
$cache_key = "project_browser:$cache_key";
if ($values = $this->cacheBin->get($cache_key)) {
......
......@@ -27,7 +27,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* id = "drupalorg_mockapi",
* label = @Translation("Drupal.org (mocked)"),
* description = @Translation("Gets project and release information from a mock API"),
* status_message = @Translation("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='https://www.drupal.org/project/project_module'>https://www.drupal.org/project/project_module</a>"),
* )
*/
class MockDrupalDotOrg extends PluginBase implements ProjectBrowserSourceInterface, ContainerFactoryPluginInterface {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment