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

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 153 to 177

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 4th December 2024 09:05 Europe/London time based on the source file dated 16th May 2024 18:10 Europe/London time.