public function ActivityOverviewBlock::build in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.2 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.3 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.4 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.5 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.6 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.7 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 8.8 modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 10.3.x modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 10.0.x modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 10.1.x modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::build()
- 10.2.x modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php \Drupal\social_landing_page\Plugin\Block\ActivityOverviewBlock::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
- modules/
social_features/ social_landing_page/ src/ Plugin/ Block/ ActivityOverviewBlock.php, line 55
Class
- ActivityOverviewBlock
- Provides a 'ActivityOverviewBlock' block.
Namespace
Drupal\social_landing_page\Plugin\BlockCode
public function build() {
return [
[
'#type' => 'container',
'#attributes' => [
'class' => [
'activity-overview',
],
],
'event_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'event-info',
],
],
'event' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-event"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getEventsCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('events'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
'topic_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'topic-info',
],
],
'topic' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-topic"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getTopicsCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('topics'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
'group_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'group-info',
],
],
'group' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-group"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getGroupsCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('groups'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
'user_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'user-info',
],
],
'group' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-account_circle"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getUsersCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('users'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
'post_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'post-info',
],
],
'post' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-edit"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getPostsCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('posts'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
'comment_info' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'comment-info',
],
],
'comment' => [
'icon' => [
'#markup' => '<svg class="teaser__content-type-icon"><use xlink:href="#icon-comment"></use></svg>',
'#allowed_tags' => [
'use',
'svg',
],
],
'content' => [
'#type' => 'container',
'#attributes' => [
'class' => [
'info-wrapper',
],
],
'value' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->getCommentsCount(),
'#attributes' => [
'class' => [
'value',
],
],
],
'name' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $this
->t('comments'),
'#attributes' => [
'class' => [
'name',
],
],
],
],
],
],
],
'#cache' => [
'contexts' => [
'user',
],
],
'#attached' => [
'library' => [
'social_landing_page/activity_overview',
],
],
];
}