Migration of Modules from Pro to Core in Elementor 2.9

In order to support new features in Elementor Page Builder, 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::elementor()->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/

Liked This Article?

We have a lot more where that came from! Join 1,882,927 subscribers who stay ahead of the pack.
By entering your email, you agree to our Terms of Service and Privacy Policy.

About the Author

Udi Dollberg
Udi Dollberg

Share on

Share on facebook
Share on google
Share on twitter
Share on linkedin

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Never miss an update
Subscribe to our developer’s newsletter for every latest update