You are here

public function RequiredContext::renderContexts in Chaos Tool Suite (ctools) 8.3

Parameters

$cached_values:

Return value

array

1 call to RequiredContext::renderContexts()
RequiredContext::buildForm in src/Form/RequiredContext.php
Form constructor.

File

src/Form/RequiredContext.php, line 127

Class

RequiredContext

Namespace

Drupal\ctools\Form

Code

public function renderContexts($cached_values) {
  $configured_contexts = [];
  foreach ($this
    ->getContexts($cached_values) as $row => $context) {
    list($plugin_id, $label, $machine_name, $description) = array_values($context);
    list($route_name, $route_parameters) = $this
      ->getOperationsRouteInfo($cached_values, $cached_values['id'], $row);
    $build = [
      '#type' => 'operations',
      '#links' => $this
        ->getOperations($route_name, $route_parameters),
    ];
    $configured_contexts[] = [
      $this
        ->t('<strong>Label:</strong> @label<br /> <strong>Type:</strong> @type', [
        '@label' => $label,
        '@type' => $plugin_id,
      ]),
      $this
        ->t('@description', [
        '@description' => $description,
      ]),
      'operations' => [
        'data' => $build,
      ],
    ];
  }
  return $configured_contexts;
}