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

Issue #3259130 by sl27257: Views support

parent f05491c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,6 @@ class FlaggingCollection extends RevisionableContentEntityBase implements Flaggi
      // Do it by loading a copy of it.
      // Defer the saving until after the flag is saved.
      $myCollection = $storage->load($this->getEntityKey('id'));
      $myCollection->setRelatedFlag($template['id']);
    }
    else {
      // The Flagging Collection exist so reuse the old id.
@@ -182,6 +181,7 @@ class FlaggingCollection extends RevisionableContentEntityBase implements Flaggi
    $flag = new flag($template, 'flag');
    $flag->save();
    if (!empty($myCollection)) {
      $myCollection->setRelatedFlag($flag);
      // If we have defered saving of our own copy, save it.
      $storage->save($myCollection);
      if (\Drupal::moduleHandler()->moduleExists('flag_lists_actions')) {
+8 −8
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ class FlaggingCollectionBulkForm extends BulkForm {
      $plugin_definition,
      $entity_type_manager,
      $language_manager,
      $messenger
      $messenger,
      $entity_repository
    );
    $this->entityManager = $entity_type_manager;
    $this->actionStorage = $entity_type_manager
@@ -189,10 +190,8 @@ class FlaggingCollectionBulkForm extends BulkForm {

        // Create a new flaglist with name $newlist.
        // No cleaning of input?
        $id = strtolower($user_input['newlist']);
        $id = preg_replace("/[^a-z0-9_]/", "_", $id);
        $template = [
          'id' => $id,
          'id' => 'tmp_id',
          'name' => $user_input['newlist'],
          'type' => $user_input['type'],
        ];
@@ -201,8 +200,11 @@ class FlaggingCollectionBulkForm extends BulkForm {
          ->getStorage('flagging_collection')
          ->create($template);
        $flaggingCollection->setBaseFlag($user_input['template']);
        $flaggingCollection->setRelatedFlag($baseFlag);
        $flaggingCollection->save();
        // Reload the newly saved Flagging Collection
        $flaggingCollection = $flaggingCollection
          ->load($flaggingCollection->id());

        $flag = $flaggingCollection
          ->getRelatedFlag();
        $flagList = $flaggingCollection->id();
@@ -221,12 +223,10 @@ class FlaggingCollectionBulkForm extends BulkForm {
      foreach ($selected as $bulk_form_key) {
        $entity = $this
          ->loadEntityFromBulkFormKey($bulk_form_key);

        // Skip execution if current entity does not exist.
        if (empty($entity)) {
          continue;
        }

        if ($user_input['action'] == 'flag' &&
          !empty($this->flagListsService->getFlagListItemIds($flag->id(),
          $flagList,
@@ -338,7 +338,7 @@ class FlaggingCollectionBulkForm extends BulkForm {
    if ($user_input['flaglist'] <> 0) {
      // This is an existing flag.
      $flagEntityType = $this->flagListsService
        ->getFlaggingCollectionById($user_input['flaglists'])
        ->getFlaggingCollectionById($user_input['flaglist'])
        ->getRelatedFlag()
        ->get('entity_type');
    }