You are here

public function ModifiersController::modifiers in Persistent URL 8

1 string reference to 'ModifiersController::modifiers'
purl.routing.yml in ./purl.routing.yml
purl.routing.yml

File

src/Controller/ModifiersController.php, line 49

Class

ModifiersController

Namespace

Drupal\purl\Controller

Code

public function modifiers(Request $request) {
  $build = array();
  $headers = array(
    'provider',
    'method',
    'modifier',
    'value',
  );
  $headers = array_map(function ($header) {
    return array(
      'data' => t($header),
    );
  }, $headers);
  $rows = array();
  foreach ($this->modifierIndex
    ->findModifiers() as $modifier) {
    $provider = $this->providerManager
      ->getDefinition($modifier['provider']);
    $method = $this->methodManager
      ->getDefinition($provider['method']);
    $row = array();
    $row[] = array(
      'data' => $provider['name'],
    );
    $row[] = array(
      'data' => $method['name'],
    );
    $row[] = array(
      'data' => array(
        '#type' => 'html_tag',
        '#tag' => 'code',
        '#value' => $modifier['modifier'],
      ),
    );
    $row[] = array(
      'data' => array(
        '#type' => 'html_tag',
        '#tag' => 'code',
        '#value' => $this
          ->stringify($modifier['value']),
      ),
    );
    $rows[] = $row;
  }
  $build['modifiers'] = array(
    '#theme' => 'table',
    '#header' => $headers,
    '#rows' => $rows,
  );
  return $build;
}