You are here

function template_preprocess_status_content_add_list in Heartbeat 8

Prepares variables for a custom entity type creation list templates.

Default template: status-content-add-list.html.twig.

Parameters

array $variables: An associative array containing:

  • content: An array of status-types.

See also

block_content_add_page()

File

modules/statusmessage/status.page.inc, line 48
Contains status.page.inc.

Code

function template_preprocess_status_content_add_list(&$variables) {
  $variables['types'] = array();
  $query = \Drupal::request()->query
    ->all();
  foreach ($variables['content'] as $type) {
    $variables['types'][$type
      ->id()] = array(
      'link' => Link::fromTextAndUrl($type
        ->label(), new Url('entity.status.add_form', array(
        'status_type' => $type
          ->id(),
      ), array(
        'query' => $query,
      ))),
      'description' => array(
        '#markup' => $type
          ->label(),
      ),
      'title' => $type
        ->label(),
      'localized_options' => array(
        'query' => $query,
      ),
    );
  }
}