Skip to content

Commit

Permalink
v 2.62.0
Browse files Browse the repository at this point in the history
Settings v 0.18.0 :
- Fix when fields become multilingual
  • Loading branch information
Darklg committed Nov 29, 2023
1 parent 6248b26 commit 2bf2ea3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
16 changes: 7 additions & 9 deletions inc/WPUBaseSettings/WPUBaseSettings.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
namespace wpubasesettings_0_17_6;
namespace wpubasesettings_0_18_0;

/*
Class Name: WPU Base Settings
Description: A class to handle native settings in WordPress admin
Version: 0.17.6
Version: 0.18.0
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
Expand Down Expand Up @@ -75,13 +75,7 @@ public function admin_notices() {
}

public function get_settings() {
$opt = get_option($this->settings_details['option_id']);
if (!is_array($opt)) {
/* Set default values */
$opt = $this->get_setting_values();
update_option($this->settings_details['option_id'], $opt);
}
return $opt;
return $this->get_setting_values();
}

public function get_setting($id, $lang = false) {
Expand Down Expand Up @@ -223,6 +217,7 @@ public function add_settings() {
'id' => $id,
'lang_id' => $lang_id,
'label_for' => $id,
'translated_from' => isset($this->settings[$id]['translated_from']) ? $this->settings[$id]['translated_from'] : false,
'required' => $this->settings[$id]['required'],
'post_type' => $this->settings[$id]['post_type'],
'datas' => $this->settings[$id]['datas'],
Expand Down Expand Up @@ -328,6 +323,9 @@ public function render__field($args = array()) {
}
$id .= $attr;
$value = isset($options[$args['id']]) ? $options[$args['id']] : $args['default_value'];
if(!isset($options[$args['id']]) && isset($args['translated_from']) && $args['translated_from'] && isset($options[$args['translated_from']]) && $options[$args['translated_from']]){
$value = $options[$args['translated_from']];
}

switch ($args['type']) {
case 'checkbox':
Expand Down
6 changes: 3 additions & 3 deletions wpubaseplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/WordPressUtilities/wpubaseplugin
Update URI: https://github.com/WordPressUtilities/wpubaseplugin
Description: A framework for a WordPress plugin
Version: 2.61.1
Version: 2.62.0
Author: Darklg
Author URI: https://darklg.me/
Text Domain: wpubaseplugin
Expand All @@ -18,7 +18,7 @@

class WPUBasePlugin {

public $version = '2.61.1';
public $version = '2.62.0';

private $utilities_classes = array(
'messages' => array(
Expand All @@ -34,7 +34,7 @@ class WPUBasePlugin {
'name' => 'WPUBaseAdminPage'
),
'settings' => array(
'namespace' => 'wpubasesettings_0_17_6',
'namespace' => 'wpubasesettings_0_18_0',
'name' => 'WPUBaseSettings'
),
'cron' => array(
Expand Down

0 comments on commit 2bf2ea3

Please sign in to comment.