Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0840074
Enqueuing block support styles version 1.
ramonjd Jul 15, 2022
6a42821
Linter, this one's for you.
ramonjd Jul 15, 2022
1f2b4a8
Post trunk merge cleanup and update tests.
ramonjd Jul 15, 2022
5a51073
Removed spacing around curly braces in CSS rules. Updated tests.
ramonjd Jul 18, 2022
55576b9
Splitting `wp_style_engine_enqueue_block_supports_styles` and `wp_sty…
ramonjd Jul 19, 2022
acc6209
Integrate the processor class
ramonjd Jul 24, 2022
7a22c5b
Migrate layout styles to style engine store.
ramonjd Jul 25, 2022
7a6aa60
Update packages/style-engine/class-wp-style-engine.php
ramonjd Jul 27, 2022
49b1433
Tweaks for #42452 (#42691)
aristath Jul 27, 2022
d7893a6
Adding check for the context argument.
ramonjd Jul 28, 2022
bc6e39a
Updating the processor so that it's ignorant of stores. Why? So that …
ramonjd Jul 29, 2022
e8a621d
dump var_dump()
ramonjd Jul 29, 2022
9ba5232
Improve the processor
aristath Jul 29, 2022
b41af7d
remove trailing commas - compatibility with PHP < 7.2
aristath Jul 29, 2022
4ccf650
rename css_declarations to declarations
aristath Jul 29, 2022
e30e4fb
remove unused variable
aristath Jul 29, 2022
062b920
Switch parse_block_styles from public to protected static
ramonjd Aug 1, 2022
5e4164a
Now that all methods are static, there's no need to call `get_instanc…
ramonjd Aug 1, 2022
fcebf93
Revert get_instance() in wp_style_engine_add_to_store because we want…
ramonjd Aug 1, 2022
d0d5fe5
Adding a test for the 'enqueue' flag.
ramonjd Aug 1, 2022
e59eb10
Update lib/block-supports/layout.php
ramonjd Aug 1, 2022
5d7b827
Adding a test for the 'enqueue' flag.
ramonjd Aug 1, 2022
4d9f6c8
Merge branch 'try/style-engine-enqueue-block-supports-styles' of gith…
ramonjd Aug 1, 2022
8d021ee
Add named stores to the processor
aristath Aug 1, 2022
5f60026
avoid setting var for something that only gets used once
aristath Aug 1, 2022
a63f9cb
Only use "else" if absolutely necessary
aristath Aug 1, 2022
0eaef08
Add a set_name method
aristath Aug 1, 2022
e4c791b
combine & simplify conditions
aristath Aug 1, 2022
787f793
use empty() instead of isset() checks here
aristath Aug 1, 2022
7dd5773
shorten it
aristath Aug 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add named stores to the processor
  • Loading branch information
aristath committed Aug 1, 2022
commit 8d021eeb150320607b05ce893a589e26686d07e7
19 changes: 19 additions & 0 deletions packages/style-engine/class-wp-style-engine-css-rules-store.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class WP_Style_Engine_CSS_Rules_Store {
*/
protected static $stores = array();


/**
* The store name.
*
* @var string
*/
protected $name = '';

/**
* An array of CSS Rules objects assigned to the store.
*
Expand All @@ -44,6 +52,8 @@ class WP_Style_Engine_CSS_Rules_Store {
public static function get_store( $store_name = 'default' ) {
if ( ! isset( static::$stores[ $store_name ] ) ) {
static::$stores[ $store_name ] = new static();
// Set the store name.
static::$stores[ $store_name ]->name = $store_name;
}
return static::$stores[ $store_name ];
}
Expand All @@ -66,6 +76,15 @@ public static function remove_all_stores() {
static::$stores = array();
}

/**
* Get the store name.
*
* @return string
*/
public function get_name() {
return $this->name;
}

/**
* Get an array of all rules.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/style-engine/class-wp-style-engine-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class WP_Style_Engine_Processor {
* @param WP_Style_Engine_CSS_Rules_Store $store The store to add.
*/
public function add_store( WP_Style_Engine_CSS_Rules_Store $store ) {
$this->stores[] = $store;
$this->stores[ $store->get_name() ] = $store;
}

/**
Expand Down