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)

Partial Call Graph (max 5 caller/called nodes):
%3 test_attachments_name_api attachments_name_api (test attachments) attachments::get_title attachments::get_title test_attachments_name_api->attachments::get_title acs_object::get_element acs_object::get_element (public) attachments::get_title->acs_object::get_element acs_object_type acs_object_type (public) attachments::get_title->acs_object_type content::extlink::is_extlink content::extlink::is_extlink (public) attachments::get_title->content::extlink::is_extlink content::extlink::name content::extlink::name (public) attachments::get_title->content::extlink::name content::item::get_title content::item::get_title (public) attachments::get_title->content::item::get_title attachments::get_all_attachments attachments::get_all_attachments (public) attachments::get_all_attachments->attachments::get_title packages/attachments/www/detach.tcl packages/attachments/ www/detach.tcl packages/attachments/www/detach.tcl->attachments::get_title

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: