You are here

public function VarbaseQuickLinks::build in Varbase Total Control Dashboard 9.0.x

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. 8.5 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 63

Class

VarbaseQuickLinks
Provides a 'Varbase Quick Links'.

Namespace

Drupal\varbase_total_control\Plugin\Block

Code

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