Problem/Motivation

Config Inspector reports the following when analyzing `orange_dam.settings.yml`

 	Name 	Label 	Type 	Validatable 	Value 	Error 	Validation error
 	asset_formats.TRX 	Undefined 	undefined 	No 	 	missing schema 	
	asset_formats.TR1 	Undefined 	undefined 	No 	 	missing schema 	

Steps to reproduce

Enable config inspector module and check orange_dam.settings.yml.

Proposed resolution

Add the following to the schema file:

orange_dam.asset_format:
  type: string
  content_types:
    type: sequence
    label: 'Content Types'
    sequence:
      type: string
      label: 'Content Type'

(untested)

And rewrite the asset_formats key to:

    asset_formats:
      type: mapping
      label: 'Content Type <> Asset Format Mapping'
      mapping:
        label: 'Asset Format'
        type: string
        content_types:
          type: orange_dam.asset_format

Alternatively, an improvement could be to remove the `asset_formats` key all together and add it to the configuration of the content types, since that is actually what this config key is doing.

Remaining tasks

Decide whether to remove asset_formats and add it to content type config.

Issue fork orange_dam-3380278

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

apotek created an issue. See original summary.

adamzimmermann’s picture

Thank you for submitting this. I like the proposed solution+++

apotek’s picture

> I like the proposed solution+++

@adamzimmerman, I do too :).

so then the settings would look like this:

content_types:
  'name of content type':
    use_datatable: true|false
    asset_format: TRX|TR1
  'another content type': { }

The schema would need this added:

orange_dam.content_type:
  type: mapping
  label: 'Content type properties'
  mapping:
    use_datatable:
      type: boolean
      label: 'Augment with Data Table data'
+   asset_format:
+     type: string
+      label: 'Orange DAM asset format for content type'

Though it would be more elegant if the asset_format type were not a string but an enum type so it could be validated.

This is the easy part. The harder parts:

1. Refactor the parts of the code that were using the`asset_format` key.
2. Write update hook to remove end users' `asset_format` config and move the values into their `content_types` config.

adamzimmermann’s picture

Alternatively, an improvement could be to remove the `asset_formats` key all together and add it to the configuration of the content types, since that is actually what this config key is doing.

I believe this is what you showed in your comment above, and I'm liking it!

This is the easy part. The harder parts:

You are correct.

adamzimmermann’s picture

Assigned: apotek » adamzimmermann
Status: Active » Needs review

adamzimmermann’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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