You are here

public function ExtensionsCount::getAction in Site Audit 8.3

.

Overrides SiteAuditCheckBase::getAction

File

src/Plugin/SiteAuditCheck/ExtensionsCount.php, line 50

Class

ExtensionsCount
Provides the ExtensionsCount Check.

Namespace

Drupal\site_audit\Plugin\SiteAuditCheck

Code

public function getAction() {
  if ($this->score != SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS) {
    $ret_val = $this
      ->t('Consider the following options:') . PHP_EOL;
    $options = [];
    $options[] = $this
      ->t('Disable unneeded or unnecessary extensions.');
    $options[] = $this
      ->t('Consolidate functionality if possible, or custom develop a solution specific to your needs.');
    $options[] = $this
      ->t('Avoid using modules that serve only one small purpose that is not mission critical.');

    // If ($this->options['html']) {.
    if (TRUE) {
      $ret_val .= '<ul>';
      foreach ($options as $option) {
        $ret_val .= '<li>' . $option . '</li>';
      }
      $ret_val .= '</ul>';
    }
    else {
      foreach ($options as $option) {
        if (!$this->options['json']) {
          $ret_val .= str_repeat(' ', 6);
        }
        $ret_val .= '- ' . $option . PHP_EOL;
      }
      if (!$this->options['json']) {
        $ret_val .= str_repeat(' ', 6);
      }
    }
    $ret_val .= $this
      ->t('A lightweight site is a fast and happy site!');
    return $ret_val;
  }
}