Rename `FieldForComponentSuggester` to `PropSourceSuggester`
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3523446. --> Reported by: [wim leers](https://www.drupal.org/user/99777) Related to !277 !1002 >>> <h3 id="overview">Overview</h3> <p>Remove ancient (&gt;1 year old &mdash; predating even the `0.x` branch!) naming directions.</p> <p><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/experience_builder/issues/3522734" title="Status: Closed (fixed)">#3522734: Rename `SdcPropToFieldTypePropMatcher` to `JsonSchemaFieldInstanceMatcher`, `SdcPropJsonSchemaType` to `JsonSchemaType`</a></span> was a good start, but we can do more.</p> <p>And as of <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas/issues/3545859" title="Status: Closed (fixed)">#3545859: Add a `host-entity-url` prop source for linking to the host entity</a></span>, the current name became <em>more</em> problematic still, and gets in the way of the understandability of the overall system.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Contemplated: </p> <ul> <li><code>FieldInstanceMatcher</code> </li><li><code>PropSourceChoiceSuggester</code> </li><li><code>DynamicPropSourceSuggester</code> </li><li><code>StructuredDataSourceSuggester</code> </li><li><code>PropShapeToSourceSuggester</code></li> <li><code>PropShapeToPropSourceSuggester</code></li> <li><code>PropSourceMatcher</code></li> <li><code>PropShapeToPropSourceMatcher</code></li> <li><code>PropShapeToSourceMatcher</code></li> </ul> <p>&#128070; Picked <code>PropSourceSuggester</code> because of its succinctness and because it implies that <em>prop sources</em> only ever make sense for <em>prop shapes</em>.</p> <ol> <li>&#9989; rename <code>\Drupal\experience_builder\ShapeMatcher\FieldForComponentSuggester</code> to <code>PropSourceSuggester</code> </li><li>&#9989; Add this class-level docblock:<br> <pre>/**<br> * Suggests prop sources for a component's props in a host entity type + bundle.<br> *<br> * For all props of an SDC (or equivalent, described using JSON Schema)<br> * - determine all viable structured prop sources (matching shapes)<br> * - generate human-readable labels<br> *<br> * The following prop source types should be suggested, based on shape matches,<br> * with guarantees that each suggestion can indeed correctly populate the given<br> * component's props:<br> * - DynamicPropSources &mdash; these suggest fields (on the host entity type+bundle)<br> * - HostEntityUrlPropSources &mdash; these suggest (relative or absolute) URLs<br> * - AdaptedPropSource &mdash; these suggest adapters<br> *<br> * @see \Drupal\Core\Theme\Component\ComponentMetadata<br> * @see \Drupal\canvas\PropShape\PropShape<br> * @see \Drupal\canvas\Plugin\Canvas\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase::getComponentInputsForMetadata()<br> * @see \Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\GeneratedFieldExplicitInputUxComponentSourceBase<br> * @internal<br> */</pre></li> <li>&#9989; <del>Bonus points: </del> Make <code>::getRawMatches()</code> receive <code>?EntityDataDefinitionInterface $host_entity_type</code> too, pass it to <code>JsonSchemaFieldInstanceMatcher::findFieldInstanceFormatMatches()</code> as well. That would remove the need for first doing the expensive computing and then immediately throwing it away in <code>::suggest()</code>! &#128517;<br> &rarr; doing this will enable <code>::matchHostEntityUrlPropSources()</code> to receive a host entity type, and allows calling <code>\Drupal\Core\Entity\EntityBase::hasLinkTemplate()</code>, to only suggest links valid for the given content entity type </li><li>&#9989; <code>\Drupal\canvas\Controller\ApiUiContentTemplateControllers::suggestStructuredDataForPropShapes()</code> should be renamed to <code>::suggestPropSources</code> </li><li>&#9989;<br> <pre>canvas.api.ui.content_template.suggestions.structured_data_for_prop_shapes:<br>&nbsp; path: '/canvas/api/v0/ui/content_template/suggestions/structured-data-for-prop_shapes/{content_entity_type_id}/{bundle}/{component_config_entity_id}'</pre><p> should be changed to</p> <pre>canvas.api.ui.content_template.suggestions.prop_sources:<br>&nbsp; path: '/canvas/api/v0/ui/content_template/suggestions/prop-sources/{content_entity_type_id}/{bundle}/{component_config_entity_id}'</pre> <h3 id="ui-changes">User interface changes</h3> <p>None.</p> </li></ol> > Related issue: [Issue #3522734](https://www.drupal.org/node/3522734) > Related issue: [Issue #3510896](https://www.drupal.org/node/3510896) > Related issue: [Issue #3511366](https://www.drupal.org/node/3511366) > Related issue: [Issue #3548297](https://www.drupal.org/node/3548297) > Related issue: [Issue #3545859](https://www.drupal.org/node/3545859) > Related issue: [Issue #3521002](https://www.drupal.org/node/3521002)
issue