Skip to content
Snippets Groups Projects

3340805: phpcs more fixes

Open Kunal Gautam requested to merge issue/modal_blocks-3340805:3340805-phpcs into 8.x-2.x
Files
4
@@ -3,9 +3,9 @@
namespace Drupal\modal_blocks\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\block\Entity\Block;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a 'ModalBlock' block.
@@ -17,6 +17,35 @@ use Drupal\block\Entity\Block;
*/
class ModalBlock extends BlockBase implements BlockPluginInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a Drupal\modal_blocks\Plugin\Block\ModalBlock.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager
* The entity manager.
*/
public function __construct(
array $configuration,
$plugin_id,
$plugin_definition,
EntityTypeManagerInterface $entity_manager,
) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_manager;
}
/**
* {@inheritdoc}
*/
@@ -107,20 +136,23 @@ class ModalBlock extends BlockBase implements BlockPluginInterface {
case 'hour':
$time = 1 * 60 * 60 * 1000;
break;
case 'day':
$time = 1 * 24 * 60 * 60 * 1000;
break;
case 'week':
$time = 7 * 24 * 60 * 60 * 1000;
break;
case 'month':
$time = 30 * 24 * 60 * 60 * 1000;
break;
}
if ($block_id) {
$block = Block::load($block_id);
$block_content = \Drupal::entityTypeManager()
$block = $this->entityTypeManager->getStorage('block')->load($block_id);
$block_content = $this->entityTypeManager
->getViewBuilder('block')
->view($block);
$modal_block[] = [
Loading