diff --git a/assets/front-end/js/view/wrapper-link.js b/assets/front-end/js/view/wrapper-link.js new file mode 100644 index 000000000..95854a48e --- /dev/null +++ b/assets/front-end/js/view/wrapper-link.js @@ -0,0 +1,100 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./src/js/view/wrapper-link.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./src/js/view/wrapper-link.js": +/*!*************************************!*\ + !*** ./src/js/view/wrapper-link.js ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +eval("var EaelWrapperLink = function EaelWrapperLink($scope, $) {\n if ($scope.data(\"eael-wrapper-link\") !== undefined) {\n var link_id = $scope.data(\"eael-wrapper-link\");\n $('#' + link_id).appendTo($scope).css({\n position: 'absolute',\n height: '100%',\n width: '100%',\n zIndex: '9999',\n top: 0,\n left: 0\n });\n }\n};\njQuery(window).on('elementor/frontend/init', function () {\n elementorFrontend.hooks.addAction('frontend/element_ready/global', EaelWrapperLink);\n});\n\n//# sourceURL=webpack:///./src/js/view/wrapper-link.js?"); + +/***/ }) + +/******/ }); \ No newline at end of file diff --git a/assets/front-end/js/view/wrapper-link.min.js b/assets/front-end/js/view/wrapper-link.min.js new file mode 100644 index 000000000..0b93a0aa1 --- /dev/null +++ b/assets/front-end/js/view/wrapper-link.min.js @@ -0,0 +1 @@ +!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=36)}({36:function(e,n){var t=function(e,n){void 0!==e.data("eael-wrapper-link")&&n("#"+e.data("eael-wrapper-link")).appendTo(e).css({position:"absolute",height:"100%",width:"100%",zIndex:"9999",top:0,left:0})};jQuery(window).on("elementor/frontend/init",(function(){elementorFrontend.hooks.addAction("frontend/element_ready/global",t)}))}}); \ No newline at end of file diff --git a/config.php b/config.php index ab59484fb..1c92d3f12 100755 --- a/config.php +++ b/config.php @@ -1207,6 +1207,15 @@ ], 'wrapper-link' => [ 'class' => '\Essential_Addons_Elementor\Extensions\Wrapper_Link', + 'dependency' => [ + 'js' => [ + [ + 'file' => EAEL_PLUGIN_PATH . 'assets/front-end/js/view/wrapper-link.min.js', + 'type' => 'self', + 'context' => 'view', + ], + ], + ], ], ], ]; diff --git a/includes/Extensions/Wrapper_Link.php b/includes/Extensions/Wrapper_Link.php index fd5882f02..c7f73ee7d 100644 --- a/includes/Extensions/Wrapper_Link.php +++ b/includes/Extensions/Wrapper_Link.php @@ -20,7 +20,6 @@ public function __construct() { add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ] ); add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ] ); add_action( 'elementor/frontend/before_render', [ $this, 'before_render' ], 1 ); - add_action( 'elementor/frontend/after_render', [ $this, 'after_render' ], 1 ); } public function register_controls( $element ) { @@ -61,17 +60,12 @@ public function before_render( $element ) { $wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' ); if ( "yes" === $element->get_settings_for_display( 'eael_wrapper_link_switch' ) && ! empty( $wrapper_link_settings['url'] ) ) { + $link_id = 'eael-wrapper-link-' . $element->get_id(); + $element->add_render_attribute( 'eael_wrapper_link', 'id', $link_id ); $element->add_link_attributes( 'eael_wrapper_link', $wrapper_link_settings ); - echo "print_render_attribute_string( 'eael_wrapper_link' ); echo ">"; - } - } - - public function after_render( $element ){ - $wrapper_link_settings = $element->get_settings_for_display( 'eael_wrapper_link' ); + echo "print_render_attribute_string( 'eael_wrapper_link' ); echo ">"; - if ( "yes" === $element->get_settings_for_display( 'eael_wrapper_link_switch' ) && ! empty( $wrapper_link_settings['url'] ) ) { - echo ""; + $element->add_render_attribute( '_wrapper', 'data-eael-wrapper-link', $link_id ); } } - } diff --git a/src/js/view/wrapper-link.js b/src/js/view/wrapper-link.js new file mode 100644 index 000000000..05594a937 --- /dev/null +++ b/src/js/view/wrapper-link.js @@ -0,0 +1,17 @@ +let EaelWrapperLink = function ($scope, $) { + if ($scope.data("eael-wrapper-link") !== undefined) { + let link_id = $scope.data("eael-wrapper-link"); + $('#'+link_id).appendTo($scope).css({ + position: 'absolute', + height:'100%', + width: '100%', + zIndex: '9999', + top: 0, + left: 0 + }); + } +}; + +jQuery(window).on('elementor/frontend/init', function () { + elementorFrontend.hooks.addAction('frontend/element_ready/global', EaelWrapperLink); +}); \ No newline at end of file