attachments::get_title (public)

 attachments::get_title -attachment_id attachment_id

Defined in packages/attachments/tcl/attachments-procs.tcl

Switches:
-attachment_id (required)
ID of the attachment (item_id)
Returns:
The title of the attachment (string)

Testcases:
attachments_name_api
Source code:
        #
        # Try our best to get the 'title', depending on the object type
        #
        set title ""
        set object_type [acs_object_type $attachment_id]
        if {[content::extlink::is_extlink -item_id $attachment_id]} {
            #
            # URL
            #
            set title [content::extlink::name -item_id $attachment_id]
        } elseif {[content::item::is_subclass  -object_type $object_type  -supertype "content_item"]} {
            #
            # Content item, or subtype
            #
            set title [content::item::get_title -item_id $attachment_id]
        } elseif {[content::item::is_subclass  -object_type $object_type  -supertype "content_revision"]} {
            #
            # Content revision, or subtype
            #
            set title [content::revision::get_title -revision_id $attachment_id]
        } else {
            #
            # Let's try the 'title' column on 'acs_objects'
            #
            set title [acs_object::get_element  -object_id $attachment_id  -element "title"]
        }
        #
        # If everything fails, set the 'attachment_id' as title
        #
        if {$title eq ""} {
            set title $attachment_id
        }

        return $title
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/attachments/tcl/attachments-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: