Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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.