ADR: Landing page
Compare changes
docs/adr/0004-page-entity-type.md
0 → 100644
+ 81
− 0
Currently, Experience Builder is not integrated with any Drupal content entity type for creating pages. To get started with building content entity support, the goal is for Experience Builder to provide the ability to create landing pages. These landing pages do not have configurable fields, nor configurable form displays, nor configurable view displays. This content entity type _does_ use fields (only code-defined base fields) and form and view displays (using the settings specified on the base field definitions). These content entities are managed only through Experience Builder. Later, support for other entity types and bundles will be supported.
Experience Builder must also empower contributed modules to reliably provide such a page without structured content. For example, the [GDPR module](https://drupal.org/project/gdpr) might want to provide a "Privacy policy" page at `/privacy-policy` — without having to make assumptions about what `NodeType`s may exist on a site.
A module's `hook_install()` would be able to call `Page::create()` to create such a content entity and hence guarantee its existence. Module-shipped updates are considered out-of-scope at this time. The shipping module MAY link to the shipped `Page` but only using its _path alias_, i.e. using `internal:/privacy-policy`. Deletion of the `Page` by an authorized user must be respected by the shipping module, and requires checking the existence of the specified path alias prior to generating a link to it.
1. Create a locked content type that works solely with Experience Builder (i.e. providing a `NodeType`: a bundle for the `Node` content entity type, _somewhat_ locked thanks to `\Drupal\node\Entity\NodeType::isLocked()`, but that does not protect against manipulating config directly, only against UI-based manipulations)
While these are acceptable for a full release of Experience Builder, we are still in early development and need iterate rapidly. Experience Builder needs to make direct and opinionated architecture decisions early on. Integrating with an existing system WILL have unknown side effects. These concerns add additional variables that add complexity to the development of Experience Builder.
The content entity type will require custom work, but the level of effort is equal to creating a locked down `NodeType` (implementing access control hooks, form alters, etc.). We will also be able to easily convert into conditional logic for `Node`, as that is the end goal as well, without much loss of effort due to gains from getting started with a specific implementation.
- [#2315773: Create a menu link field type/widget/formatter](https://www.drupal.org/project/drupal/issues/2315773) would bring the Menu Link module functionality into Drupal core and solve this problem. Experience Builder cannot wait for this to happen, but MUST anticipate for this to happen: it must be built in a way that allows deleting all code in favor of that Drupal core functionality.
* Not being able to create sorted lists of `Page` and `Node` content entities, since Views does not support multiple base tables. User research showed that a [listing mixing both in a single list is confusing](https://www.drupal.org/project/experience_builder/issues/3482259#comment-15848593:~:text=UX%20has%20identified%20that%20the%20basic%20page%20concept%20is%20somewhat%20distinct%20from%20the%20structured%20content%20and%20that%20at%20least%20in%20some%20UIs%2C%20that%20should%20be%20prioritized%20over%20other%20types%20of%20content.%20Here%27s%20an%20example%20of%20one%20screen%20for%20this%3A), so that is a non-issue.
The new `Page` content entity type described in this ADR is simply a more _explicit_ way of handling unstructured content: it enables a better UX, with less confusion, and with strong guarantees that installing contrib/custom modules will NOT weaken that better UX. Those guarantees are impossible to achieve with a locked `NodeType`. We have the ability to move the `Page` content entity type into its own submodule at a later time before the 1.0 release.