From 9fb4702ca8a4e331ceb612246488c1c82827efad Mon Sep 17 00:00:00 2001 From: dannylamb Date: Thu, 27 Sep 2018 13:21:00 -0300 Subject: [PATCH] Fixes core block placement: Issue 931 (#99) * Form altering out our custom Conditions, which don't play well with Core block placement * Diagnosing Travis * Coding standards * Reverting .travis.yml --- islandora.module | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/islandora.module b/islandora.module index c1d6b17c..3e06b0af 100644 --- a/islandora.module +++ b/islandora.module @@ -15,6 +15,7 @@ */ use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Form\FormStateInterface; use Drupal\node\NodeInterface; use Drupal\media\MediaInterface; use Drupal\file\FileInterface; @@ -322,3 +323,20 @@ function islandora_entity_form_display_alter(&$form_display, $context) { } } } + +/** + * Implements hook_form_form_id_alter(). + */ +function islandora_form_block_form_alter(&$form, FormStateInterface $form_state, $form_id) { + // Unset our custom conditions. There's too many to use well within + // the core block placement UI, and no other reasonable way to filter + // them out. See https://www.drupal.org/node/2284687. Use + // /admin/structure/context instead if you want to use these conditions + // to alter block layout. + unset($form['visibility']['content_entity_type']); + unset($form['visibility']['parent_node_has_term']); + unset($form['visibility']['media_has_term']); + unset($form['visibility']['file_uses_filesystem']); + unset($form['visibility']['node_has_term']); + unset($form['visibility']['media_uses_filesystem']); +}