Skip to content

Commit

Permalink
Wrapper Link: layout broken issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jakaria-istauk committed Jul 16, 2024
1 parent 6e8c0f4 commit 08b559b
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 10 deletions.
100 changes: 100 additions & 0 deletions assets/front-end/js/view/wrapper-link.js
Original file line number Diff line number Diff line change
@@ -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?");

/***/ })

/******/ });
1 change: 1 addition & 0 deletions assets/front-end/js/view/wrapper-link.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
],
],
],
];
Expand Down
14 changes: 4 additions & 10 deletions includes/Extensions/Wrapper_Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 "<a "; $element->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 "<a "; $element->print_render_attribute_string( 'eael_wrapper_link' ); echo "></a>";

if ( "yes" === $element->get_settings_for_display( 'eael_wrapper_link_switch' ) && ! empty( $wrapper_link_settings['url'] ) ) {
echo "</a>";
$element->add_render_attribute( '_wrapper', 'data-eael-wrapper-link', $link_id );
}
}

}
17 changes: 17 additions & 0 deletions src/js/view/wrapper-link.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 08b559b

Please sign in to comment.