We need to integrate Token module. This would allow us to provide tokens for data rather static content.
vaibhavjain created an issue. See original summary.
Token support added. kindly review
+++ b/src/Plugin/Field/FieldFormatter/RewriteFieldFormatter.php @@ -127,6 +127,20 @@ class RewriteFieldFormatter extends FormatterBase implements ContainerFactoryPlu + if ( \Drupal::moduleHandler()->moduleExists('token') ) {
+++ b/src/Plugin/Field/FieldFormatter/RewriteFieldFormatter.php @@ -211,7 +225,10 @@ class RewriteFieldFormatter extends FormatterBase implements ContainerFactoryPlu + //Token Replacement.
Space after //
+++ b/src/Plugin/Field/FieldFormatter/RewriteFieldFormatter.php @@ -211,7 +225,10 @@ class RewriteFieldFormatter extends FormatterBase implements ContainerFactoryPlu + $node = $items->getEntity(); + $token_service = \Drupal::token(); + $output = $token_service->replace($custom_text, array('node'=>$node), $options = array());
We should be doing the token replacement for Prefix suffix as well. rather than just Custom text. Also, can you suggest if there is any other field we should cater this to ?
Token replacement for Prefix suffix are added . kindly review
Coding standard issues here. The code should read - if (\Drupal::moduleHandler()->moduleExists('token'))
+++ b/src/Plugin/Field/FieldFormatter/RewriteFieldFormatter.php @@ -208,10 +222,14 @@ class RewriteFieldFormatter extends FormatterBase implements ContainerFactoryPlu + ¶
Extra spacing here. Should be removed
+++ b/src/Plugin/Field/FieldFormatter/RewriteFieldFormatter.php @@ -208,10 +222,14 @@ class RewriteFieldFormatter extends FormatterBase implements ContainerFactoryPlu + // Token Replacement. ¶
Coding standard issues Fixed.
Coding standard issues Fixed. kindly review
ALl looks perfect. Can you also add the Token help for Prefix and suffix, as we are replacing tokens on these 2 fields as well.
Token help for Prefix and suffix are added .
Token help for Prefix and suffix are added . kindly review
Just changing status.
Issue #2847556 by jitendra verma: Integrate Token module
Fixed and committed. Thank you Jitendra.
Automatically closed - issue fixed for 2 weeks with no activity.
Comments
Comment #2
jitendra verma commentedToken support added. kindly review
Comment #3
jitendra verma commentedToken support added. kindly review
Comment #4
vaibhavjainSpace after //
We should be doing the token replacement for Prefix suffix as well. rather than just Custom text. Also, can you suggest if there is any other field we should cater this to ?
Comment #5
jitendra verma commentedToken replacement for Prefix suffix are added .
kindly review
Comment #6
vaibhavjainCoding standard issues here. The code should read - if (\Drupal::moduleHandler()->moduleExists('token'))
Extra spacing here. Should be removed
Extra spacing here. Should be removed
Comment #7
jitendra verma commentedCoding standard issues Fixed.
Comment #8
jitendra verma commentedCoding standard issues Fixed.
kindly review
Comment #9
vaibhavjainALl looks perfect. Can you also add the Token help for Prefix and suffix, as we are replacing tokens on these 2 fields as well.
Comment #10
jitendra verma commentedToken help for Prefix and suffix are added .
Comment #11
jitendra verma commentedToken help for Prefix and suffix are added .
kindly review
Comment #12
jitendra verma commentedJust changing status.
Comment #14
vaibhavjainFixed and committed. Thank you Jitendra.