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!

Advertisements

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 )

Google+ photo

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

Connecting to %s