public function linkdocument()
    {
        $return = array('error' => _t('UploadField.FIELDNOTSET', 'Could not add document to page'));
        $documentSet = $this->getCurrentDocumentSet();
        if (!empty($documentSet)) {
            $document = DMSDocument::get()->byId($this->getRequest()->getVar('documentID'));
            $documentSet->Documents()->add($document);

            $buttonText = '<button class="ss-uploadfield-item-edit ss-ui-button ui-corner-all"'
                . ' title="' . _t('DMSDocument.EDITDOCUMENT', 'Edit this document') . '" data-icon="pencil">'
                . _t('DMSDocument.EDIT', 'Edit') . '<span class="toggle-details">'
                . '<span class="toggle-details-icon"></span></span></button>';

            // Collect all output data.
            $return = array(
                'id' => $document->ID,
                'name' => $document->getTitle(),
                'thumbnail_url' => $document->Icon($document->getExtension()),
                'edit_url' => $this->getEditForm()->Fields()->fieldByName('Main.From your computer.AssetUploadField')
                    ->getItemHandler($document->ID)->EditLink(),
                'size' => $document->getFileSizeFormatted(),
                'buttons' => $buttonText,
                'showeditform' => true
            );
        }

        return Convert::raw2json($return);
    }
public function linkdocument()
    {
        $return = array('error' => _t('UploadField.FIELDNOTSET', 'Could not add document to page'));
        $documentSet = $this->getCurrentDocumentSet();
        if (!empty($documentSet)) {
            $document = DMSDocument::get()->byId($this->getRequest()->getVar('documentID'));
            $documentSet->Documents()->add($document);

            $buttonText = '<button class="ss-uploadfield-item-edit ss-ui-button ui-corner-all"'
                . ' title="' . _t('DMSDocument.EDITDOCUMENT', 'Edit this document') . '" data-icon="pencil">'
                . _t('DMSDocument.EDIT', 'Edit') . '<span class="toggle-details">'
                . '<span class="toggle-details-icon"></span></span></button>';

            // Collect all output data.
            $return = array(
                'id' => $document->ID,
                'name' => $document->getTitle(),
                'thumbnail_url' => $document->Icon($document->getExtension()),
                'edit_url' => $this->getEditForm()->Fields()->fieldByName('Main.From your computer.AssetUploadField')
                    ->getItemHandler($document->ID)->EditLink(),
                'size' => $document->getFileSizeFormatted(),
                'buttons' => $buttonText,
                'showeditform' => true
            );
        }

        return Convert::raw2json($return);
    }
public function linkdocument ( ) { $ return = array ( 'error' => _t ( 'UploadField.FIELDNOTSET' , 'Could not add document to page' ) ) ; $ documentSet = $ this -> getCurrentDocumentSet ( ) ; if ( ! empty ( $ documentSet ) ) { $ document = DMSDocument :: get ( ) -> byId ( $ this -> getRequest ( ) -> getVar ( 'documentID' ) ) ; $ documentSet -> Documents ( ) -> add ( $ document ) ; $ buttonText = '<button class="ss-uploadfield-item-edit ss-ui-button ui-corner-all"' . ' title="' . _t ( 'DMSDocument.EDITDOCUMENT' , 'Edit this document' ) . '" data-icon="pencil">' . _t ( 'DMSDocument.EDIT' , 'Edit' ) . '<span class="toggle-details">' . '<span class="toggle-details-icon"></span></span></button>' ; // Collect all output data. $ return = array ( 'id' => $ document -> ID , 'name' => $ document -> getTitle ( ) , 'thumbnail_url' => $ document -> Icon ( $ document -> getExtension ( ) ) , 'edit_url' => $ this -> getEditForm ( ) -> Fields ( ) -> fieldByName ( 'Main.From your computer.AssetUploadField' ) -> getItemHandler ( $ document -> ID ) -> EditLink ( ) , 'size' => $ document -> getFileSizeFormatted ( ) , 'buttons' => $ buttonText , 'showeditform' => true ) ; } return Convert :: raw2json ( $ return ) ; }
Link an existing document to the given document set ID
@return string JSON
Link an existing document to the given document set ID