IMP_Contents_View::_getRawDownloadPart PHP Method

_getRawDownloadPart() protected method

Get a MIME Part for use in creating download.
protected _getRawDownloadPart ( string $id ) : Horde_Mime_Part
$id string MIME ID.
return Horde_Mime_Part MIME part, or null on error.
    protected function _getRawDownloadPart($id)
    {
        if (!($mime = $this->_contents->getMimePart($id))) {
            return null;
        }
        if ($this->_contents->canDisplay($id, IMP_Contents::RENDER_RAW)) {
            $render = $this->_contents->renderMIMEPart($id, IMP_Contents::RENDER_RAW);
            $part = reset($render);
            $mime->setContents($part['data'], array('encoding' => 'binary', 'usestream' => true));
        }
        return $mime;
    }