Skip to content

Commit c5e53ee

Browse files
author
hsehszroc
committed
added color picker script, code/comment review
1 parent 4daf073 commit c5e53ee

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

setting/setting-component.php

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* -----------------------------------
1010
* DEVELOPED-MAINTAINED-SUPPPORTED BY
1111
* -----------------------------------
12-
* ███ ███╗ ████████████████
13-
* ███ ███║ ██████
14-
* ███ ███║ ╔══█████
15-
* ████████████║ ╚█████
16-
* ███║ ███║ █████
17-
* ███║ ███║ █████
12+
* ███ ███╗ ████████████████
13+
* ███ ███║ ═════════██████
14+
* ███ ███║ ╔══█████═╝
15+
* ████████████║ ╚█████
16+
* ███║═════███║ █████
17+
* ███║ ███║ █████═╝
1818
* ███║ ███║ ████████████████╗
19-
* ╚═╝ ╚═╝ ═══════════════
19+
* ╚═╝ ╚═╝ ═══════════════╝
2020
*/
2121

2222
namespace TheWebSolver\Plugin\Core\Framework;
@@ -421,21 +421,38 @@ public function set_capability( $cap ) {
421421
*/
422422
public function load_assets() {
423423

424+
/**
425+
* WPHOOK: Action -> After loading of each submenu page
426+
*
427+
* This hook can only be accessed on pages created by child-class
428+
*/
429+
do_action( 'hzfex_setting_framework_page_loaded' );
430+
431+
// enqueues styles and scripts.
432+
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
433+
434+
}
435+
436+
/**
437+
* Enqueues styles and scripts
438+
*
439+
* @return void
440+
*
441+
* @since 1.0
442+
*
443+
* @access public
444+
*/
445+
public function enqueue_scripts() {
446+
424447
// core style/script
425448
wp_enqueue_style( 'wp-color-picker' );
426449
wp_enqueue_media();
450+
wp_enqueue_script( 'wp-color-picker' );
427451
wp_enqueue_script( 'jquery' );
428452

429453
// enqueue setting page stylesheet.
430454
wp_enqueue_style( 'hzfex_setting_page_style' );
431455

432-
/**
433-
* WPHOOK: Action -> After loading of each submenu page
434-
*
435-
* This hook can only be accessed on pages created by child-class
436-
*/
437-
do_action( 'hzfex_setting_framework_page_loaded' );
438-
439456
}
440457

441458
/**
@@ -466,13 +483,13 @@ public function load_sections() {
466483
if( ! is_array( $sections ) ) die( $this->section_die() );
467484

468485
/**
469-
* WPHOOK: Filter -> display section navigation if page has single section?
486+
* WPHOOK: Filter -> display section tabs if page has single section?
470487
*
471-
* Controls whether or not to show nav if page has only one section.
488+
* Controls whether or not to show section tabs if page has only one section.
472489
*
473490
* @example - usage:
474491
*
475-
* Shows nav even if only have one section.
492+
* Shows tab even if only have one section.
476493
* add_filter( 'hzfex_show_setting_section_tabs_if_single', '__return_true' );
477494
*
478495
*/
@@ -783,7 +800,7 @@ private function valid_fields() {
783800
*
784801
* NOTE: Use child-class instead
785802
* - Highly recommended to add all fields from child-class {@method `sections()`}.
786-
* - Use this filter only to add new fields to already an existing section added by others.
803+
* - Use this filter only to add new fields to an already existing section added by others.
787804
*
788805
* @param string $section_id -> the section key where field should be added.
789806
* @param array $section_data['fields'] -> an array of fields that belong to that section.

0 commit comments

Comments
 (0)