diff --git a/docroot/modules/humsci/hs_blocks/hs_blocks.module b/docroot/modules/humsci/hs_blocks/hs_blocks.module index 0f180fba85..b7e1951a38 100644 --- a/docroot/modules/humsci/hs_blocks/hs_blocks.module +++ b/docroot/modules/humsci/hs_blocks/hs_blocks.module @@ -111,6 +111,24 @@ function hs_blocks_form_layout_builder_add_block_alter(&$form, FormStateInterfac } } +/** + * Implements hook_form_FORM_ID_alter(). + */ +function hs_blocks_form_block_form_alter(&$form, FormStateInterface $form_state) { + $block_form = $form_state->getFormObject(); + /** @var Drupal\block\BlockForm $block_form */ + $block = $block_form->getEntity(); + // Hide visibility & region fields from non-developers on social media block. + if ($block instanceof Block && $block->getPluginId() == 'hs_blocks_social_media_block') { + /** @var Drupal\Entity\User $current_user */ + $current_user = \Drupal::currentUser(); + if (!$current_user->hasRole('administrator')) { + $form['visibility']['#access'] = FALSE; + $form['region']['#access'] = FALSE; + } + } +} + /** * Implements hook_preprocess_HOOK(). */ diff --git a/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.install b/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.install index 4ba4e57825..7d409cc127 100644 --- a/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.install +++ b/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.install @@ -1193,6 +1193,6 @@ function su_humsci_profile_update_9721() { \Drupal::service('module_installer')->uninstall([ 'honeypot', 'hs_paragraphs_between', - 'paragraphs_browser' + 'paragraphs_browser', ]); }