Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 156 to 180

Definition

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

    
$batch_activity_logger = function($ref) { 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 24th April 2024 09:05 Europe/London time based on the source file dated 18th August 2023 11:35 Europe/London time.