Allow specifying account to switch to when importing default content

Created on 14 March 2025, about 2 months ago

Problem/Motivation

I'd love to use the new DefaultContent API, however \Drupal\Core\DefaultContent\Importer::importContent doesn't work in my project.

  • We do not have any roles with is_admin
  • We want to install default content at install, when there are no users

Steps to reproduce

Write an install task that tries to import content at install

Proposed resolution

Allow passing an account to \Drupal\Core\DefaultContent\Importer::importContent.

- If null, then use existing approach
- Otherwise switch to that account

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

default content system

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024