@@ -21,7 +21,7 @@ public function __construct() {
2121 $ this ->settings_containers = array ();
2222
2323 // Flush the cache when settings are saved
24- add_action ('carbon_fields_theme_options_container_saved ' , array ( $ this , 'options_saved_hook ' ) );
24+ add_action ( 'carbon_fields_theme_options_container_saved ' , array ( $ this , 'options_saved_hook ' ) );
2525
2626 // Create tabbed plugin options page (Settings > Plugin Name)
2727 $ this ->create_tabbed_options_page ();
@@ -42,61 +42,62 @@ private function create_tabbed_options_page() {
4242
4343 // Carbon Fields Docs: https://carbonfields.net/docs/containers-theme-options/
4444 $ container = Container::make ( 'theme_options ' , self ::$ config ->get ( 'plugin/meta/Name ' ) )
45- ->set_page_parent ('options-general.php ' )
46- ->add_tab ( __ ('General ' , self ::$ textdomain ), array (
47- Field::make ('checkbox ' , $ this ->prefix ('uninstall_remove_settings ' ), __ ('Delete Plugin Settings On Uninstall ' , self ::$ textdomain ) ),
48- Field::make ('checkbox ' , $ this ->prefix ('admin_bar_add_clear_cache ' ), __ ('Add "Clear Cache" Link to Admin Bar Dropdown Menu ' , self ::$ textdomain ) )->set_default_value (true ),
49- Field::make ('checkbox ' , $ this ->prefix ('remove_header_emojicons ' ), __ ('Remove Emoji Code From Page Headers ' , self ::$ textdomain ) )
50- ->help_text ( __ ('Checking this box will remove the default Emoji code from page headers. ' , self ::$ textdomain ) ),
51- Field::make ( 'set ' , $ this ->prefix ('enqueue_font_awesome ' ), __ ('Load Font Awesome from CDN ' , self ::$ textdomain ) )
52- ->help_text ( __ ('Load <a href="http://fontawesome.io/" target="_blank">Font Awesome</a> from <a href="https://www.bootstrapcdn.com/fontawesome/" target="_blank">CDN</a>. ' , self ::$ textdomain ) )
53- ->add_options (array (
54- 'frontend ' => __ ('Frontend ' , self ::$ textdomain ),
55- 'backend ' => __ ('Backend ' , self ::$ textdomain )
56- ))
57- ->set_default_value ('backend ' ),
58- Field::make ( 'separator ' , $ this ->prefix ('general_separator_examples ' ), __ ('Example Fields ' , self ::$ textdomain ) )
59- ->help_text ( __ ('These fields are just provided as examples and are not used by any logic in the plugin. ' , self ::$ textdomain ) ),
60- Field::make ('text ' , $ this ->prefix ('blog_title ' ), __ ('Blog Title ' , self ::$ textdomain )),
61- Field::make ('text ' , $ this ->prefix ('email ' ), __ ('Your E-mail Address ' , self ::$ textdomain ) )
62- ->set_attribute ('type ' , 'email ' )
63- ->help_text ( __ ('This input field is an HTML5 <tt>email</tt> type. ' , self ::$ textdomain ) ),
64- Field::make ('text ' , $ this ->prefix ('web_site_url ' ), __ ('Web Site Address ' , self ::$ textdomain ) )
65- ->set_attribute ('type ' , 'url ' )->set_attribute ( 'placeholder ' , site_url () )
66- ->help_text ( __ ('This input field is an HTML5 <tt>url</tt> type. ' , self ::$ textdomain ) ),
67- Field::make ('text ' , $ this ->prefix ('phone ' ), __ ('Phone Number ' , self ::$ textdomain ) )
68- ->set_attribute ('type ' , 'tel ' ),
69- Field::make ('date_time ' , $ this ->prefix ('date_time ' ), __ ('Date & Time ' , self ::$ textdomain ) ),
70- Field::make ('radio ' , $ this ->prefix ('radio_buttons ' ), __ ('Menu Position ' , self ::$ textdomain ))
45+ ->set_page_parent ( 'options-general.php ' )
46+ ->add_tab ( __ ( 'General ' , self ::$ textdomain ), array (
47+ Field::make ( 'checkbox ' , $ this ->prefix ( 'uninstall_remove_settings ' ), __ ( 'Delete Plugin Settings On Uninstall ' , self ::$ textdomain ) ),
48+ Field::make ( 'checkbox ' , $ this ->prefix ( 'admin_bar_add_clear_cache ' ), __ ( 'Add "Clear Cache" Link to Admin Bar Dropdown Menu ' , self ::$ textdomain ) )->set_default_value ( true ),
49+ Field::make ( 'checkbox ' , $ this ->prefix ( 'remove_header_emojicons ' ), __ ( 'Remove Emoji Code From Page Headers ' , self ::$ textdomain ) )
50+ ->help_text ( __ ( 'Checking this box will remove the default Emoji code from page headers. ' , self ::$ textdomain ) ),
51+ Field::make ( 'set ' , $ this ->prefix ( 'enqueue_font_awesome ' ), __ ( 'Load Font Awesome from CDN ' , self ::$ textdomain ) )
52+ ->help_text ( __ ( 'Load <a href="http://fontawesome.io/" target="_blank">Font Awesome</a> from <a href="https://www.bootstrapcdn.com/fontawesome/" target="_blank">CDN</a>. ' , self ::$ textdomain ) )
53+ ->set_default_value ( 'backend ' )
54+ ->add_options ( array (
55+ 'frontend ' => __ ( 'Frontend ' , self ::$ textdomain ),
56+ 'backend ' => __ ( 'Backend ' , self ::$ textdomain )
57+ )
58+ ),
59+ Field::make ( 'separator ' , $ this ->prefix ( 'general_separator_examples ' ), __ ( 'Example Fields ' , self ::$ textdomain ) )
60+ ->help_text ( __ ( 'These fields are just provided as examples and are not used by any logic in the plugin. ' , self ::$ textdomain ) ),
61+ Field::make ( 'text ' , $ this ->prefix ( 'blog_title ' ), __ ( 'Blog Title ' , self ::$ textdomain ) ),
62+ Field::make ( 'text ' , $ this ->prefix ( 'email ' ), __ ( 'Your E-mail Address ' , self ::$ textdomain ) )
63+ ->set_attribute ( 'type ' , 'email ' )
64+ ->help_text ( __ ( 'This input field is an HTML5 <tt>email</tt> type. ' , self ::$ textdomain ) ),
65+ Field::make ( 'text ' , $ this ->prefix ( 'web_site_url ' ), __ ( 'Web Site Address ' , self ::$ textdomain ) )
66+ ->set_attribute ( 'type ' , 'url ' )->set_attribute ( 'placeholder ' , site_url () )
67+ ->help_text ( __ ( 'This input field is an HTML5 <tt>url</tt> type. ' , self ::$ textdomain ) ),
68+ Field::make ( 'text ' , $ this ->prefix ( 'phone ' ), __ ( 'Phone Number ' , self ::$ textdomain ) )
69+ ->set_attribute ( 'type ' , 'tel ' ),
70+ Field::make ( 'date_time ' , $ this ->prefix ( 'date_time ' ), __ ( 'Date & Time ' , self ::$ textdomain ) ),
71+ Field::make ( 'radio ' , $ this ->prefix ( 'radio_buttons ' ), __ ( 'Menu Position ' , self ::$ textdomain ) )
7172 ->add_options (array (
72- 'none ' => __ ('Disabled ' , self ::$ textdomain ),
73- 'top ' => __ ('Top (Default) ' , self ::$ textdomain ),
74- 'left ' => __ ('Left ' , self ::$ textdomain )
73+ 'none ' => __ ( 'Disabled ' , self ::$ textdomain ),
74+ 'top ' => __ ( 'Top (Default) ' , self ::$ textdomain ),
75+ 'left ' => __ ( 'Left ' , self ::$ textdomain )
7576 ))
76- ->set_default_value ('top ' ),
77- Field::make ('complex ' , $ this ->prefix ('slides ' ), self ::$ config ->get ( 'plugin/meta/Name ' ) . ' ' . __ ('Slides ' , self ::$ textdomain) )
77+ ->set_default_value ( 'top ' ),
78+ Field::make ( 'complex ' , $ this ->prefix ( 'slides ' ), self ::$ config ->get ( 'plugin/meta/Name ' ) . ' ' . __ ( 'Slides ' , self ::$ textdomain ) )
7879 ->set_datastore ( new Serialized_Theme_Options_Datastore () )
79- ->add_fields (array (
80- Field::make ('text ' , 'title ' ),
81- Field::make ('image ' , 'photo ' ),
80+ ->add_fields ( array (
81+ Field::make ( 'text ' , 'title ' ),
82+ Field::make ( 'image ' , 'photo ' ),
8283 )
8384 ),
84- Field::make ('select ' , $ this ->prefix ('select_dropdown ' ), __ ('Favorite Continent ' , self ::$ textdomain ) )
85+ Field::make ( 'select ' , $ this ->prefix ( 'select_dropdown ' ), __ ( 'Favorite Continent ' , self ::$ textdomain ) )
8586 ->add_options (array (
86- 'aria ' => __ ('Asia ' , self ::$ textdomain ),
87- 'africa ' => __ ('Africa ' , self ::$ textdomain ),
88- 'europe ' => __ ('Europe ' , self ::$ textdomain ),
89- 'north-america ' => __ ('North America ' , self ::$ textdomain ),
90- 'south-america ' => __ ('South America ' , self ::$ textdomain ),
91- 'australia ' => __ ('Australia ' , self ::$ textdomain ),
92- 'antarctica ' => __ ('Antarctica ' , self ::$ textdomain )
87+ 'aria ' => __ ( 'Asia ' , self ::$ textdomain ),
88+ 'africa ' => __ ( 'Africa ' , self ::$ textdomain ),
89+ 'europe ' => __ ( 'Europe ' , self ::$ textdomain ),
90+ 'north-america ' => __ ( 'North America ' , self ::$ textdomain ),
91+ 'south-america ' => __ ( 'South America ' , self ::$ textdomain ),
92+ 'australia ' => __ ( 'Australia ' , self ::$ textdomain ),
93+ 'antarctica ' => __ ( 'Antarctica ' , self ::$ textdomain )
9394 ))
9495 )
9596 )
96- ->add_tab ( __ ('Miscellaneous ' , self ::$ textdomain ), array (
97- Field::make ('color ' , $ this ->prefix ('font_color ' ), __ ('Foreground Color ' , self ::$ textdomain ) ),
98- Field::make ('image ' , $ this ->prefix ('default_image ' ), __ ('Default Image ' , self ::$ textdomain ) ),
99- Field::make ('file ' , $ this ->prefix ('file ' ), __ ('File Upload ' , self ::$ textdomain ) )
97+ ->add_tab ( __ ( 'Miscellaneous ' , self ::$ textdomain ), array (
98+ Field::make ( 'color ' , $ this ->prefix ( 'font_color ' ), __ ( 'Foreground Color ' , self ::$ textdomain ) ),
99+ Field::make ( 'image ' , $ this ->prefix ( 'default_image ' ), __ ( 'Default Image ' , self ::$ textdomain ) ),
100+ Field::make ( 'file ' , $ this ->prefix ( 'file ' ), __ ( 'File Upload ' , self ::$ textdomain ) )
100101 )
101102 );
102103
@@ -113,10 +114,10 @@ private function create_tabbed_options_page() {
113114 private function create_single_options_page () {
114115
115116 Container::make ( 'theme_options ' , self ::$ config ->get ( 'plugin/meta/Name ' ) )
116- ->set_page_parent ('options-general.php ' )
117+ ->set_page_parent ( 'options-general.php ' )
117118 ->add_fields ( array (
118- Field::make ( 'text ' , $ this ->prefix ('your_name ' ), __ ( 'Your Name ' , self ::$ textdomain ) ),
119- Field::make ( 'image ' , $ this ->prefix ('profile_pic ' ), __ ('Profile Pic ' , self ::$ textdomain ) )
119+ Field::make ( 'text ' , $ this ->prefix ( 'your_name ' ), __ ( 'Your Name ' , self ::$ textdomain ) ),
120+ Field::make ( 'image ' , $ this ->prefix ( 'profile_pic ' ), __ ( 'Profile Pic ' , self ::$ textdomain ) )
120121 )
121122 );
122123
0 commit comments