Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource 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 6154 to 6169

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 19th March 2024 05:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.