- Issue created by @just_like_good_vibes
- @just_like_good_vibes opened merge request.
- 🇫🇷France just_like_good_vibes PARIS
Christian, would you like to review please?
The support of attributes will be made in ✨ Attributs prop type source replaces token Active , but that issue would need a little refactor and simplification when the current issue would be merged.
- 🇩🇪Germany Christian.wiedemann
1. From my point of view the PropTypeConversionTrait should be a service (PropTypeConverter). And the base class should simple provide the service for easy access.
2. We should avoid renderInIsolation. What is the use case behind. Can we check for '#markup' or #plain_text'?$renderer = \Drupal::service('renderer'); $value = (string) $renderer->renderInIsolation($array); if ($strip_tags_from_render_arrays) { $value = strip_tags($value); }
- 🇫🇷France just_like_good_vibes PARIS
hello,
renderInIsolation was already there. it is used, when component props are receiving render arrays instead of the type expected by the props. this is the usual case when people are using twig to pass data from twig to props.in those case, we always render the data to cast it to the right format. And we render with "renderInIsolation".
- 🇫🇷France just_like_good_vibes PARIS
and, unfortunately, no we can't make a service out of prop type normalization, because basically we need static methods to use those "helper functions" in the trait. let's take as an example
public static function normalize(mixed $value, ?array $definition = NULL): mixed;
fromPropTypeInterface
.I started the conversion to a service and i was then faced by this wall.
so, given my two answers, should we have a consensus for merge :) ?