Skip to content
Snippets Groups Projects
Commit a325159d authored by Jennifer Hodgdon's avatar Jennifer Hodgdon
Browse files

Issue #1969970 by dawehner, jhodgdon, webchick, EclipseGc, tim.plunkett:...

Issue #1969970 by dawehner, jhodgdon, webchick, EclipseGc, tim.plunkett: Documentation for translatable plugin properties on annotations
parent 891f4c5d
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -9,6 +9,28 @@
use Drupal\Component\Annotation\AnnotationInterface;
/**
* @defgroup plugin_translatable Translatable plugin metadata
*
* @{
* When providing plugin annotation, properties whose values are displayed in
* the user interface should be made translatable. Much the same as how user
* interface text elsewhere is wrapped in t() to make it translatable, in plugin
* annotation, wrap translatable strings in the @ Translation() annotation.
* For example:
* @code
* title = @ Translation("Title of the plugin"),
* @endcode
* Remove spaces after @ in your actual plugin - these are put into this sample
* code so that it is not recognized as annotation.
*
* You will also need to make sure that your class file includes the line:
* @code
* use Drupal\Core\Annotation\Translation;
* @endcode
* @}
*/
/**
* Defines a translatable annotation object.
*
......@@ -18,6 +40,8 @@
* around the traditional t() function in drupal.
*
* @Annotation
*
* @ingroup plugin_translatable
*/
class Translation implements AnnotationInterface {
......
......@@ -94,14 +94,18 @@ class EntityType extends Plugin {
/**
* The human-readable name of the type.
*
* @var string
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public $label;
/**
* The human-readable name of the entity bundles, e.g. Vocabulary.
*
* @var string
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public $bundle_label;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment