Updated: Comment #0

Problem/Motivation

#2099363: Allow single config files to be imported and exported (Resolve regression from Views in Drupal 7) adds the ability to import single config entities.
Once committed, it will require you to have the ID specified in the YAML you are importing, which is a reasonable expectation.

However, in D7 Views, it let you choose to rename it anyway, and we could possibly do that here too.
The biggest problem would be conveying that they shouldn't include the config prefix, but that could be solved by adding a field_prefix to FAPI on AJAX.

Proposed resolution

Add a textfield allowing a custom ID that would override any set in the YAML

Remaining tasks

Decide if it should be made required

User interface changes

Yes

API changes

No

#2099363: Allow single config files to be imported and exported (Resolve regression from Views in Drupal 7)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Category: Task » Feature request
Issue summary: View changes
Status: Postponed » Active
tim.plunkett’s picture

Status: Active » Needs review
Issue tags: +Needs usability review
FileSize
2.94 KB

This is what I came up with.
I chose to put it in a details element, because it is very much optional, and we might eventually add in more settings.

Manually tested, and added simpletest coverage as well.

tim.plunkett’s picture

FileSize
33.12 KB

Screenshot:

larowlan’s picture

+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php
@@ -73,6 +73,13 @@ public function testImport() {
+    $this->assertRaw(t('The @entity_type %label was imported.', array('@entity_type' => 'config_test', '%label' => $entity->label())));

Could/should we have an entity_load with the custom id after this - checking we can load the imported object?

tim.plunkett’s picture

FileSize
2.98 KB
953 bytes

Fair point!

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Unless bot disagrees

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned

Just waiting for a committer. Not likely to conflict with anything soon, since it just touches the import form and test.

effulgentsia’s picture

+++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php
@@ -73,6 +73,14 @@ public function testImport() {
+    // Attempt an import with a mismatched UUID and a custom ID.

What does UUID have to do with this?

tim.plunkett’s picture

FileSize
2.96 KB

Bad copy/paste from the previous block.
Changed to // Attempt an import with a custom ID.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

config-import-2101691-9.patch no longer applies.

error: patch failed: core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php:181
error: core/modules/config/lib/Drupal/config/Form/ConfigSingleImportForm.php: patch does not apply

swentel’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs usability review, -Needs reroll
FileSize
2.95 KB

rerolled

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 719dfe1 and pushed to 8.x. Thanks!

  • Commit 719dfe1 on 8.x by alexpott:
    Issue #2101691 by tim.plunkett, swentel: Allow a custom ID to be...

Status: Fixed » Closed (fixed)

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