forked from tlamedia/gtm-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new section for GTM templates
- Loading branch information
1 parent
1ba3b44
commit 5ddce8a
Showing
12 changed files
with
121 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '918cd00c99181c5052ca'); | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'baa09cc5199cdd5a4c88'); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '50640e302b51985018ae'); | ||
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '255eecb819a4fc7efdfc'); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/** | ||
* GTM Kit plugin file. | ||
* | ||
* @package GTM Kit | ||
*/ | ||
|
||
namespace TLA_Media\GTM_Kit\Admin; | ||
|
||
/** | ||
* IntegrationsOptionsPage | ||
*/ | ||
final class TemplatesOptionsPage extends AbstractOptionsPage { | ||
|
||
/** | ||
* The option group. | ||
* | ||
* @var string | ||
*/ | ||
protected $option_group = 'templates'; | ||
|
||
/** | ||
* Configure the options page. | ||
*/ | ||
public function configure(): void { | ||
register_setting( $this->get_menu_slug(), $this->option_name ); | ||
} | ||
|
||
/** | ||
* Get the options page menu slug. | ||
* | ||
* @return string | ||
*/ | ||
protected function get_menu_slug(): string { | ||
return 'gtmkit_templates'; | ||
} | ||
|
||
/** | ||
* Get the admin page menu title. | ||
* | ||
* @return string | ||
*/ | ||
protected function get_menu_title(): string { | ||
return __( 'GTM Templates', 'gtm-kit' ); | ||
} | ||
|
||
/** | ||
* Get the options page title. | ||
* | ||
* @return string | ||
*/ | ||
protected function get_page_title(): string { | ||
return __( 'GTM Templates', 'gtm-kit' ); | ||
} | ||
|
||
/** | ||
* Get the parent slug of the options page. | ||
* | ||
* @return string | ||
*/ | ||
protected function get_parent_slug(): string { | ||
return 'gtmkit_general'; | ||
} | ||
|
||
/** | ||
* Enqueue admin page scripts and styles. | ||
* | ||
* @param string $hook Current hook. | ||
*/ | ||
public function enqueue_page_assets( string $hook ): void { | ||
if ( \strpos( $hook, $this->get_menu_slug() ) !== false ) { | ||
$this->enqueue_assets( 'templates', 'settings' ); | ||
} | ||
} | ||
|
||
/** | ||
* Localize script. | ||
* | ||
* @param string $page_slug The page slug. | ||
* @param string $script_handle The script handle. | ||
*/ | ||
public function localize_script( string $page_slug, string $script_handle ): void { | ||
|
||
\wp_localize_script( | ||
'gtmkit-' . $script_handle . '-script', | ||
'gtmkitSettings', | ||
[ | ||
'rootId' => 'gtmkit-settings', | ||
'currentPage' => $page_slug, | ||
'root' => \esc_url_raw( rest_url() ), | ||
'nonce' => \wp_create_nonce( 'wp_rest' ), | ||
'dashboardUrl' => \menu_page_url( 'gtmkit_general', false ), | ||
'integrationsUrl' => \menu_page_url( 'gtmkit_integrations', false ), | ||
'templatesUrl' => \menu_page_url( 'gtmkit_templates', false ), | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters