NCIOCPL / cgov-digital-platform

The Cancer.gov Digital Communications Platform
GNU General Public License v2.0
11 stars 33 forks source link

Enabler: Support managed links in YAML Content in a proper way #4393

Closed bryanpizzillo closed 4 months ago

bryanpizzillo commented 4 months ago

ESTIMATE TBD

Right now you cannot make linkit links in a way that will always ensures content can be found that is being linked to. A managed link will look like <a data-entity-substitution="canonical" data-entity-type="node" data-entity-uuid="d1daaf44-db1e-4951-906a-df036ef2e3c5" href="/node/43">About Cancer</a>. The problem with just pasting in this link is that when we load the content the UUID and href can change. Other content being loaded can change node ids. Also looking through the generator function it looks like it is based on random elements like the time, etc. So the node being created each drupal install will generate a new UUID.

We can look towards the logic for handling <drupal-entity> references in YAML content with a way to query the system for the node that was created.

<a 
   data-entity-substitution="canonical"
   data-entity-type="media"
   data-entity-uuid="#process"
   data-cgov-yaml-query-*="<VALUE>"
>Some Text</a>

Where the following parameters are:

This would get done in docroot/profiles/custom/cgov_site/modules/custom/cgov_yaml_content/src/Service/YamlEntityEmbedProcessor.php next to the code that handles <drupal-entity>.

Notes