Task/Collect/PluginTypesCollector.php
protected function addPluginTypeServiceDataAnnotated(&$data, $service, $discovery) {
    $reflection = new \ReflectionClass($service);

    // Get the properties that the plugin manager constructor sets.
    // E.g., most plugin managers pass this to the parent:
    //   parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\Core\Block\BlockPluginInterface', 'Drupal\Core\Block\Annotation\Block');
    // See Drupal\Core\Plugin\DefaultPluginManager
    // The list of properties we want to grab out of the plugin manager
    //  => the key in the plugin type data array we want to set this into.
    $plugin_manager_properties = [
      'subdir' => 'subdir',
      'pluginInterface' => 'plugin_interface',
      'pluginDefinitionAnnotationName' => 'plugin_definition_annotation_name',
    ];
    foreach ($plugin_manager_properties as $property_name => $data_key) {
      if (!$reflection->hasProperty($property_name)) {
        // plugin.manager.menu.link is different.
        $data[$data_key] = '';
        continue;
      }

      $property = $reflection->getProperty($property_name);
      $property->setAccessible(TRUE);
      $data[$data_key] = $property->getValue($service);
    }
  }
protected function addPluginTypeServiceDataAnnotated(&$data, $service, $discovery) {
    $reflection = new \ReflectionClass($service);

    // Get the properties that the plugin manager constructor sets.
    // E.g., most plugin managers pass this to the parent:
    //   parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\Core\Block\BlockPluginInterface', 'Drupal\Core\Block\Annotation\Block');
    // See Drupal\Core\Plugin\DefaultPluginManager
    // The list of properties we want to grab out of the plugin manager
    //  => the key in the plugin type data array we want to set this into.
    $plugin_manager_properties = [
      'subdir' => 'subdir',
      'pluginInterface' => 'plugin_interface',
      'pluginDefinitionAnnotationName' => 'plugin_definition_annotation_name',
    ];
    foreach ($plugin_manager_properties as $property_name => $data_key) {
      if (!$reflection->hasProperty($property_name)) {
        // plugin.manager.menu.link is different.
        $data[$data_key] = '';
        continue;
      }

      $property = $reflection->getProperty($property_name);
      $property->setAccessible(TRUE);
      $data[$data_key] = $property->getValue($service);
    }
  }
protected function addPluginTypeServiceDataAnnotated ( & $ data , $ service , $ discovery ) { $ reflection = new \ ReflectionClass ( $ service ) ; // Get the properties that the plugin manager constructor sets. // E.g., most plugin managers pass this to the parent: //   parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\Core\Block\BlockPluginInterface', 'Drupal\Core\Block\Annotation\Block'); // See Drupal\Core\Plugin\DefaultPluginManager // The list of properties we want to grab out of the plugin manager //  => the key in the plugin type data array we want to set this into. $ plugin_manager_properties = [ 'subdir' => 'subdir' , 'pluginInterface' => 'plugin_interface' , 'pluginDefinitionAnnotationName' => 'plugin_definition_annotation_name' , ] ; foreach ( $ plugin_manager_properties as $ property_name => $ data_key ) { if ( ! $ reflection -> hasProperty ( $ property_name ) ) { // plugin.manager.menu.link is different. $ data [ $ data_key ] = '' ; continue ; } $ property = $ reflection -> getProperty ( $ property_name ) ; $ property -> setAccessible ( TRUE ) ; $ data [ $ data_key ] = $ property -> getValue ( $ service ) ; } }
Analyse the plugin type manager service for annotated plugins.

This adds:
- subdir
- plugin_interface
- plugin_definition_annotation_name

@param &$data
The data for a single plugin type.
@param $service
The plugin manager service.
@param $discovery
The plugin discovery object.
Analyse the plugin type manager service for annotated plugins .