You are here

public function StepsBlock::processModuleList in Opigno Learning path 3.x

Process module list.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

src/Plugin/Block/StepsBlock.php, line 132

Class

StepsBlock
Provides a 'article' block.

Namespace

Drupal\opigno_learning_path\Plugin\Block

Code

public function processModuleList($elements) {
  foreach ($elements["steps"] as &$step) {
    $link = $this
      ->getLinkToStart($step);
    $step = [
      // @todo seems it is a bad idea to generate a thme based on typology.
      '#theme' => sprintf('%s_%s', 'opigno_lp_step', strtolower($step["typology"])),
      'step' => $step,
      '#state' => $this
        ->getState($step),
      '#current' => $this
        ->isModuleCurrent($step),
      '#link' => FALSE,
      '#locked' => !$link,
      '#pre_render' => [
        [
          $this,
          'processActivityList',
        ],
      ],
    ];
  }
  return $elements;
}