Problem/Motivation

Much configuration relates to users and should be packaged together.

Proposed resolution

Iterate through user bundles and create a package for each.

$bundles = entity_get_bundles('user');
foreach ($bundles as $machine_name => $bundle) {
  // Generate a feature for each, using $machine_name and $bundle['label'] as the name.
}

Possibly this should instead be more general and not specific to the user entity type. Offer a list of entity types that support bundles, and then generate a feature per bundle for each. This might, in fact, just be an enhancement of the existing base type

plugin to offer as options all bundle-able entity types.

Remaining tasks

User interface changes

API changes

Comments

nedjo’s picture

On second thought, this seems like a variation of the existing base-type plugin, in that, in its default configuration, that plugin currently creates a package for each node bundle (content type). We could extend that to include user bundles.

nedjo’s picture

Component: Plugins » Assignment plugins
nedjo’s picture

Title: "User Types" plugin » "User Types" plugin, or perhaps extend base type plugin
Project: Configuration Packager » Features
Version: 8.x-1.x-dev » 8.x-3.x-dev
Component: Assignment plugins » Assignment Plugins
Issue summary: View changes
nedjo’s picture

Issue summary: View changes
StatusFileSize
new18.72 KB
new31.67 KB
new36.93 KB

Here is a patch implementing this.

It introduces a second set of checkboxes to the 'base-type' assignment plugin configuration form, for selecting entity types. Screenshot:

The patch also includes #2579763: Only list bundle-providing configuration types as options for 'base-type' assignment plugin. We limit the configuration types shown to those that provide bundles to other entity types. Then, when listing entity types, we show only those that are content bundle types and do not have their bundles provided by other entity types. This way, we don't end up with duplicated options. (For example, since the node_type (Content type) configuration entity type provides bundles (for node), it appears in the first list but node doesn't appear in the second.

By setting 'user' as a default content entity type, a new 'user' package is generated. While no configuration is added to it in this assignment plugin, it will get configuration assigned if other plugins like namespace are enabled.

Screenshot of user package with default settings and standard install profile:

A fair bit of this patch is just what's needed to inject the entity.manager service.

Note that this patch will break backward compatibility for plugin configuration, because it changes the format from

   types:
     node_type: node_type

to

   types:
     config:
       node_type: node_type
     content:
       user: user
nedjo’s picture

Status: Active » Needs review
nedjo’s picture

Assigned: Unassigned » nedjo

  • nedjo committed 722d333 on 8.x-3.x
    Issue #2383599 by nedjo: Extend base-type assignment plugin to allow...
nedjo’s picture

Status: Needs review » Fixed

Applied. As noted, this will break backwards compatibility.

nedjo’s picture

Issue summary: View changes
Status: Fixed » Active

Tips for fixing your site after updating.

  • Clear caches.
  • In your features Bundle configuration, open the configuration forms for each assignment plugin in turn and configure. If you want to match the default settings, configure as follows:
    • For "Exclude": ensure nothing is checked under "Configuration types" and click "Save settings".
    • For "Base type", select "Content type" under "Configuration types" and "User" under "Content entity types" and click "Save settings".
    • For "Core type", select "Field storag", "Role", "Text editor", and "Text format" under "Configuration types" and click "Save settings."

We're in alpha. Should there nonetheless be an update here? If you think so, please reopen this issue.

nedjo’s picture

Status: Active » Fixed

Status: Fixed » Needs work

The last submitted patch, 4: features-user-assignment-2383599-4.patch, failed testing.

nedjo’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.