Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Drupal 8 provides a new Plugin system that allows modules to define plugin types and (other) modules to expose implementations of certain plugin types. Various info hooks and their corresponding implementations need to be updated.

Aggregator
D7:
function hook_aggregator_fetch_info() {
  return array(
    'title' => t('Default fetcher'),
    'description' => t('Default fetcher for resources available by URL.'),
  );
}

function hook_aggregator_fetch($feed) {
  $feed->source_string = mymodule_fetch($feed->url);
}

There is no hook_aggregator_fetch_info() or hook_aggregator_fetch() in D8; see the Drupal\aggregator\Plugin\aggregator\fetcher\DefaultFetcher class and its annotations instead:


/**
 * @Plugin(
 *   id = "aggregator",
 *   title = @Translation("Default fetcher"),
 *   description = @Translation("Downloads data from a URL using Drupal's HTTP request handler.")
 * )
 */
class DefaultFetcher implements FetcherInterface {

When a plugin is so simple that it does not need anything other than an ID, it can use the Drupal\Component\Annotation\PluginID annotation instead.
For example, this is used by Views handlers, since they are not shown directly to the end user, and have no need for a label.


namespace Drupal\views\Plugin\views\sort;

/**
 * Provides a randomized sort.
 *
 * @PluginID("random")
 */
class Random extends SortPluginBase {
}

See DefaultPluginManager class added to simplify plugin managers on how to define a new plugin (manager).

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Not done