Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/gitdedalo/v6.4.0_beta' int…
Browse files Browse the repository at this point in the history
…o v6.4.0_beta
  • Loading branch information
alex-render committed Jan 1, 2025
2 parents 0ffcf02 + b4ac27e commit 883b04b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
41 changes: 31 additions & 10 deletions core/common/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1959,14 +1959,30 @@ export const ui = {

/**
* ATTACH_TO_MODAL
* Insert wrapper into a modal box
* Insert content into a dd-modal box
* Generic point of rendering a modal. Used by components, sections, widgets and tools to display
* temporary information such as options, validation, confirmation dialogs, etc.
* It is desirable to use the generic options, but if you need to customize the modal,
* set styles in callback for safe implementation.
* @param object options
* {
* header : node|string,
* body : node|string,
* footer : node|string,
* size : string
* remove_overlay : bool
* header : HTMLElement|string
* body : HTMLElement|string
* footer : HTMLElement|string
* size : string (normal|big|small)
* modal_parent: HTMLElement
* remove_overlay : bool (default false)
* minimizable: bool (default true)
* on_close: function|null (fired on modal close)
* callback : function|null (fired on dd-modal node is ready in DOM)
* }
* @info
* To set a custom width, add a callback as
* {
* ...
* callback : (dd_modal) => {
* dd_modal.modal_content.style.width = '34rem'
* }
* }
* @return HTMLElement modal_container
*/
Expand Down Expand Up @@ -2002,10 +2018,10 @@ export const ui = {
: null
const size = options.size || 'normal' // string size='normal'
const modal_parent = options.modal_parent || document.querySelector('.wrapper.page') || document.body
const remove_overlay = options.remove_overlay || false
const remove_overlay = options.remove_overlay ?? false
const minimizable = options.minimizable ?? true
const on_close = options.on_close || null
const callback = options.callback || null
const on_close = options.on_close ?? null
const callback = options.callback ?? null

// previous_component_selection. Current active component before open the modal
const previous_component_selection = page_globals.component_active || null
Expand Down Expand Up @@ -2074,6 +2090,10 @@ export const ui = {
}

// size. Modal special features based on property 'size'
// If you need a custom size, set options callback (when node is really accessible) as
// callback : (dd_modal) => {
// dd_modal.modal_content.style.width = '20rem'
// }
switch(size) {
case 'big' : {
// hide contents to avoid double scrollbars
Expand Down Expand Up @@ -2103,6 +2123,7 @@ export const ui = {
modal_container._showModalSmall();
break;

case 'normal' :
default :
modal_container._showModal();
break;
Expand All @@ -2124,7 +2145,7 @@ export const ui = {
}
}

// callback
// callback. Here the modal_container is ready and you can set styles safely
if (callback && typeof callback=='function') {
callback(modal_container)
}
Expand Down
2 changes: 1 addition & 1 deletion shared/core_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ function get_section_id_from_tipo( string $tipo ) : string|false {
*/
function get_tld_from_tipo( string $tipo ) : string|false {

preg_match("/[a-z]{2,}/", $tipo, $output_array);
preg_match("/^[a-z]{2,}/", $tipo, $output_array);
if (empty($output_array[0])) {
debug_log(__METHOD__
." Error: Invalid tipo received. Impossible get_tld_from_tipo this tipo : " . PHP_EOL
Expand Down

0 comments on commit 883b04b

Please sign in to comment.