You are here

public function VarbaseQuickLinks::build in Varbase Total Control Dashboard 8.5

Same name and namespace in other branches
  1. 8.6 src/Plugin/Block/VarbaseQuickLinks.php \Drupal\varbase_total_control\Plugin\Block\VarbaseQuickLinks::build()
  2. 8 src/Plugin/Block/VarbaseQuickLinks.php \Drupal\varbase_total_control\Plugin\Block\VarbaseQuickLinks::build()
  3. 9.0.x src/Plugin/Block/VarbaseQuickLinks.php \Drupal\varbase_total_control\Plugin\Block\VarbaseQuickLinks::build()

Builds and returns the renderable array for this block plugin.

If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).

Return value

array A renderable array representing the content of the block.

Overrides BlockPluginInterface::build

See also

\Drupal\block\BlockViewBuilder

File

src/Plugin/Block/VarbaseQuickLinks.php, line 22

Class

VarbaseQuickLinks
Provides a 'Varbase Quick Links'.

Namespace

Drupal\varbase_total_control\Plugin\Block

Code

public function build() {
  $links = [];
  $links[] = \Drupal::l($this
    ->t('Manage menus'), new Url('entity.menu.collection'));
  $links[] = \Drupal::l($this
    ->t('Manage taxonomy'), new Url('entity.taxonomy_vocabulary.collection'));
  $links[] = \Drupal::l($this
    ->t('Manage users'), new Url('entity.user.collection'));
  $body_data = [
    '#theme' => 'item_list',
    '#list_type' => 'ul',
    '#items' => $links,
  ];
  return [
    '#type' => 'markup',
    '#markup' => drupal_render($body_data),
  ];
}