FollowTagBlock.php in Open Social 10.3.x
Same filename and directory in other branches
- 10.0.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/Plugin/Block/FollowTagBlock.php
- 10.1.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/Plugin/Block/FollowTagBlock.php
- 10.2.x modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/Plugin/Block/FollowTagBlock.php
Namespace
Drupal\social_follow_tag\Plugin\BlockFile
modules/social_features/social_follow_taxonomy/modules/social_follow_tag/src/Plugin/Block/FollowTagBlock.phpView source
<?php
namespace Drupal\social_follow_tag\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a 'FollowTagBlock' block.
*
* @Block(
* id = "follow_tag_block",
* admin_label = @Translation("Follow tag"),
* )
*/
class FollowTagBlock extends BlockBase implements ContainerFactoryPluginInterface {
/**
* The route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* SearchHeroBlock constructor.
*
* @param array $configuration
* The given configuration.
* @param string $plugin_id
* The plugin id.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch
* The route match.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $routeMatch) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->routeMatch = $routeMatch;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('current_route_match'));
}
/**
* {@inheritdoc}
*/
public function build() {
$build = [];
$build['content'] = [
'#lazy_builder' => [
'social_follow_tag.lazy_builder:lazyBuild',
[],
],
'#create_placeholder' => TRUE,
];
return $build;
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return 0;
}
}
Classes
Name | Description |
---|---|
FollowTagBlock | Provides a 'FollowTagBlock' block. |