Commit f05491c0 authored by Thomas Nilsson's avatar Thomas Nilsson
Browse files

Issue #3257955 by beatrizrodrigues, sl27257: Error: Call to a member function...

Issue #3257955 by beatrizrodrigues, sl27257: Error: Call to a member function isSyncing() on null in flag_lists_actions_flagging_collection_presave() (line 71 of modules/contrib/flag_lists/modules/flag_lists_actions/flag_lists_actions.module)
parent 9a6dac6c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\flag_lists\Entity\FlaggingCollection;
use Drupal\flag_lists_actions\Controller\FlagListsActionsController;

/**
@@ -64,9 +65,12 @@ function flag_lists_actions_entity_type_build(array &$entity_types) {
}

/**
 * Implements hook_ENTITY_presave().
 * Prepare for saving the Action.
 *
 * @param \Drupal\flag_lists\Entity\FlaggingCollection $entity
 *   The entity to create an Action for.
 */
function flag_lists_actions_flagging_collection_presave(EntityInterface $entity) {
function flag_lists_actions_prepare(FlaggingCollection $entity) {
  $flag = $entity->getRelatedFlag();
  if ($flag->isSyncing()) {
    // Do not create actions when config is progress of synchronization.
+3 −0
Original line number Diff line number Diff line
@@ -184,6 +184,9 @@ class FlaggingCollection extends RevisionableContentEntityBase implements Flaggi
    if (!empty($myCollection)) {
      // If we have defered saving of our own copy, save it.
      $storage->save($myCollection);
      if (\Drupal::moduleHandler()->moduleExists('flag_lists_actions')) {
        flag_lists_actions_prepare($myCollection);
      }
    }
  }