Resolve #3421012 "Convert filter plugin"
Closes #3421012
Merge request reports
Activity
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
36 * behavior. 37 * @param int|null $type 38 * The filter type. Values are defined in 39 * \Drupal\filter\Plugin\FilterInterface. 40 * @param int|null $weight 41 * (optional) A default weight for the filter in new text formats. 42 * @param bool|null $status 43 * (optional) Whether this filter is enabled or disabled by default. 44 * @param array|null $settings 45 * (optional) The default settings for the filter. 46 */ 47 public function __construct( 48 public readonly string $id, 49 public readonly ?TranslatableMarkup $title = NULL, 50 public readonly ?TranslatableMarkup $description = NULL, 51 public readonly ?int $type = FilterInterface::TYPE_MARKUP_LANGUAGE, changed this line in version 7 of the diff
- Resolved by quietone
- Resolved by quietone
- Resolved by quietone
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
1 <?php 2 3 namespace Drupal\filter\Attribute; 4 5 use Drupal\Component\Plugin\Attribute\Plugin; 6 use Drupal\Core\StringTranslation\TranslatableMarkup; 7 use Drupal\filter\Plugin\FilterInterface; 8 9 /** 10 * Defines a filter attribute for plugin discovery. 11 * 12 * Plugin Namespace: Plugin\Filter 13 * 14 * For a working example, see \Drupal\filter\Plugin\Filter\FilterHtml I guess we should remove this comment from the Annotation now too (same could be said for all other instances of this).
Edited by Michael Strelanchanged this line in version 4 of the diff
@sakthi_dev I meant we should remove it from the Annotation class, not the Attribute
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
10 * Defines a filter attribute for plugin discovery. 11 * 12 * Plugin Namespace: Plugin\Filter 13 * 14 * For a working example, see \Drupal\filter\Plugin\Filter\FilterHtml 15 * 16 * @see \Drupal\filter\FilterPluginManager 17 * @see \Drupal\filter\Plugin\FilterInterface 18 * @see \Drupal\filter\Plugin\FilterBase 19 * @see plugin_api 20 */ 21 #[\Attribute(\Attribute::TARGET_CLASS)] 22 class Filter extends Plugin { 23 24 /** 25 * Constructs an Filter attribute. changed this line in version 4 of the diff
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
28 * The plugin ID. 29 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title 30 * The human-readable name of the filter. This is used as an administrative 31 * summary of what the filter does. 32 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description 33 * (optional) Additional administrative information about the filter's 34 * behavior. 35 * @param int|null $type 36 * The filter type. Values are defined in 37 * \Drupal\filter\Plugin\FilterInterface. 38 * @param int|null $weight 39 * (optional) A default weight for the filter in new text formats. 40 * @param bool|null $status 41 * (optional) Whether this filter is enabled or disabled by default. 42 * @param array|null $settings 43 * (optional) The default settings for the filter. changed this line in version 6 of the diff
31 * type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE, 32 * settings = { 33 * "default_view_mode" = "default", 34 * "allowed_view_modes" = {}, 35 * "allowed_media_types" = {}, 36 * }, 37 * weight = 100, 38 * ) 39 * 40 30 * @internal 41 31 */ 32 #[Filter( 33 id: "media_embed", 34 title: new TranslatableMarkup("Embed media"), 35 description: new TranslatableMarkup("Embeds media items using a custom tag, <code><drupal-media></code>. If used in conjunction with the 'Align/Caption' filters, make sure this filter is configured to run after them."), 36 type: FilterInterface::TYPE_TRANSFORM_REVERSIBLE, added 238 commits
-
d081a1ce...6fca4655 - 237 commits from branch
project:11.x
- dc38eae7 - Merge branch drupal:11.x into 3421012-convert-filter-plugin
-
d081a1ce...6fca4655 - 237 commits from branch
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
22 class Filter extends Plugin { 23 24 /** 25 * Constructs a Filter attribute. 26 * 27 * @param string $id 28 * The plugin ID. 29 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title 30 * The human-readable name of the filter. This is used as an administrative 31 * summary of what the filter does. 32 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description 33 * (optional) Additional administrative information about the filter's 34 * behavior. 35 * @param int $type 36 * (optional) The filter type. Values are defined in 37 * \Drupal\filter\Plugin\FilterInterface. - Comment on lines +35 to +37
This is not optional. See how\Drupal\filter\Plugin\FilterBase::getType()
has no fallback logic. It's used by\Drupal\filter\Entity\FilterFormat::getFilterTypes()
,\Drupal\filter\Entity\FilterFormat::getHtmlRestrictions()
etc.The docs at
\Drupal\filter\Plugin\FilterInterface
also say this is required. changed this line in version 11 of the diff
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
16 * @see \Drupal\filter\FilterPluginManager 17 * @see \Drupal\filter\Plugin\FilterInterface 18 * @see \Drupal\filter\Plugin\FilterBase 19 * @see plugin_api 20 */ 21 #[\Attribute(\Attribute::TARGET_CLASS)] 22 class Filter extends Plugin { 23 24 /** 25 * Constructs a Filter attribute. 26 * 27 * @param string $id 28 * The plugin ID. 29 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title 30 * The human-readable name of the filter. This is used as an administrative 31 * summary of what the filter does. - Comment on lines +29 to +31
The docs at\Drupal\filter\Plugin\FilterInterface
say this is required, and the docs here say it too, but the typehint does not:30 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $title 31 * The human-readable name of the filter. This is used as an administrative 32 * summary of what the filter does. 30 * @param \Drupal\Core\StringTranslation\TranslatableMarkup $title 31 * The human-readable name of the filter. This is used as an administrative 32 * summary of what the filter does.
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
32 * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description 33 * (optional) Additional administrative information about the filter's 34 * behavior. 35 * @param int $type 36 * (optional) The filter type. Values are defined in 37 * \Drupal\filter\Plugin\FilterInterface. 38 * @param int $weight 39 * (optional) A default weight for the filter in new text formats. 40 * @param bool $status 41 * (optional) Whether this filter is enabled or disabled by default. 42 * @param array $settings 43 * (optional) The default settings for the filter. 44 */ 45 public function __construct( 46 public readonly string $id, 47 public readonly ?TranslatableMarkup $title = NULL, changed this line in version 9 of the diff
- core/modules/filter/src/Attribute/Filter.php 0 → 100644
34 * behavior. 35 * @param int $type 36 * (optional) The filter type. Values are defined in 37 * \Drupal\filter\Plugin\FilterInterface. 38 * @param int $weight 39 * (optional) A default weight for the filter in new text formats. 40 * @param bool $status 41 * (optional) Whether this filter is enabled or disabled by default. 42 * @param array $settings 43 * (optional) The default settings for the filter. 44 */ 45 public function __construct( 46 public readonly string $id, 47 public readonly ?TranslatableMarkup $title = NULL, 48 public readonly ?TranslatableMarkup $description = NULL, 49 public readonly int $type = FilterInterface::TYPE_MARKUP_LANGUAGE, changed this line in version 9 of the diff