SiteProperty plugins need a way to install themselves.

Created on 26 July 2023, over 1 year ago
Updated 28 August 2023, over 1 year ago

Problem/Motivation

SiteProperty plugins work by providing their own ::baseFieldDefinitions() method.

Problem is, different modules will provide additional baseFieldDefinitions so they won't get installed automatically.

Steps to reproduce

Enable Site Manager.
Click status widget.
See

Site
The API Key field needs to be installed.
The Site API URI field needs to be installed.

Workaround

Use devel_entity_updates.

drush en devel_entity_updates && drush entup

Proposed resolution

Option #1: Require modules to install their own fields implementing hook_install and hook_update_x. Tedius. Extra maintenance.
Option #2: Figure out a way to do that for them automatically. Site.module could implement

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Jon Pugh
  • πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

    An update....

    In the new 2.x branch I added Bundle classes and a way for SiteProperty plugins to define what bundles they attach to.

    For example, PhpSite bundle class has php_version. That way all bundles that extend other classes also inherit their property fields.

    To do this I had to stop using bundleFieldDefinitions and add everything via site_entity_bundle_field_info() and site_entity_field_storage_info.

    This had a very strange side effect:

    Installing the module no longer installs the fields at all. I can't figure out why. That's why I'm marking this a critical beta blocker.

  • πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

    Woah.

    Figured it out.

    My bundle field hack loads all fields from all bundles in site_entity_field_storage_info()

    However on install, bundles are not available. I will be filing an issue about this with core.

    So, to work around this, I finally stole code from devel_entity_updates and got it working in site_install().

    It's ugly, but it works.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY
Production build 0.71.5 2024