Invoke "mailpoet_scripts_admin_before" from the asset controller
[MAILPOET-5118]
This commit is contained in:
@@ -109,6 +109,10 @@ class AssetsController {
|
||||
]
|
||||
);
|
||||
$this->wp->wpSetScriptTranslations('mailpoet_admin', 'mailpoet');
|
||||
|
||||
if ($this->wp->didAction('mailpoet_scripts_admin_before') === 0) {
|
||||
$this->wp->doAction('mailpoet_scripts_admin_before');
|
||||
}
|
||||
}
|
||||
|
||||
private function getScriptUrl(string $name): string {
|
||||
|
@@ -33,6 +33,14 @@ class Functions {
|
||||
return call_user_func_array('do_action', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hookName
|
||||
* @return int
|
||||
*/
|
||||
public function didAction($hookName) {
|
||||
return did_action($hookName);
|
||||
}
|
||||
|
||||
public function trailingslashit(string $url) {
|
||||
return trailingslashit($url);
|
||||
}
|
||||
|
@@ -180,8 +180,6 @@
|
||||
|
||||
<% block after_translations %><% endblock %>
|
||||
|
||||
<%= do_action('mailpoet_scripts_admin_before') %>
|
||||
|
||||
<% if display_docsbot_widget and not is_dotcom_ecommerce_plan() %>
|
||||
<%= javascript('lib/analytics.js') %>
|
||||
<script type="text/javascript">window.DocsBotAI=window.DocsBotAI||{},DocsBotAI.init=function(c){return new Promise(function(e,o){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://widget.docsbot.ai/chat.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n),t.addEventListener("load",function(){window.DocsBotAI.mount({id:c.id,supportCallback:c.supportCallback,identify:c.identify,options:c.options});var t;t=function(n){return new Promise(function(e){if(document.querySelector(n))return e(document.querySelector(n));var o=new MutationObserver(function(t){document.querySelector(n)&&(e(document.querySelector(n)),o.disconnect())});o.observe(document.body,{childList:!0,subtree:!0})})},t&&t("#docsbotai-root").then(e).catch(o)}),t.addEventListener("error",function(t){o(t.message)})})};</script>
|
||||
|
Reference in New Issue
Block a user