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

can_delete_featured_collection()

Description

Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).

Parameters

ColumnTypeDefaultDescription
$ref integer Collection ID

Return

boolean Returns TRUE if the featured collection can be deleted, FALSE otherwise

Location

include/collections_functions.php lines 6206 to 6221

Definition

 
function can_delete_featured_collection(int $ref)
    {
    
$sql "SELECT DISTINCT c.ref AS `value`
             FROM collection AS c
        LEFT JOIN collection AS cc ON c.ref = cc.parent
        LEFT JOIN collection_resource AS cr ON c.ref = cr.collection
            WHERE c.`type` = ?
              AND c.ref = ?
         GROUP BY c.ref
           HAVING count(DISTINCT cr.resource) = 0
              AND count(DISTINCT cc.ref) = 0"
;
    
    
$params=array("s",COLLECTION_TYPE_FEATURED,"i",$ref);

    return 
ps_value($sql$params0) > 0;
    }

This article was last updated 14th December 2024 20:35 Europe/London time based on the source file dated 12th December 2024 10:55 Europe/London time.