#608 Developer

Parent Category:
Documentation
Category:
DPAttachments
Last Updated:
Allon Moritz (laoneo), Sunday, 29 September 2013 11:20 (Sunday, 29 September 2013)
Created:
Sunday, 29 September 2013 11:20 (Sunday, 29 September 2013)
Hits:
4277

Integrate into your extension

DPAttachments can be integrated easily into your existing Joomla extension, doesn't matter if it is a component, module or plugin. It takes just three lines of code.

if (JLoader::import('components.com_dpattachments.libraries.dpattachments.core', JPATH_ADMINISTRATOR)) {
    echo DPAttachmentsCore::render('com_demo.item', $object->id);
}

 Write your own plugin

If you are not the developer of a Joomla extension but you want to integrate DPAttachments into it then you can write your own plugin. The only requirement is that the extensions fires an event where the plugin can be an observer of. Have a look at the content plugin of DPAttachements. Basically you need the following code similar to the DPCalendar event plugin:

<?php
/**
 * @package		DPAttachments
 * @author		Digital Peak http://www.digital-peak.com
 * @copyright	Copyright (C) 2012 - 2013 Digital Peak. All rights reserved.
 * @license		http://www.gnu.org/licenses/gpl.html GNU/GPL
 */
defined('_JEXEC') or die();

JLoader::import('components.com_dpattachments.libraries.dpattachments.core', JPATH_ADMINISTRATOR);

// If the component is not installed we fail here and no error is thrown
if (! class_exists('DPAttachmentsCore')) {
    return;
}

class plgDPCalendarDpattachments extends JPlugin {

    public function onEventAfterDisplay($event, $output) {
        return DPAttachmentsCore::render('com_dpcalendar.event', $event->id);
    }

    public function onEventAfterDelete($event) {
        return DPAttachmentsCore::delete('com_dpcalendar.event', $event->id);
    }
}

 

Comments (0)

Cookies make it easier for us to provide you with our services. With the usage of our services you permit us to use cookies.
More information Ok Decline