3

I know I will have to update the model $batch_commands array and also add the new methods/commands I want to run beyond the normal. But this questions main focus is to add more fields/widgets the batch modal like those in the abstract class JHtmlBatch. So I can use <?php echo JHtml::_('batch.customfield'); ?> in the default_batch.php file.

1 Answer 1

6

Okay I found the way that this can be done. In the helpers folder of you component you create a new folder called html and in it you place your file. Now using <?php echo JHtml::_('widget.customfield'); ?> as our example the file name will be admin/helpers/html/widget.php then in the file you add the following:

<?php

defined('_JEXEC') or die;

/**
 * Content HTML helper
 *
 * @since  3.0
 */
abstract class JHtmlWidget
{
    public static function customfield()
    {
        $html = '<h1>works</h1>';

        return $html;
    }
}

Then update this file views/customviewname/tmpl/default.php by adding the following php

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Then in the html area you can now declare the widget simply with the following

<?php echo JHtml::_('widget.customfield'); ?>

have fun...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.