/**
 * Builds the markup for the attachment drawer in directories
 *
 * @since 1.4
 */
function bp_docs_doc_attachment_drawer()
{
    $atts = bp_docs_get_doc_attachments(get_the_ID());
    $html = '';
    if (!empty($atts)) {
        $html .= '<ul>';
        $html .= '<h4>' . __('Attachments', 'bp-docs') . '</h4>';
        foreach ($atts as $att) {
            $html .= bp_docs_attachment_item_markup($att->ID, 'simple');
        }
        $html .= '</ul>';
    }
    echo $html;
}
<?php

if (bp_docs_is_doc_edit() || bp_docs_is_doc_create()) {
    ?>
	<?php 
    bp_docs_media_buttons('doc_content');
}
?>

<ul id="doc-attachments-ul">
<?php 
foreach (bp_docs_get_doc_attachments() as $attachment) {
    ?>
	<?php 
    echo bp_docs_attachment_item_markup($attachment->ID);
}
?>
</ul>