- Issue created by @andypost
- Status changed to Needs review
over 1 year ago 11:31pm 26 February 2023 - π«π·France andypost
Filed CR https://www.drupal.org/node/3344579 β
patch initial attempt, looks better to introduce a trait for that like
DeprecatedServicePropertyTrait
- π¬π§United Kingdom longwave UK
+1 to adding a DeprecatedPropertyTrait similar to the service one, if we are going to do this everywhere in Views.
- π«π·France andypost
Thanks! The only trick is that trait will provide only one link to change record but maybe it should be enough
- π¬π§United Kingdom longwave UK
Maybe $deprecatedProperties can include the change record ID? Something like:
protected $deprecatedProperties = [ 'rendered_fields' => ['renderedFields', 3344579], 'render_tokens' => ['renderTokens', 3344579], ];
- Status changed to Needs work
over 1 year ago 12:41pm 28 February 2023 - π³π±Netherlands Lendude Amsterdam
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ +namespace Drupal\views\Plugin\views;
Feel useful outside Views to maybe? Currently not doing anything that would make this Views only, so maybe move it somewhere more generic?
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ +/** + * Provides a standard way to announce deprecated properties. + */
Maybe expand on this that the 'deprecatedProperties' property must be set on all classes that implement this trait?
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ + * Allows to get deprecated/removed properties. ... + * Allows to set deprecated/removed properties.
'Allows throwing an exception when a property is accessed that has been marked as deprecated.'
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ + if (!isset($this->deprecatedProperties)) { + throw new \LogicException('The deprecatedProperties property must be defined to use this trait.'); + }
This bit is only in __get not __set, shouldn't it be in both?
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ + @trigger_error("The property $name is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use $property instead. See https://www.drupal.org/node/$link", E_USER_DEPRECATED);
Hardcoding the Drupal version means we can't use this in 10.2 without existing deprecation messages also changing, so I think that needs to be dynamic as well
-
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Neat!
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ + if (!isset($this->deprecatedProperties)) {
any reason not to put deprecatedProperties on the trait and make it empty?
I assume to prevent using the trait by accident?
-
+++ b/core/modules/views/src/Plugin/views/DeprecatedPropertyTrait.php @@ -0,0 +1,40 @@ + @trigger_error("The property $name is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use $property instead. See https://www.drupal.org/node/$link", E_USER_DEPRECATED);
What if it is deprecated in 10.2.0? Do we need more than $property and $link? Should we have a simple value object?
-
+++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -109,6 +111,23 @@ abstract class StylePluginBase extends PluginBase { + * Keyed array pf replacements where key is deprecated property name.
of
-
- Status changed to Active
4 months ago 5:30am 27 July 2024