Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editor-gradient-presets to get_theme_support #17841

Merged

Conversation

spacedmonkey
Copy link
Member

Description

Fixes #17774

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@swissspidy swissspidy added [Package] Block editor /packages/block-editor [Package] Components /packages/components [Type] Enhancement A suggestion for improvement. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Oct 8, 2019
@swissspidy
Copy link
Member

Let's add this to the Theme Support documentation, in the same manner as the color palettes docs:

https://github.com/WordPress/gutenberg/blob/0ad0414e7a469254ef1ad105fdcf14248a986686/docs/designers-developers/developers/themes/theme-support.md#block-color-palettes

@spacedmonkey
Copy link
Member Author

Let's add this to the Theme Support documentation, in the same manner as the color palettes docs:

@swissspidy I have made a pass at docs. But I am not sure we should continue with docs, until the api is design is complete.

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @spacedmonkey, thank you for submitting this PR 👍 I left some comments, but generally, it seems to be in the right direction and can be merged when the comments are addressed.


$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) );
if ( false !== $gradient_presets ) {
$experiments_settings['gradients'] = $gradient_presets;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a problem where KSES rules in multi-sites remove spacing from gradients and then make the block look invalid.
PR fixing the problem here for default gradients here: #17940

I guess we need to process the gradient values against our KSES function that removes the spaces, before setting it as setting, so even if devs pass values with space the spacing is removed.

If we prefer to solve this issue in a follow up PR, I guess we should update our samples to not include the spaces.

lib/experiments-page.php Outdated Show resolved Hide resolved
@jorgefilipecosta
Copy link
Member

I added a small commit that applies the suggestions. I think we can merge this PR and continue the work. If there is any comment on the last changes, we can update the things in a follow-up PR. Thank you for submitting this PR @spacedmonkey 👍

@jorgefilipecosta jorgefilipecosta merged commit 85b0729 into WordPress:master Nov 1, 2019
daniloercoli added a commit that referenced this pull request Nov 5, 2019
…rnmobile/gb-mobile-872-JSApplicationIllegalArgumentException-in-RCTAztecView

* 'master' of https://github.com/WordPress/gutenberg: (56 commits)
  Update: Default gradients. (#18214)
  Fix: setting a preset color on pullquote default style makes the block invalid (#18194)
  Fix default featured image size (#15844)
  Fix postmeta radio regression. (#18183)
  Components: Switch screen-reader-text to VisuallyHidden (#18165)
  [rnmobile] Release 1.16.0 to master (#18261)
  Template Loader: Add theme block template resolution. (#18247)
  Add a README file for storybook directory (#18245)
  Add editor-gradient-presets to get_theme_support (#17841)
  Add "Image Title Attribute" as an editable attribute on the image block (#11070)
  enables horizontal movers in social blocks (#18234)
  [RNMobile] Add mobile Spacer component (#17896)
  Add experimental `ResponsiveBlockControl` component (#16790)
  Fix mover for floats. (#18230)
  Rename Component to WPComponent in docstring (#18226)
  Colors Selector: replace `Aa` text by SVG icon (#18222)
  Removed gif from README (#18200)
  makes the submenu items stacked vertically (#18221)
  Add block navigator to sidebar panel for nav block (#18202)
  Fix: consecutive updates may trigger a blocks reset (#18219)
  ...
@spacedmonkey
Copy link
Member Author

Thanks for the feedback. Great to see this merged!

@youknowriad youknowriad added this to the Gutenberg 6.9 milestone Nov 11, 2019

```php
add_theme_support(
'__experimental-editor-gradient-presets',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to keep this as experimental for now? When do you think we should make it stable?

@jorgefilipecosta jorgefilipecosta added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Feb 4, 2020
@jorgefilipecosta jorgefilipecosta removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Package] Block editor /packages/block-editor [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add PHP API for registering custom gradient presents
4 participants