Created your own finder but not visible.

Created on 9 November 2023, 11 months ago
Updated 21 November 2023, 10 months ago

Problem/Motivation

I have created your own group finder plugin.
where it will be visible?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Fixed

Version

2.0

Component

User interface

Created by

🇮🇳India shashank5563 New Delhi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @shashank5563
  • 🇧🇪Belgium msnassar

    @shashank5563 the group_finder module is an api module. it doesn't provide a UI. The finder plugins are being called by GroupFinderContext and modules/custom code that are using it...

  • 🇮🇳India shashank5563 New Delhi
    <?php
    
    declare(strict_types = 1);
    
    namespace Drupal\mymodule\Plugin\GroupFinder;
    
    use Drupal\Core\Routing\RouteMatchInterface;
    use Drupal\group\Entity\GroupInterface;
    use Drupal\group_finder\GroupFinderBase;
    use Symfony\Component\DependencyInjection\ContainerInterface;
    use Symfony\Component\HttpFoundation\RequestStack;
    
    /**
     * Plugin finds group from media library opener.
     *
     * @GroupFinder(
     *   id = "group_content",
     *   label = @Translation("Media library opener"),
     *   description = @Translation("When in context of media library opener."),
     *   weight = 40,
     * )
     */
    class GroupContent extends GroupFinderBase {
    
      /**
       * The group entity.
       *
       * @var \Drupal\group\Entity\GroupInterface
       */
      protected $group;
    
      /**
       * The request stack.
       *
       * @var \Symfony\Component\HttpFoundation\RequestStack
       */
      protected $requestStack;
    
      /**
       * GroupContent constructor.
       *
       * @param array $configuration
       *   Plugin configuration.
       * @param string $plugin_id
       *   Plugin id.
       * @param mixed $plugin_definition
       *   Plugin definition.
       * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
       *   The current route match.
       * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
       *   The request stack used to retrieve the current request.
       */
      public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match, RequestStack $request_stack) {
        parent::__construct($configuration, $plugin_id, $plugin_definition, $route_match);
        $this->requestStack = $request_stack;
      }
    
      /**
       * {@inheritdoc}
       */
      public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): self {
        return new static(
          $configuration,
          $plugin_id,
          $plugin_definition,
          $container->get('current_route_match'),
          $container->get('request_stack'),
        );
      }
    
      /**
       * {@inheritdoc}
       */
      public function isApplicable(): bool {
    
        die('ddd');
        return FALSE;
      }
    
      /**
       * {@inheritdoc}
       */
      public function getGroup(): ?GroupInterface {
        return $this->group ?? NULL;
      }
    
    }
    
  • 🇮🇳India shashank5563 New Delhi

    I want to pass parent group id if group have parent. I want plugin with group content menu block like this screenshot.

  • 🇧🇪Belgium msnassar

    @shashank5563 The group finder context will return the first applied plugin. It depends on the weight of the plugins. The higher the weight, the later the founder is being called...
    If changing the weight is not working for you, you could create your own context, then the context will be available in the "Select a group value".

  • 🇮🇳India shashank5563 New Delhi

    @msnassar, Thank you for your support.

  • Status changed to Fixed 10 months ago
Production build 0.71.5 2024