Skip to content

New types on theme import #1487

Description

@Bloke

When bundling themes for distribution, the theme author may have used the Prefs->Advanced options->Custom form template types to define their own shortcodes or feed forms or image handling forms, etc.

On disk these reside in their own subdirs under /themes/{yourtheme}/forms/.

When the theme author wants to share the theme with the world, they zip up the theme and publish it.

When someone downloads it, puts it on their server, goes to Presentation->Themes and imports it.... Uh-oh. Warnings:

Invalid form type for: {list-of-forms}. Current valid types are: article, category, comment, file, link, section and misc. misc will be used by default.

Feature proposal

When a new type is defined in Custom form template types and the subdir is created, drop the defined configuration of that type into a manifest.json file in its subdir. e.g.:

"feed": {
    "mediatype": "\"text/xml\"",
    "title": "\"Feed\""
}

Keep that file in sync with any changes to the pref value for that type.

That file will be bundled up when the theme is zipped. Then, on installation in a recipient's system, if that group is not already defined, the contents of the manifest can be automatically added to the custom form types pref, and the forms can thus be imported directly into the correct group.

This saves the theme author having to jump through hoops putting the forms in a core-sanctioned group and finding a way to add the type definition to the pref, and to move the forms on install (or having to write up the process in theme documentation for users to do by hand).

A possible nice-to-have would be that if the entry already exists and the incoming definition in the manifest differs, throw a warning that those forms might not work as intended unless the site admin adjusts the definition by hand.

Good idea? Pitfalls?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions