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

can_use_owner_field()

Description

Initialisation and system check if configuration is correctly enabled to use the owner field and mappings logic.

IMPORTANT: during init the globals $owner_field & $owner_field_mappings values will be updated for validation purposes

Parameters

This function accepts no parameters.

Return

boolean Return true if the system is configured with a valid $owner_field and numeric $owner_field_mappings, false otherwise.

Location

include/request_functions.php lines 1193 to 1211

Definition

 
function can_use_owner_field()
    {
    
$GLOBALS['owner_field'] = is_int_loose($GLOBALS['owner_field']) ? (int) $GLOBALS['owner_field'] : 0;

    
// Filter out non numeric user group IDs
    
$GLOBALS['owner_field_mappings'] = array_filter($GLOBALS['owner_field_mappings'], 'is_int_loose');

    
// Filter out non numeric node IDs
    
$GLOBALS['owner_field_mappings'] = array_intersect_key(
        
$GLOBALS['owner_field_mappings'],
        
array_flip(array_filter(array_keys($GLOBALS['owner_field_mappings']), 'is_int_loose')));

    return 
$GLOBALS['owner_field'] > 0
        
&& !empty($GLOBALS['owner_field_mappings'])
        && 
in_array($GLOBALS['owner_field'], array_column(
            
get_resource_type_fields('''ref''asc''', [FIELD_TYPE_DROP_DOWN_LISTFIELD_TYPE_RADIO_BUTTONS], false),
            
'ref'
        
));
    }

This article was last updated 19th March 2024 11:35 Europe/London time based on the source file dated 28th February 2024 10:20 Europe/London time.