Skip to content

FSE - Follow-up to #25995: Use WP_Theme::get_stylesheet instead of the private property.#26275

Closed
fklein-lu wants to merge 111 commits into
WordPress:masterfrom
fklein-lu:fix/25995-pr-feedback
Closed

FSE - Follow-up to #25995: Use WP_Theme::get_stylesheet instead of the private property.#26275
fklein-lu wants to merge 111 commits into
WordPress:masterfrom
fklein-lu:fix/25995-pr-feedback

Conversation

@fklein-lu

Copy link
Copy Markdown
Contributor

Description

As noted in this comment on PR #25995, the WP_Theme::get_stylesheet() method should be used instead of of accessing the private property.

Code like wp_get_theme()->stylesheet only works because it is implemented as part of the __get() method. PHP IDE's and code analysis tools will flag this as a pattern to avoid.

How has this been tested?

Manually tested by verifying that template parts are still correctly being displayed on the frontend.

Types of changes

PHP code style enhancement.

ntsekouras and others added 11 commits October 19, 2020 17:47
* Fix tagline text alignment

* pass className in useBlockProps
Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
* Draft batch-processing module

* committing/rudimentary API_FETCH integration

* Make batch processing functional!

* Roll back integration changes

* Cleanup package.json

* Update package-lock.json

* Update terminology

* yield from commitTransaction

* Correct yield from

* Move the comment where it belongs

* First pass at enqueueItemAndWaitForResults.

* Draft batch-processing module

* committing/rudimentary API_FETCH integration

* Make batch processing functional!

* Roll back integration changes

* Cleanup package.json

* Update package-lock.json

* Update terminology

* yield from commitTransaction

* Correct yield from

* Move the comment where it belongs

* update package-lock.json

* First pass at using the new sidebars and widget endpoints. (#26086)

* Draft batch-processing module

* committing/rudimentary API_FETCH integration

* Make batch processing functional!

* Roll back integration changes

* Cleanup package.json

* Update package-lock.json

* Update terminology

* yield from commitTransaction

* Correct yield from

* Move the comment where it belongs

* First pass at enqueueItemAndWaitForResults.

* First pass at using the new sidebars and widget endpoints.

* Add test for saving multiple widgets in a row

* Generate better error message when creating fails

* Add basic batch integration.

Works off of #26205.

* Allow mixing HTTP methods in a batch.

* Fix disappearing data, add basic error handling.

We need to get the full list of widget ids from the client, we can't use the
returned widget ids from the batch because not all widgets will be dirty.

Also implements basic error handling for when the batch fails. A snackbar is
added with the names of the widgets that failed to save. We also now propagate
a dummy error to the apiFetch callers for the requests that didn't have a
validation error, but need something to short circuit their handling.

* yield from the widget area saving.

* Move batch-processing into edit-widgets package

Co-authored-by: Adam Zieliński <adam@adamziel.com>

* remove separate batch-processing package

* Update batch processing tests

* Resolve batch errors in a safe, well-ordered way

* Fix unit tests

* Wire progress indicator to specific widgets

* Fix authorship after merge/rebase (1/2)

* Fix authorship after merge/rebase (2/2)

* Don't mark the method property as required.

We don't evaluate nested defaults yet, so this caused errors.

* Allow updating widgets without including the id_base or number.

* Don't start GET /wp/v2/widgets?per_page=-1 if there are batch requests already in progress

* Process newWidgetClientIds in correct order

* Fix package.json

* remove batch-processing package

Co-authored-by: Timothy Jacobs <timothy@ironbounddesigns.com>
The `LegacyWidgetEditHandler` component now uses the widget-types endpoint.

Co-authored-by: Timothy Jacobs <timothy@ironbounddesigns.com>

@Addison-Stavlo Addison-Stavlo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up, it looks good and works well in testing.

I noticed another place that we forgot to update from using textDomain that may be worth adding in the changes here:

$template_part_string = '<!-- wp:template-part {"slug":"' . $slug . '","theme":"' . wp_get_theme()->get( 'TextDomain' ) . '"} -->' . $content . '<!-- /wp:template-part -->';

There it is still using textDomain as the theme name when creating a draft of the template part. It has been working fine in testing since for these block based themes textDomain is currently set up to be the same as the stylesheet name, but we should probably make it consistent. 😁

TimothyBJacobs and others added 11 commits October 19, 2020 22:25
This let's people opt-in to a specific version of batching, and allows us to
introduce in the future further flags to customize behavior.
* Fix current_parsed_blocks with inner blocks

* Fix linting issues

Co-authored-by: Marcus Kazmierczak <marcus@mkaz.com>
* hide overlay opacity control if there is no overlay color or gradient

* remove default black background color of has-background-dim class

* combine selectors for overlay opacity

* make overlay opacity range step congruent with available styles
Follow up to #24599.

Using the child combinator (instead of the descendant combinator) narrows the selector without increasing its specificity. This should help reduce the likelihood of a style issue occurring when a parent element has an `is-style-outline` CSS class.

https://developer.mozilla.org/en-US/docs/Web/CSS/Child_combinator
* Stabilize batching endpoint as v1.

* Update polyfill batching to allow for the widgets endpoint to work.
 - @wordpress/annotations@1.23.0
 - @wordpress/base-styles@3.2.0
 - @wordpress/blob@2.11.0
 - @wordpress/block-directory@1.17.0
 - @wordpress/block-editor@5.1.0
 - @wordpress/block-library@2.26.0
 - @wordpress/blocks@6.24.0
 - @wordpress/components@11.1.0
 - @wordpress/compose@3.22.0
 - @wordpress/core-data@2.24.0
 - @wordpress/data-controls@1.19.0
 - @wordpress/data@4.25.0
 - @wordpress/e2e-test-utils@4.15.0
 - @wordpress/e2e-tests@1.24.0
 - @wordpress/edit-navigation@1.7.0
 - @wordpress/edit-post@3.25.0
 - @wordpress/edit-site@1.15.0
 - @wordpress/edit-widgets@1.1.0
 - @wordpress/editor@9.24.0
 - @wordpress/format-library@1.25.0
 - @wordpress/icons@2.8.0
 - @wordpress/interface@0.10.0
 - @wordpress/keyboard-shortcuts@1.12.0
 - @wordpress/list-reusable-blocks@1.24.0
 - @wordpress/media-utils@1.18.0
 - @wordpress/notices@2.11.0
 - @wordpress/nux@3.23.0
 - @wordpress/plugins@2.23.0
 - @wordpress/postcss-plugins-preset@1.5.1
 - @wordpress/primitives@1.10.0
 - @wordpress/react-native-aztec@1.40.0
 - @wordpress/react-native-bridge@1.40.0
 - @wordpress/react-native-editor@1.40.0
 - @wordpress/reusable-blocks@1.0.0
 - @wordpress/rich-text@3.23.0
 - @wordpress/scripts@12.4.0
 - @wordpress/server-side-render@1.19.0
 - @wordpress/viewport@2.24.0
 - @wordpress/wordcount@2.13.0
@fklein-lu

Copy link
Copy Markdown
Contributor Author

Messed up that rebase, clean PR in #26539.

@fklein-lu fklein-lu closed this Oct 28, 2020
@fklein-lu fklein-lu deleted the fix/25995-pr-feedback branch October 28, 2020 12:33
@Addison-Stavlo

Copy link
Copy Markdown
Contributor

@Addison-Stavlo or @vindl – it's fine to merge approved PRs for contributors that aren't members of the project and can't really do it themselves 😄

Oops! Yes, i completely overlooked that. Will do. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.