diff --git a/modules/rh_node/rh_node.module b/modules/rh_node/rh_node.module index 3957d0c..36010f2 100644 --- a/modules/rh_node/rh_node.module +++ b/modules/rh_node/rh_node.module @@ -1,6 +1,13 @@ id() == 'node') { return \Drupal::service('rabbit_hole.entity_extender') ->getRabbitHoleFields('node'); diff --git a/modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php b/modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php index e65edb8..f20d273 100644 --- a/modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php +++ b/modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php @@ -1,10 +1,5 @@ user = $this->drupalCreateUser(array( 'bypass node access', 'administer content types', - 'rabbit hole administer node' + 'rabbit hole administer node', )); $this->behaviorSettingsManager = $this->container diff --git a/modules/rh_node/src/Tests/InvocationTest.php b/modules/rh_node/src/Tests/InvocationTest.php index 2b6d271..f5c22a7 100644 --- a/modules/rh_node/src/Tests/InvocationTest.php +++ b/modules/rh_node/src/Tests/InvocationTest.php @@ -1,8 +1,4 @@ id() == 'taxonomy_term') { return \Drupal::service('rabbit_hole.entity_extender') ->getRabbitHoleFields('taxonomy_term'); diff --git a/modules/rh_taxonomy/src/Plugin/RabbitHoleEntityPlugin/Taxonomy.php b/modules/rh_taxonomy/src/Plugin/RabbitHoleEntityPlugin/Taxonomy.php index 7e4550f..412edce 100644 --- a/modules/rh_taxonomy/src/Plugin/RabbitHoleEntityPlugin/Taxonomy.php +++ b/modules/rh_taxonomy/src/Plugin/RabbitHoleEntityPlugin/Taxonomy.php @@ -1,10 +1,5 @@ id() == 'user') { return \Drupal::service('rabbit_hole.entity_extender') ->getRabbitHoleFields('user'); diff --git a/modules/rh_user/src/Plugin/RabbitHoleEntityPlugin/User.php b/modules/rh_user/src/Plugin/RabbitHoleEntityPlugin/User.php index 86bbf23..4f96e32 100644 --- a/modules/rh_user/src/Plugin/RabbitHoleEntityPlugin/User.php +++ b/modules/rh_user/src/Plugin/RabbitHoleEntityPlugin/User.php @@ -1,10 +1,5 @@ handleFormSubmit($form, $form_state); } @@ -45,7 +49,7 @@ function _rabbit_hole_general_form_submit($form, $form_state) { /** * Implements hook_form_alter(). */ -function rabbit_hole_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { +function rabbit_hole_form_alter(&$form, FormStateInterface $form_state, $form_id) { $affected_types = \Drupal::service('plugin.manager.rabbit_hole_entity_plugin') ->loadSupportedEntityTypes(); $affected_bundle_types = \Drupal::service('plugin.manager.rabbit_hole_entity_plugin') @@ -54,9 +58,6 @@ function rabbit_hole_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $fo ->loadSupportedGlobalForms(); if (method_exists($form_state->getFormObject(), 'getEntity')) { $current_type = $form_state->getFormObject()->getEntity()->getEntityTypeId(); - $real_type = method_exists($form_state->getFormObject()->getEntity(), - 'getBundleOf') ? $form_state->getFormObject()->getEntity()->getBundleOf() - : $current_type; $administer_permitted = \Drupal::currentUser() ->hasPermission('rabbit hole administer ' . $current_type); if (in_array($current_type, $affected_types) && $administer_permitted) { @@ -68,7 +69,7 @@ function rabbit_hole_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $fo array('_rabbit_hole_general_form_submit')) ); } - else if (in_array($current_type, $affected_bundle_types)) { + elseif (in_array($current_type, $affected_bundle_types)) { \Drupal::service('rabbit_hole.form_mangler')->addRabbitHoleOptionsToEntityForm( $form, $form_state->getFormObject()->getEntity()); $form_state->setSubmitHandlers( @@ -77,7 +78,7 @@ function rabbit_hole_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $fo ); } } - else if (array_key_exists($form_id, $affected_global_forms)) { + elseif (array_key_exists($form_id, $affected_global_forms)) { \Drupal::service('rabbit_hole.form_mangler')->addRabbitHoleOptionsToGlobalForm( $form, $affected_global_forms[$form_id] ); diff --git a/src/Annotation/RabbitHoleBehaviorPlugin.php b/src/Annotation/RabbitHoleBehaviorPlugin.php index f7fcde8..f5ed5fd 100644 --- a/src/Annotation/RabbitHoleBehaviorPlugin.php +++ b/src/Annotation/RabbitHoleBehaviorPlugin.php @@ -1,10 +1,5 @@ isNew() ? $actual : NULL; } - /** * Generate a full ID based on entity type label, bundle label and entity id. * diff --git a/src/BehaviorSettingsManagerInterface.php b/src/BehaviorSettingsManagerInterface.php index 696b04e..3a23db9 100644 --- a/src/BehaviorSettingsManagerInterface.php +++ b/src/BehaviorSettingsManagerInterface.php @@ -1,10 +1,5 @@ setting(); diff --git a/src/Exception/InvalidRedirectResponseException.php b/src/Exception/InvalidRedirectResponseException.php index 845a6d4..c2dadd3 100644 --- a/src/Exception/InvalidRedirectResponseException.php +++ b/src/Exception/InvalidRedirectResponseException.php @@ -1,18 +1,16 @@ getStorage($def['entityType']) ->getEntityType(); $permissions += array( - 'rabbit hole administer ' . $def['entityType'] => array( - 'title' => $this->t( + 'rabbit hole administer ' . $def['entityType'] => array( + 'title' => $this->t( 'Administer Rabbit Hole settings for %entity_type', array('%entity_type' => $entity_type->getLabel())), - ), - 'rabbit hole bypass ' . $def['entityType'] => array( - 'title' => $this->t( + ), + 'rabbit hole bypass ' . $def['entityType'] => array( + 'title' => $this->t( 'Bypass Rabbit Hole action for %entity_type', array('%entity_type' => $entity_type->getLabel())), - ) + ), ); } return $permissions; } -} \ No newline at end of file + +} diff --git a/src/Tests/RabbitHoleBehaviorPluginTest.php b/src/Tests/RabbitHoleBehaviorPluginTest.php index 13c3ab3..cb95ebd 100644 --- a/src/Tests/RabbitHoleBehaviorPluginTest.php +++ b/src/Tests/RabbitHoleBehaviorPluginTest.php @@ -1,8 +1,4 @@