-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Andrés <nosolosw@users.noreply.github.com> (+1 squashed commit) Squashed commits: [3213429] Update: Make global styles shape consistent with local styles shape.
- Loading branch information
1 parent
cfbce35
commit 4b505ea
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* This function allows to easily access a part from a php array. | ||
* It is equivalent to want lodash get provides for JavaScript and is useful to have something similar | ||
* in php so functions that do the same thing on the client and sever can have identical code. | ||
* | ||
* @param array $array An array from where we want to retrieve some information from. | ||
* @param array $path An array containing the path we want to retrieve. | ||
* | ||
* @return array Containing a set of css rules. | ||
*/ | ||
function gutenberg_experimental_get( $array, $path ) { | ||
$path_length = count( $path ); | ||
for ( $i = 0; $i < $path_length; ++$i ) { | ||
if ( empty( $array[ $path[ $i ] ] ) ) { | ||
return null; | ||
} | ||
$array = $array[ $path[ $i ] ]; | ||
} | ||
return $array; | ||
} |