You are here

protected function SocialAlbumCountAndAddBlock::getProperties in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php \Drupal\social_album\Plugin\Block\SocialAlbumCountAndAddBlock::getProperties()
  2. 10.0.x modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php \Drupal\social_album\Plugin\Block\SocialAlbumCountAndAddBlock::getProperties()
  3. 10.2.x modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php \Drupal\social_album\Plugin\Block\SocialAlbumCountAndAddBlock::getProperties()

Returns block properties for the current route.

Return value

array|null The renderable data if block is allowed for the current route otherwise NULL.

4 calls to SocialAlbumCountAndAddBlock::getProperties()
SocialAlbumCountAndAddBlock::blockAccess in modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php
Indicates whether the block should be shown.
SocialAlbumCountAndAddBlock::build in modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php
Builds and returns the renderable array for this block plugin.
SocialAlbumCountAndAddBlock::getCacheContexts in modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php
SocialAlbumCountAndAddBlock::getCacheTags in modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php

File

modules/social_features/social_album/src/Plugin/Block/SocialAlbumCountAndAddBlock.php, line 158

Class

SocialAlbumCountAndAddBlock
Provides a block to display images count and a button for adding new images.

Namespace

Drupal\social_album\Plugin\Block

Code

protected function getProperties() {
  $items = [
    'entity.node.canonical' => [
      'type' => 'node',
      'display' => 'embed_album_overview',
      'count' => [
        'singular' => '@count image',
        'plural' => '@count images',
      ],
      'link' => [
        'text' => $this
          ->t('Add images'),
        'route' => [
          'name' => 'social_album.post',
          'parameters' => [
            'node' => $this->routeMatch
              ->getRawParameter('node'),
          ],
        ],
      ],
    ],
    'view.albums.page_albums_overview' => [
      'type' => 'user',
      'display' => 'page_albums_overview',
      'link' => [
        'text' => $this
          ->t('Create new album'),
        'route' => [
          'name' => 'node.add',
          'parameters' => [
            'node_type' => 'album',
          ],
        ],
      ],
    ] + self::ITEM,
    'view.albums.page_group_albums_overview' => [
      'type' => 'group',
      'display' => 'page_group_albums_overview',
      'link' => [
        'text' => $this
          ->t('Create new album'),
        'route' => [
          'name' => 'social_album.add',
          'parameters' => [
            'group' => $this->routeMatch
              ->getRawParameter('group'),
          ],
        ],
      ],
    ] + self::ITEM,
  ];
  return $items[$this->routeMatch
    ->getRouteName()] ?? NULL;
}