- Issue created by @pdureau
- Status changed to Needs work
about 1 year ago 9:46am 26 October 2023 - 🇫🇷France pdureau Paris
Let's continue the work. Som are missing. Some are unfinished.
Don't forget the plugins descriptions, and the summaries.
- 🇫🇷France pdureau Paris
Current status
Global:
- check metadata in annotations (label, description...)
- test all plugins, even the one not mentionned here
- test JSON schema properties (default, enum, min/max...) in sources
Attributes type & widget
Attributes prop type is a mapping : attribute name => value, and sometimes value is a sequence (class attributes).
What will be the source widget plugin? UI Patterns Settings is currently proposing a textfield which is parsed as an attribute object before being sent to template: https://git.drupalcode.org/project/ui_patterns_settings/-/blob/8.x-2.x/s...
What do we do?
Links type with menu & breadcrumb sources
Careful, this setting type is currently under heavy changes by Pierre in UI Patterns 1.x: ✨ Add links setting type Needs review
Slot
We need to add
convert_from
mechanism to wrap scalars (string, numbers, booleans..) into a #plain_text render array.
Already made at SDC level for rendering : 🐛 SDC ComponentElement: Transform slots scalar values to #plain_text instead of throwing an exception Fixed . But we also need to add it here to allow mapping while site buildingThis mechanism is not leveraged yet by the plugin manager. It may a good opportunity to propose an implementation.
We need to add a source plugin with WYSIWYG. How?
String type & textfield widget
We need to add
convert_from
mechanism for boolean (after type casting), number (after type casting), url, machine_name, color. What else?This mechanism is not leveraged yet by the plugin manager. It may a good opportunity to propose an implementation.
unknown_prop_type
Do we really need that?
url type & widget
We need to be sure relative URL are also accepted.
enum & list types, with checkboxes & select widgets
JSON schema doesn't allow labels in enums:
enum: - top - bottom
Do we allow (and promote) anyOf with constant instead?
anyOf: [ { "title": Top", "constant": "top" }, { "title": Bottom", "constant": "bottom" } ]
Unit tests
It would be nice to add some for each plugin.
- 🇫🇷France pdureau Paris
Remaining work in this issue:
- Make number works with floats >> WIP, issue with typing
- Manage default values >> WIP, issue since we introduced default_source in form builder
- Add recursive JSON schema reference resolver to avoid SDC validator issues >> WIP, move to service & DI
- Add missing annotations: default source & convert_from (and related convertFrom method) >> WIP
- Add the definition alters
In children issues:
- Convert prop type and source plugins to the new PHP Attributes https://www.drupal.org/node/3395575 →
- Write unit tests
- 🇫🇷France pdureau Paris
- convert_from (and related convertFrom method) will be done in 📌 [2.0.0-alpha1] Add new PropTypes & Sources plugins API Needs work
- Unit tests will be done later in a dedicated issue
- Definition alters are already there
- New PHP Attributes will be done in ✨ [2.0.0-alpha1] Expose default attribute prop in forms? Active
- Rcursive JSON schema reference resolve is already done
So, remaining work
- Make number works with floats >> WIP, issue with typing
- Manage default values >> WIP, issue since we introduced default_source in form builder
- 🇫🇷France pdureau Paris
Also, path source breaks if default source of a prop type:
-- a/src/Plugin/UiPatterns/Source/PathSource.php +++ b/src/Plugin/UiPatterns/Source/PathSource.php @@ -36,6 +36,9 @@ class PathSource extends SourcePluginBase { if (is_scalar($value)) { return (string) $value; } + if (!isset($value["route_name"])) { + return ""; + } $url = Url::fromRoute($value["route_name"], $value["route_parameters"] ?? []); return $url->toString(); }
- 🇫🇷France pdureau Paris
Remaining work is still:
- Make number works with floats >> WIP, issue with typing
- Manage default values >> WIP, issue since we introduced default_source in form builder
- 🇫🇷France pdureau Paris
Some issues are there because of this code from SDC ComponentMetadata:
// All props should also support "object" this allows deferring rendering // in Twig to the render pipeline. $schema_props = $metadata_info['props']; foreach ($schema_props['properties'] ?? [] as $name => $prop_schema) { $type = $prop_schema['type'] ?? ''; $schema['properties'][$name]['type'] = array_unique([ ...(array) $type, 'object', ]); }
- 🇫🇷France pdureau Paris
Radios widget was removed because functional overlap with select widget
- 🇫🇷France pdureau Paris
MenuSource: default value of minimal level & depth >> ::defaultSettings() is not working?
Manage default values >> WIP, issue since we introduced default_source in form builderMoved to alpha2: 🐛 [2.0.0-alpha2] Fix default value management in sources Active
- Merge request !76Issue #3395963 by pdureau: Port UI Patterns Settings plugins to the new API → (Merged) created by pdureau
- Issue was unassigned.
- Status changed to Needs review
8 months ago 2:11pm 31 March 2024 - Status changed to Fixed
8 months ago 5:08pm 4 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.