- Issue created by @droath
- Status changed to Needs review
over 1 year ago 1:56am 28 July 2023 - πΊπΈUnited States droath
I've added token support for props/slots in the module. Let me know if there is anything else that should be accounted for.
- Status changed to Needs work
over 1 year ago 3:40pm 3 August 2023 - First commit to issue fork.
- πΊπΈUnited States jayhuskins
On the static mapping form, the "Browse available tokens" helper does not include tokens for the entity being displayed. Is this intentional? If I used a token for a static mapping like
[node:title]
for a node display, would the token be evaluated for each node individually? - First commit to issue fork.
- Status changed to Needs review
11 months ago 8:58am 9 January 2024 - πΊπΈUnited States freelock Seattle
Added the current entity type to the token browser, and expanded the token replacement to cover view modes -- previously it only applied on field formatters.
- Status changed to Needs work
10 months ago 6:04pm 25 January 2024 - e0ipso Can Picafort
I see the suggestions on the MR have not been addressed or contested yet. Setting back to Needs Work.
- πΊπΈUnited States freelock Seattle
I don't understand at this point what the data types for each SDC parameter types are allowed to be -- I patched this as an experiment to see if I could get it to work -- and it does work fine for strings.
I've had a tough time finding any documentation for the SDC interface -- but got errors when declaring a prop as a number so I just changed everything to be a string (aside from the slots).
I've gone through the documentation in this section: https://www.drupal.org/docs/develop/theming-drupal/using-single-director... β ... but there's nothing there describing how to use the various prop types, or examples of how to use these effectively...
Is there a good resource describing these types?
`drush generate sdc` prompts for properties and lets you pick among these types:
- String
- Number
- Boolean
- Array
- Object
- Always Null
... I'm thinking if we can detect the prop type here, we can then do some casting (for numeric types) or wrapping (e.g. for array, if the resolved token is a string)
(not sure why there would be an "Always Null" prop -- should this ignore anything assigned, or throw an exception?)
- πΊπΈUnited States freelock Seattle
Took the code from @e0ipso's link, for recursive token replacement.
I have this working with fixed_value props -- I did have an issue destructuring the output of the token replacement where my scenario used it, so I think there might be another spot or two where this needs to get fixed as well (the token replacement was wrapped with an extra array).
Still in progress, but partially working...
- πΊπΈUnited States mortona2k Seattle
Linking to related core issue, maybe there's some hints in there, or something helpful here.
Using the patch, I was able to pass the node url as a prop with a token.
- e0ipso Can Picafort
@freelock any chance you could take this through the finish line?
- πΊπΈUnited States mortona2k Seattle
We work together, I was hoping to keep going on it with him. We're under a heavy workload atm, but next time I have to implement a component I'll look into it.
- πΊπΈUnited States freelock Seattle
The patch is currently working for many tokens, but I have one scenario we need still broken -- trying to get a particular date format on a Smart Date. Haven't had a chance to circle back to fix that.
Otherwise I think it still needs help for non-string props -- I'm wondering if we should attempt to automatically cast whatever is in Fixed Values to a numeric or boolean type? This might be a different issue...
Cheers,
John - πΊπΈUnited States mortona2k Seattle
It would be useful to have the tokens in twig, like in views, so we could modify the output further.
- e0ipso Can Picafort
I did another review path. I feel this is getting closer and closer, but not there yet.
- πΊπΈUnited States freelock Seattle
My comment in #15 turned out to actually be a bug in Smart Date module, which is fixed in their version 4.1.0.
- πΊπΈUnited States mortona2k Seattle
I started looking into the failing test. Still not sure why it's failing exactly, but will need to check the logic for how it's processing tokens. I think it was choking on an array value in the test.
- e0ipso Can Picafort
Thanks @mortona2k and @freelock! Please, ping me in Slack when you want my attention back to this issue.