Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

checkPreviewToolsOptionUniqueness()

Description

Helper function for Preview tools feature. Checks if a config option that manipulates the preview image (on view page)
is the only one enabled.

IMPORTANT: When adding new preview tool options, make sure to check if you need to add a new type check (at the
moment it only checks for boolean config options and anything else is seen as enabled).

Parameters

ColumnTypeDefaultDescription
$config_option string Preview tool config option name to check

Return

boolean False means there are other preview tool options enabled.

Location

include/resource_functions.php lines 8609 to 8640

Definition

 
function checkPreviewToolsOptionUniqueness($config_option)
    {
    
$count_options_enabled 0;
    
$preview_tool_options = array(
        
'annotate_enabled',
        
'image_preview_zoom'
    
);

    foreach(
$preview_tool_options as $preview_tools_option)
        {
        if(
$preview_tools_option === $config_option)
            {
            continue;
            }

        if(!isset(
$GLOBALS[$preview_tools_option]))
            {
            continue;
            }

        
$check_option $GLOBALS[$preview_tools_option];

        if(
is_bool($check_option) && !$check_option)
            {
            continue;
            }

        
$count_options_enabled++;
        }

    return (
=== $count_options_enabled true false);
    }

This article was last updated 8th September 2023 15:05 Europe/London time based on the source file dated 5th September 2023 16:55 Europe/London time.