Collections functions
General functions
Render functions
Theme permission 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 6030 to 6045

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 4th October 2022 10:05 Europe/London time based on the source file dated 4th October 2022 09:50 Europe/London time.