In order to support new features in Elementor, we are moving the Link Actions module and the Social Share JS library from Elementor Pro into the Core version.
Link Actions
The Link Actions module allowed attaching Elementor event triggers to button links. For example, a hash could be added to a button link to trigger the opening/closing of a popup.
Up until Elementor and Elementor Pro 2.9.0, Link Actions existed as an Elementor Pro module located in the elementor-pro/modules/link-actions
directory. In 2.9.0, we split the Link Actions module up into two separate parts and moved it to the Elementor Core plugin.
PHP
The PHP part of the Link Actions module was moved to the elementor/includes/frontend.php
file. The original method, create_action_url
, was replaced by a new method called create_action_hash
, which accepts two parameters: an action (to perform on click), and additional settings related to the action: create_action_hash( $action, array $settings )
.
PHP Examples:
Deprecated Implementation:
<?php
\ElementorPro\Modules\LinkActions\Module::create_action_url( 'popup:open', [
'id' => $settings['popup'],
'toggle' => 'toggle' === $settings['action'],
] );
New Implementation:
<?php
\Elementor\Plugin::$instance->frontend->create_action_hash( 'popup:open', [
'id' => $settings['popup'],
'toggle' => 'toggle' === $settings['action'],
] );
JS
The JS handler was located at elementor-pro/modules/link-actions/assets/js/frontend/frontend.js
. moved to the JS utils folder at elementor/assets/dev/js/frontend/utils/url-actions.js
. The handler runs by default on all elementor pages, scans links for actions, and if it finds any, it executes them. The script is mostly unchanged. Feel free to check out the source code in the GitHub repo.
JS Examples – Adding a link action:
Deprecated Implementation:
elementorProFrontend.modules.linkActions.addAction( 'popup:open',() => {
// Do your action here
} );
New Implementation:
elementorFrontend.utils.urlActions.addAction( 'popup:open', () =>
{
// Do your action here
} );
Social Share (now Share Link)
The Social Share library enabled the integration of social sharing capabilities into some Elementor Pro widgets.
The library generates custom share links to a variety of social networks and exists both as an object on the global scope (object name: ShareLink
), as well as a jQuery plugin (method name jQuery.fn.shareLink()
).
Nothing has changed in the library’s functionality or the way it is used. To familiarize yourself with the library, feel free to visit the library’s source code on Elementor’s GitHub page: https://github.com/elementor/elementor.
Up until Elementor and Elementor Pro 2.9.0, Social Share existed as a library hosted in Elementor Pro (elementor-pro/assets/lib/social-share/social-share.js
). In 2.9.0, we changed the file name to better reflect the library’s functionality and moved it to the Elementor Core plugin.
The newly named Share Link library is now located in elementor/assets/lib/share-link/
.
7 Responses
Will this improve Elementor’s performance and speed?
When will version 2.9 be available in beta?
Will this optimize Elementor’s performance.
Also, when will version 2.9 be available in beta?
Does this mean it’s now a free feature? Or they only work if we have Pro installed?
About the actions, I’m curious, somehow I missed the hooks until now. Does this mean we can now add multiple actions to a button, or it is still limited to just one action at a time? Like for example: a same button can close the current pop-up while also triggering another one?
how can I use the social share in 2.9.0 core (non pro)? I see the widget, but it says only available in pro.
Hello,
Are you sure you have this call right?
\Elementor\Plugin::elementor()->frontend->create_action_hash
When I try to use it, I get fatal error.
When I use ElementorPro namespace, everything works fine:
\ElementorPro\Plugin::elementor()->frontend->create_action_hash
Thanks for clarification.
Petr
Hi,
I’ve posted this question in April, but it’s still awaiting moderation, so here is it again:
—–
Are you sure you have this call right?
\Elementor\Plugin::elementor()->frontend->create_action_hash
When I try to use it, I get a fatal error.
When I use ElementorPro namespace, everything works fine:
\ElementorPro\Plugin::elementor()->frontend->create_action_hash
Thanks for clarification.
Petr
Hi,
I’ve posted this question in April, but it’s still awaiting moderation, so here is it again:
—–
Are you sure you have this call right?
\Elementor\Plugin::elementor()->frontend->create_action_hash
When I try to use it, I get a fatal error.
When I use ElementorPro namespace, everything works fine:
\ElementorPro\Plugin::elementor()->frontend->create_action_hash
Thanks for the clarification.
Petr