Remove Views contextual filter UI elements from Block Configuration
Closed this issue · 1 comments
mrkmiller commented
Add config settings to the sitefarm_core.settings.php file for the context keys that should be hidden on blocks created by views.
// Remove Views contextual filter UI elements from Block Configuration
if ($form_id == 'block_form' && !empty($form['settings']['context_mapping'])) {
$context_keys = [
'nid',
'nid_1',
'tid',
'field_sf_gallery_category_target_id',
];
foreach ($context_keys as $key) {
if (array_key_exists($key, $form['settings']['context_mapping'])) {
$form['settings']['context_mapping'][$key]['#access'] = FALSE;
}
}
}