You are here

public function HelpMessageHelper::getMessage in Acquia Lift Connector 8

Same name and namespace in other branches
  1. 8.4 src/Service/Helper/HelpMessageHelper.php \Drupal\acquia_lift\Service\Helper\HelpMessageHelper::getMessage()
  2. 8.3 src/Service/Helper/HelpMessageHelper.php \Drupal\acquia_lift\Service\Helper\HelpMessageHelper::getMessage()

Get help message (by route name).

Parameters

string $route_name: Route name.

Return value

string The help message.

File

src/Service/Helper/HelpMessageHelper.php, line 51
Contains \Drupal\acquia_lift\Service\Helper\HelpMessageHelper.

Class

HelpMessageHelper

Namespace

Drupal\acquia_lift\Service\Helper

Code

public function getMessage($route_name) {
  switch ($route_name) {
    case 'help.page.acquia_lift':
    case 'acquia_lift.admin_settings_form':
      $link_attributes = [
        'attributes' => [
          'target' => '_blank',
        ],
      ];

      // Generate Documentation link.
      $documentation_link_text = t('Documentation');
      $documentation_link_url = Url::fromUri('https://docs.acquia.com/lift/', $link_attributes);
      $documentation_external_link = $this->linkGenerator
        ->generate($documentation_link_text, $documentation_link_url);
      $help_message = t('You can find more info in ') . $documentation_external_link;

      // Generate Acquia Lift Web Admin link.
      if (!empty($this->credentialSettings['api_url'])) {
        $lift_web_link_text = t('Acquia Lift Web Admin');
        $lift_web_link_url = Url::fromUri('https://' . $this->credentialSettings['api_url'], $link_attributes);
        $lift_web_external_link = $this->linkGenerator
          ->generate($lift_web_link_text, $lift_web_link_url);
        $help_message .= t(', and control your web services settings at ') . $lift_web_external_link;
      }
      $help_message .= t('.');
      return $help_message;
  }
  return;
}