Commit 0facae48 authored by git's avatar git Committed by Nick Dickinson-Wilde
Browse files

Issue #3140401 by Project Update Bot: Automated Drupal Rector fixes

parent a51fdae9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,4 +2,5 @@ name: 'Entity Redirect'
type: module
description: 'Redirect after entity creation or edit - per content or user.'
core: 8.x
core_version_requirement: ^8 || ^9
package: entity
 No newline at end of file
+3 −3
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ function entity_redirect_form_alter(&$form, FormStateInterface $form_state, $for

    $entity = $form_state->getFormObject()->getEntity();
    $bundle = $entity->bundle();
    $entity_type = entity_load($type, $bundle);
    $entity_type = \Drupal::service('entity_type.manager')->getStorage($type)->load($bundle);
    if (!$entity->isNew() && !$entity_type->getThirdPartySetting('entity_redirect', 'redirect_edit')) {
      return;
    }
@@ -162,7 +162,7 @@ function entity_redirect_submit($form, FormStateInterface $form_state) {

  $entity = $form_state->getFormObject()->getEntity();
  $bundle = $entity->bundle();
  $entity_type = entity_load($type, $bundle);
  $entity_type = \Drupal::service('entity_type.manager')->getStorage($type)->load($bundle);
  if ($entity_type->getThirdPartySetting('entity_redirect', 'personalizable')) {
    if ($user_id = \Drupal::currentUser()->id() && \Drupal::currentUser()->hasPermission('use personalized redirect options')) {
      $personalization = $entity_type->getThirdPartySetting('entity_redirect', 'personalization');
@@ -358,7 +358,7 @@ function entity_redirect_user_profile_form_submit($form, FormStateInterface $for
  $user_id = $form_state->getFormObject()->getEntity()->id();
  foreach ($form_state->getValue('entity_options') as $type => $bundles) {
    foreach ($bundles as $bundle => $data) {
      $bundle = entity_load($type, $bundle);
      $bundle = \Drupal::service('entity_type.manager')->getStorage($type)->load($bundle);
      $settings = $bundle->getThirdPartySetting('entity_redirect', 'personalization', []);
      $settings[$user_id] = [
        'destination' => $data['destination'],