Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 enababled.

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 8132 to 8163

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 23rd November 2020 15:35 Europe/London time based on the source file dated 13th November 2020 16:50 Europe/London time.