I know there's a huge amount of discussion currently about the whole render API and actual output of themes, but I think this is also another topic at hand that should be discussed.

Problem:
Modules or themes that wish to add theme enhancements in the appearance admin area currently have to hook_form_alter the theme_settings_form to inject their Form APIs and tack on submit handlers to save their custom settings. This has been apparent in even the Color module since D6. Granted for themes, you can use the theme-settings.php file, but that seems like a rather half-@**ed way to attempt to incorporate configurable settings in your theme.

Solution:
Create a Theme UI API that allows modules and themes (natively, no weird hook_form_alters and submit handlers) the ability to specify additional settings to be shown for that theme. This would be extremely helpful in implementing: #445990: [META] Refactor color module.

Possible contrib modules/themes that could also benefit from this new API:
@font-your-face
Skinr
Style Guide
CSS3PIE
Nice Menus
Omega
Fusion
AdaptiveTheme

Food for thought:
Sweaver is an interesting module that provides a theme GUI overlay, so to speak, on every page. I really haven't used it at all, but it seems rather quite interesting and a great proof of concept. I would like to see maybe incorporating something like this into core, giving the user the ability to "select" the element they'd like to style and allowing the contrib modules/themes to provide the available configurable options they can choose from (ie: Skinr, @font-your-face, Color, rounded corners). In a way, it would almost be like providing a type of ThemeRoller from jQuery UI.

Comments

markhalliwell’s picture

Issue tags: +Framework Initiative
markhalliwell’s picture

Title: Re-engineer Theme (appearance) UI/Interface » Create Theme UI API
andypost’s picture

Suppose UI is a wished target, but a real is theme settings API. D8 will have plugins for content and for layout but OTOH it make sense to have a kind of ctools stylizer for core and a settings for styles

johnalbin’s picture

Drupal's native way of creating form settings is with Form API. In order to add form widgets to an existing form, you use hook_form_alter().

Let me try to interpret this quote:

Create a Theme UI API that allows modules and themes (natively, no weird hook_form_alters and submit handlers) the ability to specify additional settings to be shown for that theme.

You want to re-create Form API but only for theme settings. And so that it doesn't use form alters or submit handlers (which are the native way to implement Form API.)

That goal doesn't make any sense to me. Why make people learn a separate API for one form then the API we use for all other forms?

However, if you can come up with a simpler Form API, we should use it for all forms, not just the theme settings forms.

johnalbin’s picture

Issue summary: View changes

Added link for Sweaver module.

lauriii’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Active » Postponed

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Status: Postponed » Active

unpostponing

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for creating this issue to improve Drupal.

We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

Is this still a valid task? With recipes, SDC, do we need a separate UI?

andypost’s picture

I think it needs LLM to brainstorm as even colors.yaml and palette API went to contrib

nicxvan’s picture

Recipes and sdcs don't solve this.

But as John Albin said form alters are the war to do it.

The new style api being worked on will help too.

I think this can be closed.

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Yes let’s close this, we don’t have any code to discuss and it’s been a while. If the idea resurfaces again, as a *need* then we can discuss in a modern context.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.