query->all(); foreach ($variables['content'] as $type) { $variables['types'][$type->id()] = [ 'link' => \Drupal::l($type->label(), new Url('block_content.add_form', ['block_content_type' => $type->id()], ['query' => $query])), 'description' => [ '#markup' => $type->getDescription(), ], 'title' => $type->label(), 'localized_options' => [ 'query' => $query, ], ]; } }