Skip to content

Commit

Permalink
9.3.1 (#24)
Browse files Browse the repository at this point in the history
- [Widget] Moved the Dark Toggle ACF JSON from theme to plugin
- [Widget] Fixed Socials widget outputting error
- [Widget] Added orientation setting to Social Links widget
  • Loading branch information
hrsetyono authored Aug 9, 2022
1 parent 9b3e443 commit f823dbd
Show file tree
Hide file tree
Showing 13 changed files with 193 additions and 83 deletions.
4 changes: 2 additions & 2 deletions edje-wp-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* License: MIT
* Author: Pixel Studio
* Author URI: https://pixelstudio.id
* Version: 9.3.0
* Version: 9.3.1
*/

if (!defined('WPINC')) { die; } // exit if accessed directly

// Constant
define('H_VERSION', '9.3.0');
define('H_VERSION', '9.3.1');
define('H_BASE', basename(dirname(__FILE__)).'/'.basename(__FILE__));

define('H_DIR', __DIR__); // for require
Expand Down
9 changes: 5 additions & 4 deletions module-widgets/_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
add_action('widgets_init', '_h_unregister_widgets');
add_filter('acf/settings/load_json', '_h_load_acf_json_widgets', 20);


if (is_admin()) {
add_filter('gutenberg_use_widgets_block_editor', '__return_false');
add_filter('use_widgets_block_editor', '__return_false');
Expand Down Expand Up @@ -92,7 +93,7 @@ function _h_register_sidebar_v2() {
'name' => $name,
'id' => $id,
'before_sidebar' => "<div class='footer-widgets {$id}'> {$before_sidebar}",
'after_sidebar' => "{$after_sidebar} </footer>",
'after_sidebar' => "{$after_sidebar} </div>",
]);
}

Expand Down Expand Up @@ -173,7 +174,6 @@ function _h_load_acf_json_widgets($paths) {
return $paths;
}


/**
* @action admin_enqueue_scripts
*/
Expand Down Expand Up @@ -237,7 +237,7 @@ function add_acf_fields() {
/**
* Get sidebar data
*
* @deprecated v2 - replaced by h_dynamic_header()
* @deprecated 9.3.0 - replaced by h_dynamic_header()
*
* @param string $slug - the sidebar ID
*/
Expand All @@ -258,7 +258,8 @@ function h_dynamic_sidebar($slug) {

/**
* Register Sidebar for Header and Footer builder
* @deprecated - replaced by v2
*
* @deprecated 9.3.0 - replaced by _h_register_sidebar_v2()
*
* @action widgets_init
*/
Expand Down
30 changes: 27 additions & 3 deletions module-widgets/acf-json/group_5f1e8498f248e.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@
"id": ""
},
"choices": {
"default": "Default (Square)",
"default": "Square",
"pill-shape": "Circle",
"outline" : "Outline",
"outline": "Outline",
"logos-only": "Logos Only"
},
"default_value": ["default"],
"default_value": "default",
"layout": "horizontal",
"allow_null": 0,
"multiple": 0,
Expand Down Expand Up @@ -159,6 +159,30 @@
"return_format": "value",
"save_other_choice": 0
},
{
"key": "field_60cd8f24a13c7",
"label": "Orientation",
"name": "orientation",
"type": "button_group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"horizontal": "<span class='dashicons dashicons-arrow-right-alt'></span> Horizontal",
"vertical": "<span class='dashicons dashicons-arrow-down-alt'></span> Vertical"
},
"allow_null": 0,
"other_choice": 0,
"default_value": "horizontal",
"layout": "horizontal",
"return_format": "value",
"save_other_choice": 0
},
{
"key": "field_60cd8f24a1ec4",
"label": "Size",
Expand Down
101 changes: 101 additions & 0 deletions module-widgets/acf-json/group_62e526dda2cbf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"key": "group_62e526dda2cbf",
"title": "Edje Widget - Dark Toggle",
"fields": [
{
"key": "field_62e5288bec0fc",
"label": "Style",
"name": "style",
"type": "button_group",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"has-label": "Has Label",
"no-label": "No Label"
},
"allow_null": 0,
"default_value": "",
"layout": "horizontal",
"return_format": "value"
},
{
"key": "field_62e526e90170c",
"label": "Label Light",
"name": "label_light",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_62e5288bec0fc",
"operator": "!=",
"value": "no-label"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Light",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_62e52802c52df",
"label": "Label Dark",
"name": "label_dark",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_62e5288bec0fc",
"operator": "!=",
"value": "no-label"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "Dark",
"prepend": "",
"append": "",
"maxlength": ""
}
],
"location": [
[
{
"param": "widget",
"operator": "==",
"value": "h_dark_toggle"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1659185934
}
13 changes: 5 additions & 8 deletions module-widgets/widget--template.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
*/
class H_WidgetName extends H_Widget {
function __construct() {
parent::__construct(
'h_name',
__('- Name'),
[
'description' => __('Short description here')
]
);
parent::__construct('h_name', __('- Name'), [
'description' => __('Short description here')
]);
}

function widget($args, $instance) {
Expand All @@ -30,11 +26,12 @@ function render_widget($data) {
[
'acf_field' => $acf_field,
] = $data;

ob_start(); ?>

<div>
<?= $acf_field ?>
</div>

<?php return ob_get_clean();
}
}
15 changes: 6 additions & 9 deletions module-widgets/widget-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
*/
class H_WidgetButton extends H_Widget {
function __construct() {
parent::__construct(
'h_button',
__('x Button'),
[
'description' => __('Create a Button')
]
);
parent::__construct('h_button', __('x Button'), [
'description' => __('Create a Button')
]);
}

function widget($args, $instance) {
Expand Down Expand Up @@ -42,9 +38,9 @@ function render_widget($data) {
'link' => $link,
'style' => $style,
'icon' => $icon,
] = $data;

] = $data;
ob_start(); ?>

<div class="wp-block-button is-style-<?= $style ?>">
<a
class="wp-block-button__link"
Expand All @@ -60,6 +56,7 @@ class="wp-block-button__link"
<?php endif; ?>
</a>
</div>

<?php return ob_get_clean();
}
}
14 changes: 6 additions & 8 deletions module-widgets/widget-buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
*/
class H_WidgetButtons extends H_Widget {
function __construct() {
parent::__construct(
'h_buttons',
__('- Buttons'),
[
'description' => __('Create multiple buttons')
]
);
parent::__construct('h_buttons', __('- Buttons'), [
'description' => __('Create multiple buttons')
]);
}

function widget($args, $instance) {
Expand All @@ -34,8 +30,9 @@ function render_widget($data) {
'has_icon' => $has_icon,
'buttons' => $buttons,
] = $data;

ob_start(); ?>

<div class="wp-block-buttons">
<?php foreach ($buttons as $b): ?>
<div class="wp-block-button is-style-<?= $b['style'] ?>">
Expand All @@ -57,6 +54,7 @@ class="wp-block-button__link"
</div>
<?php endforeach; ?>
</div>

<?php return ob_get_clean();
}
}
13 changes: 5 additions & 8 deletions module-widgets/widget-dark-toggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
*/
class H_DarkToggle extends H_Widget {
function __construct() {
parent::__construct(
'h_dark_toggle',
__('- Dark Mode Toggle'),
[
'description' => __('Switch between dark/light mode')
]
);
parent::__construct('h_dark_toggle', __('- Dark Mode Toggle'), [
'description' => __('Switch between dark/light mode')
]);
}

function widget($args, $instance) {
Expand Down Expand Up @@ -44,8 +40,8 @@ function render_widget($data) {
'label_light' => $label_light,
'label_dark' => $label_dark,
] = $data;

ob_start(); ?>

<label class="h-dark-toggle is-style-<?= $style ?>">
<?php if ($label_light): ?>
<span>
Expand All @@ -62,6 +58,7 @@ function render_widget($data) {
</span>
<?php endif; ?>
</label>

<?php return ob_get_clean();
}
}
Expand Down
11 changes: 5 additions & 6 deletions module-widgets/widget-logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/
class H_WidgetLogo extends H_Widget {
function __construct() {
parent::__construct(
'h_logo',
__('- Logo'),
[ 'description' => __('Show logo from Customizer') ]
);
parent::__construct('h_logo', __('- Logo'), [
'description' => __('Show logo from Customizer')
]);
}

function widget($args, $instance) {
Expand Down Expand Up @@ -42,8 +40,8 @@ function render_widget($data) {
'logo_src' => $logo_src,
'tagline' => $tagline,
] = $data;

ob_start(); ?>

<div class="wp-block-site-logo">
<a
href="<?= get_home_url() ?>"
Expand All @@ -58,6 +56,7 @@ class='custom-logo-link'
</span>
<?php endif; ?>
</div>

<?php return ob_get_clean();
}
}
Loading

0 comments on commit f823dbd

Please sign in to comment.