diff --git a/plugin_type_example/src/Annotation/Sandwich.php b/plugin_type_example/src/Annotation/Sandwich.php index ed1626c..1b8f5a9 100644 --- a/plugin_type_example/src/Annotation/Sandwich.php +++ b/plugin_type_example/src/Annotation/Sandwich.php @@ -19,6 +19,9 @@ use Drupal\Component\Annotation\Plugin; * @see \Drupal\plugin_type_example\SandwichPluginManager * @see plugin_api * + * Note that the "@ Annotation" line below is required and should be the last + * line in the docblock. It's used for discovery of Annotation definitions. + * * @Annotation */ class Sandwich extends Plugin { diff --git a/plugin_type_example/src/Controller/PluginTypeExampleController.php b/plugin_type_example/src/Controller/PluginTypeExampleController.php index e2e8ee9..4463596 100644 --- a/plugin_type_example/src/Controller/PluginTypeExampleController.php +++ b/plugin_type_example/src/Controller/PluginTypeExampleController.php @@ -63,9 +63,9 @@ class PluginTypeExampleController extends ControllerBase { // are defined in the annotation at the top of the plugin class: see // \Drupal\plugin_type_example\Plugin\Sandwich\ExampleHamSandwich. $items[] = t("@id (calories: @calories, description: @description )", array( - '@id' => $sandwich_plugin_definition['id'], + '@id' => $sandwich_plugin_definition['id'], '@calories' => $sandwich_plugin_definition['calories'], - '@description' => $sandwich_plugin_definition['description'], + '@description' => $sandwich_plugin_definition['description'], )); } diff --git a/plugin_type_example/src/SandwichInterface.php b/plugin_type_example/src/SandwichInterface.php index 39a54a6..210f3d9 100644 --- a/plugin_type_example/src/SandwichInterface.php +++ b/plugin_type_example/src/SandwichInterface.php @@ -6,7 +6,7 @@ * * When defining a new plugin type you need to define an interface that all * plugins of the new type will implement. This ensures that consumers of the - * plugin type of a consistent way of accessing the plugins functionality. It + * plugin type have a consistent way of accessing the plugin's functionality. It * should include access to any public properties, and methods for accomplishing * whatever business logic anyone accessing the plugin might want to use. * diff --git a/plugin_type_example/src/SandwichPluginManager.php b/plugin_type_example/src/SandwichPluginManager.php index f137b43..e77fce5 100644 --- a/plugin_type_example/src/SandwichPluginManager.php +++ b/plugin_type_example/src/SandwichPluginManager.php @@ -37,7 +37,9 @@ class SandwichPluginManager extends DefaultPluginManager { public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { // We replace the $subdir parameter with our own value. // This tells the plugin manager to look for Sandwich plugins in the - // 'src/Plugin/Sandwich' subdirectory of any enabled modules. + // 'src/Plugin/Sandwich' subdirectory of any enabled modules. This also + // serves to define the PSR-4 subnamespace in which sandwich plugins will + // live. Example: Drupal\{module_name}\Plugin\Sandwich\MySandwichPlugin; $subdir = 'Plugin/Sandwich'; // The name of the interface that plugins should adhere to. Drupal will