You are here

function seven_preprocess_block_content_add_list in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/themes/seven/seven.theme \seven_preprocess_block_content_add_list()

Implements hook_preprocess_HOOK() for block content add list templates.

Displays the list of available custom block types for creation, adding separate variables for the label and url.

File

core/themes/seven/seven.theme, line 75
Functions to support theming in the Seven theme.

Code

function seven_preprocess_block_content_add_list(&$variables) {
  if (!empty($variables['content'])) {
    foreach ($variables['content'] as $type) {
      $variables['types'][$type
        ->id()]['label'] = $type
        ->label();
      $options = array(
        'query' => \Drupal::request()->query
          ->all(),
      );
      $variables['types'][$type
        ->id()]['url'] = \Drupal::url('block_content.add_form', array(
        'block_content_type' => $type
          ->id(),
      ), $options);
    }
  }
}