Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHS-6009: Remove Visibility and Region fields from the Social Media footer block for Site Editors #1715

Open
wants to merge 2 commits into
base: 11.6.3-release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docroot/modules/humsci/hs_blocks/hs_blocks.module
Original file line number Diff line number Diff line change
Expand Up @@ -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().
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,6 @@ function su_humsci_profile_update_9721() {
\Drupal::service('module_installer')->uninstall([
'honeypot',
'hs_paragraphs_between',
'paragraphs_browser'
'paragraphs_browser',
]);
}
Loading