| @@ -1,132 +1,116 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Settings | |
| 4 | - * | |
| 5 | - * @package Wow_Plugin | |
| 6 | - * @copyright Copyright (c) 2018, Dmytro Lobov | |
| 7 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
| 8 | - * @since 1.0 | |
| 9 | - */ | |
| 10 | 2 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 12 | - exit; | |
| 13 | -} | |
| 3 | +use FloatMenuLite\Settings_Helper; | |
| 14 | 4 | |
| 15 | -include_once( 'icons.php' ); | |
| 16 | -$icons_new = array(); | |
| 17 | -foreach ( $icons as $key => $value ) { | |
| 18 | - $icons_new[ $value ] = $value; | |
| 19 | -} | |
| 5 | +defined( 'ABSPATH' ) || exit; | |
| 20 | 6 | |
| 21 | -$count_i = ( ! empty( $param['menu_1']['item_type'] ) ) ? count( $param['menu_1']['item_type'] ) : '0'; | |
| 22 | -if ( $count_i > 0 ) { | |
| 23 | - for ( $i = 0; $i < $count_i; $i ++ ) { | |
| 7 | +$args = [ | |
| 8 | + 'item_tooltip' => [ | |
| 9 | + 'type' => 'text', | |
| 10 | + 'title' => __( 'Label Text', 'float-menu' ), | |
| 11 | + ], | |
| 24 | 12 | |
| 25 | - // Icon | |
| 26 | - $item_icon_[ $i ] = array( | |
| 27 | - 'name' => 'param[menu_1][item_icon][]', | |
| 28 | - 'class' => 'icons', | |
| 29 | - 'type' => 'select', | |
| 30 | - 'val' => isset( $param['menu_1']['item_icon'][ $i ] ) ? $param['menu_1']['item_icon'][ $i ] | |
| 31 | - : 'fas fa-hand-point-up', | |
| 32 | - 'option' => $icons_new, | |
| 33 | - ); | |
| 34 | 13 | |
| 35 | - // Label for item | |
| 36 | - $item_tooltip_[ $i ] = array( | |
| 37 | - 'name' => 'param[menu_1][item_tooltip][]', | |
| 38 | - 'class' => 'item-tooltip', | |
| 39 | - 'type' => 'text', | |
| 40 | - 'val' => isset( $param['menu_1']['item_tooltip'][ $i ] ) ? $param['menu_1']['item_tooltip'][ $i ] : '', | |
| 41 | - ); | |
| 14 | + 'item_type' => [ | |
| 15 | + 'type' => 'select', | |
| 16 | + 'title' => __( 'Type', 'float-menu' ), | |
| 17 | + 'atts' => Settings_Helper::item_type(), | |
| 18 | + ], | |
| 42 | 19 | |
| 43 | - // Type of the item | |
| 44 | - $item_type_[ $i ] = array( | |
| 45 | - 'name' => 'param[menu_1][item_type][]', | |
| 46 | - 'type' => 'select', | |
| 47 | - 'class' => 'item-type', | |
| 48 | - 'val' => isset( $param['menu_1']['item_type'][ $i ] ) ? $param['menu_1']['item_type'][ $i ] : 'link', | |
| 49 | - 'option' => array( | |
| 50 | - 'link' => esc_attr__( 'Link', $this->plugin['text'] ), | |
| 51 | - ), | |
| 20 | + 'item_link' => [ | |
| 21 | + 'type' => 'text', | |
| 22 | + 'title' => __( 'Link', 'float-menu' ), | |
| 23 | + 'class' => 'is-hidden', | |
| 24 | + ], | |
| 52 | 25 | |
| 53 | - ); | |
| 26 | + 'new_tab' => [ | |
| 27 | + 'type' => 'checkbox', | |
| 28 | + 'title' => __( 'Open in new Window', 'float-menu' ), | |
| 29 | + 'label' => __( 'Enable', 'float-menu' ), | |
| 30 | + 'class' => 'is-hidden', | |
| 31 | + ], | |
| 54 | 32 | |
| 55 | 33 | |
| 56 | - // Link URL | |
| 57 | - $item_link_[ $i ] = array( | |
| 58 | - 'name' => 'param[menu_1][item_link][]', | |
| 59 | - 'type' => 'text', | |
| 60 | - 'val' => isset( $param['menu_1']['item_link'][ $i ] ) ? $param['menu_1']['item_link'][ $i ] : '', | |
| 61 | - ); | |
| 62 | 34 | |
| 35 | + // Icons | |
| 36 | + 'item_icon' => [ | |
| 37 | + 'type' => 'select', | |
| 38 | + 'title' => __( 'Icon', 'float-menu' ), | |
| 39 | + 'atts' => Settings_Helper::icons(), | |
| 40 | + ], | |
| 63 | 41 | |
| 64 | - // Open link in a new window | |
| 65 | - $new_tab_[ $i ] = array( | |
| 66 | - 'name' => 'param[menu_1][new_tab][]', | |
| 67 | - 'class' => '', | |
| 68 | - 'type' => 'checkbox', | |
| 69 | - 'val' => isset( $param['menu_1']['new_tab'][ $i ] ) ? $param['menu_1']['new_tab'][ $i ] : 0, | |
| 70 | - 'func' => '', | |
| 71 | - 'sep' => '', | |
| 72 | - ); | |
| 73 | 42 | |
| 74 | - // Font color | |
| 75 | - $color_[ $i ] = array( | |
| 76 | - 'name' => 'param[menu_1][color][]', | |
| 77 | - 'type' => 'color', | |
| 78 | - 'val' => isset( $param['menu_1']['color'][ $i ] ) ? $param['menu_1']['color'][ $i ] : '#ffffff', | |
| 79 | - ); | |
| 43 | + // Style | |
| 44 | + 'color' => [ | |
| 45 | + 'type' => 'text', | |
| 46 | + 'val' => '#ffffff', | |
| 47 | + 'atts' => [ | |
| 48 | + 'class' => 'wpie-color', | |
| 49 | + 'data-alpha-enabled' => 'true', | |
| 50 | + ], | |
| 51 | + 'title' => __( 'Color', 'float-menu' ), | |
| 52 | + ], | |
| 80 | 53 | |
| 81 | - // Font hover color | |
| 82 | - $hcolor_[ $i ] = array( | |
| 83 | - 'name' => 'param[menu_1][hcolor][]', | |
| 84 | - 'type' => 'color', | |
| 85 | - 'val' => isset( $param['menu_1']['hcolor'][ $i ] ) ? $param['menu_1']['hcolor'][ $i ] : '#ffffff', | |
| 86 | - ); | |
| 54 | + 'hcolor' => [ | |
| 55 | + 'type' => 'text', | |
| 56 | + 'val' => '#ffffff', | |
| 57 | + 'atts' => [ | |
| 58 | + 'class' => 'wpie-color', | |
| 59 | + 'data-alpha-enabled' => 'true', | |
| 60 | + ], | |
| 61 | + 'title' => __( 'Hover Color', 'float-menu' ), | |
| 62 | + ], | |
| 87 | 63 | |
| 64 | + 'bcolor' => [ | |
| 65 | + 'type' => 'text', | |
| 66 | + 'val' => '#184c72', | |
| 67 | + 'atts' => [ | |
| 68 | + 'class' => 'wpie-color', | |
| 69 | + 'data-alpha-enabled' => 'true', | |
| 70 | + ], | |
| 71 | + 'title' => __( 'Background', 'float-menu' ), | |
| 72 | + ], | |
| 88 | 73 | |
| 89 | - // Background | |
| 90 | - $bcolor_[ $i ] = array( | |
| 91 | - 'name' => 'param[menu_1][bcolor][]', | |
| 92 | - 'type' => 'color', | |
| 93 | - 'val' => isset( $param['menu_1']['bcolor'][ $i ] ) ? $param['menu_1']['bcolor'][ $i ] : '#128be0', | |
| 94 | - ); | |
| 74 | + 'hbcolor' => [ | |
| 75 | + 'type' => 'text', | |
| 76 | + 'val' => '#184c72', | |
| 77 | + 'atts' => [ | |
| 78 | + 'class' => 'wpie-color', | |
| 79 | + 'data-alpha-enabled' => 'true', | |
| 80 | + ], | |
| 81 | + 'title' => __( 'Hover Background', 'float-menu' ), | |
| 82 | + ], | |
| 95 | 83 | |
| 96 | 84 | |
| 85 | + // Attributes | |
| 86 | + 'button_id' => [ | |
| 87 | + 'type' => 'text', | |
| 88 | + 'title' => __( 'ID for element', 'float-menu' ), | |
| 89 | + ], | |
| 97 | 90 | |
| 98 | - $button_id_[ $i ] = array( | |
| 99 | - 'name' => 'param[menu_1][button_id][]', | |
| 100 | - 'type' => 'text', | |
| 101 | - 'val' => isset( $param['menu_1']['button_id'][ $i ] ) ? $param['menu_1']['button_id'][ $i ] : '', | |
| 102 | - ); | |
| 91 | + 'button_class' => [ | |
| 92 | + 'type' => 'text', | |
| 93 | + 'title' => __( 'Class for element', 'float-menu' ), | |
| 94 | + ], | |
| 103 | 95 | |
| 104 | - $button_class_[ $i ] = array( | |
| 105 | - 'name' => 'param[menu_1][button_class][]', | |
| 106 | - 'type' => 'text', | |
| 107 | - 'val' => isset( $param['menu_1']['button_class'][ $i ] ) ? $param['menu_1']['button_class'][ $i ] : '', | |
| 108 | - ); | |
| 96 | + 'link_rel' => [ | |
| 97 | + 'type' => 'text', | |
| 98 | + 'title' => __( 'Attribute: rel', 'float-menu' ), | |
| 99 | + ], | |
| 109 | 100 | |
| 101 | + 'aria_label' => [ | |
| 102 | + 'type' => 'text', | |
| 103 | + 'title' => __( 'Aria label', 'float-menu' ), | |
| 104 | + ], | |
| 110 | 105 | |
| 111 | - } | |
| 112 | 106 | |
| 113 | -} | |
| 107 | +]; | |
| 114 | 108 | |
| 115 | -$item_tooltip_help = array( | |
| 116 | - 'text' => esc_attr__( 'Set the text for menu item.', $this->plugin['text'] ), | |
| 117 | -); | |
| 109 | +$prefix = 'menu_1-'; | |
| 110 | +$newArgs = []; | |
| 118 | 111 | |
| 119 | -$item_type_help = array( | |
| 120 | - 'title' => esc_attr__( 'Types of the button which can be select', $this->plugin['text'] ), | |
| 121 | - 'ul' => array( | |
| 122 | - esc_attr__( 'Link - insert any link', $this->plugin['text'] ), | |
| 123 | - ), | |
| 124 | -); | |
| 112 | +foreach ( $args as $key => $value ) { | |
| 113 | + $newArgs[ $prefix . $key ] = $value; | |
| 114 | +} | |
| 125 | 115 | |
| 126 | -$button_id_help = array( | |
| 127 | - 'text' => esc_attr__( 'Set the attribute ID for the menu item or left empty.', $this->plugin['text'] ), | |
| 128 | -); | |
| 129 | - | |
| 130 | -$button_class_help = array( | |
| 131 | - 'text' => esc_attr__( 'Set the attribute CLASS for the menu item or left empty.', $this->plugin['text'] ), | |
| 132 | -); | |
| 116 | +return $newArgs; | |