Collections functions
General functions
Render functions
Theme permission functions
Resource functions

delete_tabs()

Description

Delete system tabs.

IMPORTANT: never allow the "Default" tab (ref #1) to be deleted because this is the fallback location for information
that has no association with other tabs.

Parameters

ColumnTypeDefaultDescription
$refs array List of tab IDs

Return

bool Returns TRUE if it executed the query, FALSE otherwise

Location

include/tab_functions.php lines 157 to 181

Definition

 
function delete_tabs(array $refs)
    {
    if(!
acl_can_manage_tabs())
        {
        return 
false;
        }

    
$batch_activity_logger = function($ref) { return log_activity(nullLOG_CODE_DELETEDnull'tab''name'$ref); };
    
$refs_chunked array_chunk(
        
// Sanitise list: only numbers and never allow the "Default" tab (ref #1) to be deleted
        
array_diff(array_filter($refs'is_int_loose'), [1]),
        
SYSTEM_DATABASE_IDS_CHUNK_SIZE
    
);
    foreach(
$refs_chunked as $refs_list)
        {
        
$return ps_query(
            
'DELETE FROM tab WHERE ref IN (' ps_param_insert(count($refs_list)) . ')',
            
ps_param_fill($refs_list'i')
        );

        
array_walk($refs_list$batch_activity_logger);
        }

    return isset(
$return);
    }

This article was last updated 3rd October 2022 13:05 Europe/London time based on the source file dated 30th June 2022 11:10 Europe/London time.