class SampleExampleController

Simple controller class used to test the DescriptionTemplateTrait.

Hierarchy

Expanded class hierarchy of SampleExampleController

1 file declares its use of SampleExampleController
DescriptionTraitTest.php in tests/src/Kernel/DescriptionTraitTest.php

File

tests/modules/examples_description_test/src/Controller/SampleExampleController.php, line 11

Namespace

Drupal\examples_description_test\Controller
View source
class SampleExampleController extends ControllerBase {
  use DescriptionTemplateTrait;
  
  /**
   * {@inheritdoc}
   */
  protected function getModuleName() {
    return 'examples_description_test';
  }
  
  /**
   * {@inheritdoc}
   *
   * We override this so we can see some substitutions.
   */
  protected function getDescriptionVariables() {
    $variables = [
      'module' => $this->getModuleName(),
      'slogan' => $this->t('We aim to please'),
    ];
    return $variables;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DescriptionTemplateTrait::description public function Generate a render array with our templated content.
DescriptionTemplateTrait::getDescriptionTemplatePath protected function Get full path to the template.
SampleExampleController::getDescriptionVariables protected function We override this so we can see some substitutions. Overrides DescriptionTemplateTrait::getDescriptionVariables
SampleExampleController::getModuleName protected function Name of our module. Overrides DescriptionTemplateTrait::getModuleName