diff --git a/src/Plugin/Block/PublicationAuthorsBlock.php b/src/Plugin/Block/ReferenceAuthorsBlock.php similarity index 82% rename from src/Plugin/Block/PublicationAuthorsBlock.php rename to src/Plugin/Block/ReferenceAuthorsBlock.php index 8b45267b2f31855c422e248e344ddaefa2920800..b0ed3dd81e77e1bd34ba46676cb5f1de91e8b73f 100644 --- a/src/Plugin/Block/PublicationAuthorsBlock.php +++ b/src/Plugin/Block/ReferenceAuthorsBlock.php @@ -5,35 +5,34 @@ namespace Drupal\uw_dashboard\Plugin\Block; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\BlockBase; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Provides a 'Publication reference authors' block. + * Provides a 'References authors' block. * * @Block( * id = "uw_publication_authors_block", - * admin_label = @Translation("Publication reference authors"), + * admin_label = @Translation("Reference authors"), * ) */ -class PublicationAuthorsBlock extends BlockBase implements ContainerFactoryPluginInterface { +class ReferenceAuthorsBlock extends BlockBase implements ContainerFactoryPluginInterface { /** * Entity type manager from the core. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** * The current user. * * @var \Drupal\Core\Session\AccountProxyInterface */ - protected $currentUser; + protected AccountProxyInterface $currentUser; /** * {@inheritdoc} @@ -42,7 +41,7 @@ class PublicationAuthorsBlock extends BlockBase implements ContainerFactoryPlugi ContainerInterface $container, array $configuration, $plugin_id, - $plugin_definition + $plugin_definition, ) { return new static( $configuration, @@ -72,7 +71,7 @@ class PublicationAuthorsBlock extends BlockBase implements ContainerFactoryPlugi $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, - AccountProxyInterface $currentUser + AccountProxyInterface $currentUser, ) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->entityTypeManager = $entityTypeManager; @@ -124,24 +123,6 @@ class PublicationAuthorsBlock extends BlockBase implements ContainerFactoryPlugi ]; } - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - - // Get the parent form. - $form = parent::blockForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - - } - /** * {@inheritdoc} */ diff --git a/src/Plugin/Block/PublicationKeywordsBlock.php b/src/Plugin/Block/ReferenceKeywordsBlock.php similarity index 79% rename from src/Plugin/Block/PublicationKeywordsBlock.php rename to src/Plugin/Block/ReferenceKeywordsBlock.php index 45febb2fadf7a46a20ec0464d6a5a9f09ad336f7..351c93260df485c9f25780cd913423f885f044f5 100644 --- a/src/Plugin/Block/PublicationKeywordsBlock.php +++ b/src/Plugin/Block/ReferenceKeywordsBlock.php @@ -5,35 +5,34 @@ namespace Drupal\uw_dashboard\Plugin\Block; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\BlockBase; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Provides a 'Publication reference keywords' block. + * Provides a 'Reference keywords' block. * * @Block( * id = "uw_publication_keywords_block", - * admin_label = @Translation("Publication reference keywords"), + * admin_label = @Translation("Reference keywords"), * ) */ -class PublicationKeywordsBlock extends BlockBase implements ContainerFactoryPluginInterface { +class ReferenceKeywordsBlock extends BlockBase implements ContainerFactoryPluginInterface { /** * Entity type manager from the core. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** * The current user. * * @var \Drupal\Core\Session\AccountProxyInterface */ - protected $currentUser; + protected AccountProxyInterface $currentUser; /** * {@inheritdoc} @@ -42,7 +41,7 @@ class PublicationKeywordsBlock extends BlockBase implements ContainerFactoryPlug ContainerInterface $container, array $configuration, $plugin_id, - $plugin_definition + $plugin_definition, ) { return new static( $configuration, @@ -72,7 +71,7 @@ class PublicationKeywordsBlock extends BlockBase implements ContainerFactoryPlug $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, - AccountProxyInterface $currentUser + AccountProxyInterface $currentUser, ) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->entityTypeManager = $entityTypeManager; @@ -85,7 +84,7 @@ class PublicationKeywordsBlock extends BlockBase implements ContainerFactoryPlug public function build() { // Add a message if the user does not have access to the block. - if (!$this->currentUser->hasPermission('edit bibcite_contributor')) { + if (!$this->currentUser->hasPermission('edit bibcite_keyword')) { return [ '#markup' => 'You do not have permission to view this block.', ]; @@ -124,29 +123,11 @@ class PublicationKeywordsBlock extends BlockBase implements ContainerFactoryPlug ]; } - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - - // Get the parent form. - $form = parent::blockForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - - } - /** * {@inheritdoc} */ protected function blockAccess(AccountInterface $account) { - return AccessResult::allowedIfHasPermission($account, 'edit bibcite_contributor'); + return AccessResult::allowedIfHasPermission($account, 'edit bibcite_keyword'); } } diff --git a/src/Plugin/Block/PublicationReferenceBlock.php b/src/Plugin/Block/ReferencesBlock.php similarity index 82% rename from src/Plugin/Block/PublicationReferenceBlock.php rename to src/Plugin/Block/ReferencesBlock.php index 9b579cc4bf5f157bfd3318075807bf335d12c537..a5b85da90b8e35c1405e5326ea10d610114c0637 100644 --- a/src/Plugin/Block/PublicationReferenceBlock.php +++ b/src/Plugin/Block/ReferencesBlock.php @@ -5,35 +5,34 @@ namespace Drupal\uw_dashboard\Plugin\Block; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\BlockBase; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountProxyInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Provides a 'Publication reference' block. + * Provides a 'References' block. * * @Block( * id = "uw_publication_reference_block", - * admin_label = @Translation("Publication references"), + * admin_label = @Translation("References"), * ) */ -class PublicationReferenceBlock extends BlockBase implements ContainerFactoryPluginInterface { +class ReferencesBlock extends BlockBase implements ContainerFactoryPluginInterface { /** * Entity type manager from the core. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ - protected $entityTypeManager; + protected EntityTypeManagerInterface $entityTypeManager; /** * The current user. * * @var \Drupal\Core\Session\AccountProxyInterface */ - protected $currentUser; + protected AccountProxyInterface $currentUser; /** * {@inheritdoc} @@ -42,7 +41,7 @@ class PublicationReferenceBlock extends BlockBase implements ContainerFactoryPlu ContainerInterface $container, array $configuration, $plugin_id, - $plugin_definition + $plugin_definition, ) { return new static( $configuration, @@ -72,7 +71,7 @@ class PublicationReferenceBlock extends BlockBase implements ContainerFactoryPlu $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, - AccountProxyInterface $currentUser + AccountProxyInterface $currentUser, ) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->entityTypeManager = $entityTypeManager; @@ -124,24 +123,6 @@ class PublicationReferenceBlock extends BlockBase implements ContainerFactoryPlu ]; } - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - - // Get the parent form. - $form = parent::blockForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - - } - /** * {@inheritdoc} */