Create Dwoo plugin that is reusing another plugin

I am using Dwoo template http://dwoo.org/ for my PHP project, and Dwoo allow me to create custom plugins. each plugin is stored inside php file, and Dwoo will be the one that handle the plugin lazy-loads.

But how one plugin can reuse another plugin? I can’t find anything on google about that, so I take a look at how
the compiled-code call plugin.

    if (function_exists('Dwoo_Plugin_input')===false) {
        $dwoo->getLoader()->loadPlugin('input');
    }

Ah, simple! so my plugin can also use the same way to call another plugin. Here is the code for my ‘password’ plugin that is reusing ‘input’ plugin to generate HTML field

function Dwoo_Plugin_password(Dwoo $dwoo, array $rest = array()) {
    if (function_exists('Dwoo_Plugin_input')===false) {
        $dwoo->getLoader()->loadPlugin('input');
    }
    $rest['type'] = 'password';
    $rest['autocomplete'] = 'off';
    return Dwoo_Plugin_input($dwoo,$rest);
}

Dwoo FTW!

Advertisement

0 Responses to “Create Dwoo plugin that is reusing another plugin”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




About The Blog

Trying to share many settings or programming problems that I find during my work-hours :)

The Writer

Erwin Maulana Saputra a Software Engineer who live in Indonesia, in love with this field since junior high-school while creating ASCII or 320x200, 256bit games :) and now somehow making money from web stuff *wink* Used to work at DotSeven and Mitrais and currently freelancing until January 2011
LinkedIn

 

December 2011
M T W T F S S
« Sep    
 1234
567891011
12131415161718
19202122232425
262728293031  

Follow

Get every new post delivered to your Inbox.

Join 715 other followers