Skip to content

Commit

Permalink
Merge pull request #1380 from vektor-inc/fix/get_balloon_meta_options…
Browse files Browse the repository at this point in the history
…/default_value

 【2人目レビュー待ち】get_balloon_meta_optionsデフォルト値の取得方法調整
@mthaichi @drill-lancer 
ありがとうございます!マージします
  • Loading branch information
shimotmk authored Aug 23, 2022
2 parents 7aa99f1 + 871e570 commit aa31a2d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions inc/vk-blocks/class-vk-blocks-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static function balloon_image_number() {
*
* @return $balloon_meta_schema
*/
public function balloon_meta_schema() {
public static function balloon_meta_schema() {
$number = self::balloon_image_number();
$return_array = array();
$return_array['default_icons'] = array(
Expand Down Expand Up @@ -188,17 +188,9 @@ public static function get_properties( $schema ) {
* @return options
*/
public static function get_balloon_meta_options() {
$options = get_option( 'vk_blocks_balloon_meta' );
$number = self::balloon_image_number();
$defaults = array();
$defaults['default_icons'] = array();
for ( $i = 1; $i <= $number; $i++ ) {
$defaults['default_icons'][ $i ] = array(
'name' => null,
'src' => null,
);
};
$options = wp_parse_args( $options, $defaults );
$options = get_option( 'vk_blocks_balloon_meta' );
$defaults = self::get_properties( self::balloon_meta_schema() );
$options = wp_parse_args( $options, $defaults );
return $options;
}

Expand Down

0 comments on commit aa31a2d

Please sign in to comment.