| @@ -1,8 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Class LP_Abstract_Settings |
| 4 | 4 | */ |
| 5 | + | |
| 6 | +use LearnPress\TemplateHooks\Admin\AdminSettingsPage; | |
| 7 | + | |
| 5 | 8 | abstract class LP_Abstract_Settings { |
| 6 | 9 | |
| 7 | 10 | /** |
| 8 | 11 | * LP_Abstract_Settings constructor. |
| @@ -17,13 +20,13 @@ | ||
| 17 | 20 | return $url; |
| 18 | 21 | } |
| 19 | 22 | |
| 20 | 23 | public function save() { |
| 21 | - // This function should be overwritten from it's child | |
| 24 | + // This function should be overwritten from its child | |
| 22 | 25 | } |
| 23 | 26 | |
| 24 | 27 | /** |
| 25 | - * @return bool | |
| 28 | + * @return bool|mixed|array | |
| 26 | 29 | */ |
| 27 | 30 | public function get_settings() { |
| 28 | 31 | return false; |
| 29 | 32 | } |
| @@ -35,16 +38,11 @@ | ||
| 35 | 38 | * |
| 36 | 39 | * @return mixed |
| 37 | 40 | */ |
| 38 | 41 | public function get_admin_field_name( $name ) { |
| 39 | - $items = LP_Admin_Menu::instance()->get_menu_items(); | |
| 40 | - $section = ''; | |
| 42 | + $tab = AdminSettingsPage::instance()->get_active_tab(); | |
| 43 | + $section = AdminSettingsPage::instance()->get_active_section(); | |
| 41 | 44 | |
| 42 | - if ( ! empty( $items['settings'] ) ) { | |
| 43 | - $tab = $items['settings']->get_active_tab(); | |
| 44 | - $section = $items['settings']->get_active_section(); | |
| 45 | - } | |
| 46 | - | |
| 47 | 45 | if ( $tab === 'payments' && $section !== 'general' && ! empty( $name ) ) { |
| 48 | 46 | if ( strpos( $name, '[' ) === 0 ) { |
| 49 | 47 | $name = $section . $name; |
| 50 | 48 | } else { |
| @@ -85,9 +83,9 @@ | ||
| 85 | 83 | |
| 86 | 84 | if ( $settings ) { |
| 87 | 85 | LP_Meta_Box_Helper::output_fields( $settings ); |
| 88 | 86 | } else { |
| 89 | - echo esc_html__( 'No setting available.', 'learnpress' ); | |
| 87 | + echo esc_html__( 'No settings available.', 'learnpress' ); | |
| 90 | 88 | } |
| 91 | 89 | } |
| 92 | 90 | |
| 93 | 91 | /** |