Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
atanas-vasilev-dev committed Jul 31, 2024
2 parents ca90629 + 4ed5456 commit 1b51f6e
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Define version constant
if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
define( __NAMESPACE__ . '\VERSION', '3.6.3' );
define( __NAMESPACE__ . '\VERSION', '3.6.4' );
}

# Define root directory
Expand Down
2 changes: 1 addition & 1 deletion core/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class Block extends Container {
* {@inheritDoc}
*/
public static function make() {
return call_user_func_array( array( get_parent_class(), 'make' ), array_merge( array( 'block' ), func_get_args() ) );
return call_user_func_array( array( parent::class, 'make' ), array_merge( array( 'block' ), func_get_args() ) );
}
}
6 changes: 3 additions & 3 deletions core/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function factory() {
* @return \Carbon_Fields\Container\Container
*/
public static function make() {
return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
return call_user_func_array( array( static::class, 'factory' ), func_get_args() );
}

/**
Expand All @@ -46,9 +46,9 @@ public static function __callStatic( $method, $arguments ) {
if ( strpos( $method, 'make_' ) === 0 ) {
$raw_type = substr_replace( $method, '', 0, 5 );
array_unshift( $arguments, $raw_type );
return call_user_func_array( array( get_class(), 'factory' ), $arguments );
return call_user_func_array( array( static::class, 'factory' ), $arguments );
} else {
trigger_error( sprintf( 'Call to undefined function: %s::%s().', get_class(), $method ), E_USER_ERROR );
trigger_error( sprintf( 'Call to undefined function: %s::%s().', static::class, $method ), E_USER_ERROR );
}
}
}
2 changes: 1 addition & 1 deletion core/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static function factory( $raw_type, $id, $name = '' ) {
* @return Container
*/
public static function make() {
return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
return call_user_func_array( array( static::class, 'factory' ), func_get_args() );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/Container/Nav_Menu_Item_Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct( $id, $title, $type, $condition_collection, $conditi
}

// Register the custom edit walker only once
$callable = array( get_class(), 'edit_walker' );
$callable = array( static::class, 'edit_walker' );
if ( ! has_filter( 'wp_edit_nav_menu_walker', $callable ) ) {
add_filter( 'wp_edit_nav_menu_walker', $callable, 10, 2 );
}
Expand Down
2 changes: 1 addition & 1 deletion core/Container/Theme_Options_Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ protected function register_page() {
* @return Container $this
*/
public function set_page_parent( $parent ) {
if ( is_a( $parent, get_class() ) ) {
if ( is_a( $parent, static::class ) ) {
$this->settings['parent'] = $parent->get_page_file();
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion core/Datastore/Datastore.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ public static function factory( $raw_type ) {
* @return Datastore_Interface
*/
public static function make() {
return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
return call_user_func_array( array( static::class, 'factory' ), func_get_args() );
}
}
6 changes: 3 additions & 3 deletions core/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function factory() {
* @return \Carbon_Fields\Field\Field
*/
public static function make() {
return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
return call_user_func_array( array( static::class, 'factory' ), func_get_args() );
}

/**
Expand All @@ -67,9 +67,9 @@ public static function __callStatic( $method, $arguments ) {
if ( strpos( $method, 'make_' ) === 0 ) {
$raw_type = substr_replace( $method, '', 0, 5 );
array_unshift( $arguments, $raw_type );
return call_user_func_array( array( get_class(), 'factory' ), $arguments );
return call_user_func_array( array( static::class, 'factory' ), $arguments );
} else {
trigger_error( sprintf( 'Call to undefined function: %s::%s().', get_class(), $method ), E_USER_ERROR );
trigger_error( sprintf( 'Call to undefined function: %s::%s().', static::class, $method ), E_USER_ERROR );
}
}
}
6 changes: 3 additions & 3 deletions core/Field/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function factory( $raw_type, $name, $label = null ) {
* @return Field
*/
public static function make() {
return call_user_func_array( array( get_class(), 'factory' ), func_get_args() );
return call_user_func_array( array( static::class, 'factory' ), func_get_args() );
}

/**
Expand Down Expand Up @@ -293,8 +293,8 @@ public function get_type() {
public function activate() {
$this->admin_init();

add_action( 'admin_print_footer_scripts', array( get_class(), 'admin_hook_scripts' ), 5 );
add_action( 'admin_print_footer_scripts', array( get_class(), 'admin_hook_styles' ), 5 );
add_action( 'admin_print_footer_scripts', array( static::class, 'admin_hook_scripts' ), 5 );
add_action( 'admin_print_footer_scripts', array( static::class, 'admin_hook_styles' ), 5 );
static::activate_field_type( get_class( $this ) );

do_action( 'carbon_fields_field_activated', $this );
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "carbon-fields",
"version": "3.6.3",
"version": "3.6.4",
"description": "WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options, navigation menus and more.",
"directories": {
"test": "tests"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/fields/multiselect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MultiselectField extends Component {
onChange
} = this.props;

onChange( id, selected.map( ( item ) => item.value ) );
onChange( id, selected?.map( ( item ) => item.value ) ?? [] );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function handler( { containers, context } ) {
results.forEach( ( [ id, result ] ) => {
const postboxNode = document.getElementById( id );
const containerNode = document.querySelector( `.container-${ id }` );
const isMounted = !! containerNode.dataset.mounted;
const isMounted = !! containerNode?.dataset?.mounted;

if ( postboxNode ) {
postboxNode.hidden = ! result;
Expand All @@ -119,10 +119,10 @@ export default function handler( { containers, context } ) {
if ( result && ! isMounted ) {
renderContainer( containers[ id ], context );
}

if ( ! result && isMounted ) {
delete containerNode?.dataset?.mounted;

// Rely on React's internals instead of `unmountComponentAtNode`
// due to https://github.com/facebook/react/issues/13690.
// TODO: Conditionally render the fields in the container, this way
Expand Down

0 comments on commit 1b51f6e

Please sign in to comment.