Views allows you to render a specific entity for example in the header/footer of a view.
This functionality is for example used for "taxonomy/term/..." but is especially helpful for custom help texts above a view.
Sadly it uses the entity ID, for referencing to the entity, so deployment of the view is problematic.
On top of that it is not straightforward to find the UUID
ER and Views (and probably other modules) have a shared usecase here to:
- Store a deployable reference in their configuration to a specific entity.
- Reference either a content or configuration entity with the same API.
- For content entities, allow the user enter a serial ID that is then converted to a deployable ID (UUID).
We agreed that the best way to address all of the use cases would be to actually add some methods in the Entity API that ER, Views, or whatever other implementing code can rely on:
Will provide the the correct way to store the value of a target entity--i.e. the UUID for content entities, or the config ID for configuration entities. As elsewhere, the Entity base class will provide the default implementation, and ConfigEntity will override it.
Loads the entity from the string provided by getConfigTarget() (both for rendering and for preparing the form?). Would include this check:
$key = $target_entity_type instanceof ConfigEntityType ? 'config' : 'content' currently found in
For this issue, we'll:
- Add the two methods.
- Rename the Views key to 'target'.
- Convert the logic in
::buildOptionsForm()) to use the new load by target method.
Somehow-or-other allow the View to get the target for the entity during pre-save (instead of inEdit: see #63.
submitOptionsForm()as in the current patch).
Once we add these methods, there will also be some followup in ER (see) to use them there as well.
#111 needs review.
- Possible followup: Add a generic autocomplete implementation which works beyond fields (entity reference)
User interface changes
None yet; the patch just changes what is stored when the user enters valid input.
- New methods
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 85,071 pass(es). View
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 85,033 pass(es). View