model; $id = $model['id']; if ( empty( $model['module_type'] ) ) { sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => missing module_type for a module', $model ); return; } $module_type = $model['module_type']; if ( !CZR_Fmk_Base()->czr_is_module_registered($module_type) ) { sek_error_log( __CLASS__ . '::' . __FUNCTION__ . ' => module_type not registered', $module_type ); return; } $model = sek_normalize_module_value_with_defaults( $model ); // update the current cached model Nimble_Manager()->model = $model; $title_attribute = ''; if ( skp_is_customizing() ) { $title_attribute = __('Edit module settings', 'text-domain'); } // SETUP MODULE TEMPLATE PATH // introduced for #532, october 2019 // Default tmpl path looks like : NIMBLE_BASE_PATH . "/tmpl/modules/image_module_tmpl.php", // // Important note : // @fixes https://github.com/presscustomizr/nimble-builder/issues/537 // since #532, module registered in Nimble Builder core have a render_tmpl_path property looking like 'render_tmpl_path' => "simple_html_module_tmpl.php", // But if a developer wants to register a custom module with a specific template path, it is still possible by using a full path // 1) We first check if the file exists, if it is a full path this will return TRUE and the render tmpl path will be set this way // , for example, we use a custom gif module on presscustomizr.com, for which the render_tmpl_path is a full path: // 'render_tmpl_path' => TC_BASE_CHILD . "inc/nimble-modules/modules-registration/tmpl/modules/gif_image_module_tmpl.php", // 2) then we check if there's an override // 3) finally we use the default Nimble Builder path // render_tmpl_path can be // 1) simple_html_module_tmpl.php <= most common case, the module is registered by Nimble Builder // 2) srv/www/pc-dev/htdocs/wp-content/themes/tc/inc/nimble-modules/modules-registration/tmpl/modules/gif_image_module_tmpl.php <= case of a custom module $template_name_or_path = sek_get_registered_module_type_property( $module_type, 'render_tmpl_path' ); $template_name = basename( $template_name_or_path ); $template_name = ltrim( $template_name_or_path, '/' ); if ( file_exists( $template_name_or_path ) ) { $template_path = $template_name_or_path; } else { $template_path = sek_get_templates_dir() . "/modules/{$template_name}"; } // make this filtrable $render_tmpl_path = apply_filters( 'nimble_module_tmpl_path', $template_path, $module_type ); // Then check if there's an override $overriden_template_path = Nimble_Manager()->sek_maybe_get_overriden_template_path_for_module( $template_name ); $is_module_template_overriden = false; if ( !empty( $overriden_template_path ) ) { $render_tmpl_path = $overriden_template_path; $is_module_template_overriden = true; } // if there's a lazy loaded img background let's print a CSS loader removed when lazy loaded $bg_attributes = Nimble_Manager()->sek_maybe_add_bg_attributes( $model ); $stringified_bg_attributes = implode(' ', array_map(function ($k, $v) {return $k . '="' . $v . '"'; },array_keys($bg_attributes), array_values($bg_attributes)) ); // if there's a lazy loaded img background let's print a CSS loader removed when lazy loaded $has_bg_img = false; if ( false !== strpos( $stringified_bg_attributes, 'data-sek-src="http') ) { $has_bg_img = true; } if ( false !== strpos($stringified_bg_attributes, 'data-sek-bg-parallax="true"') ) { sek_emit_js_event('nb-needs-parallax'); } $module_classes = [ Nimble_Manager()->get_level_visibility_css_class( $model ), $has_bg_img ? 'sek-has-bg' : '', Nimble_Manager()->level_css_classes ]; $level_custom_attr = Nimble_Manager()->level_custom_attr; printf('