Content-based plugin not loading

by Chase   Last Updated July 12, 2016 08:04 AM

I'm pretty new to plugin creation and I've already hit a snag. I'm trying to add fields to the admin-side article creation via plugin but nothing is showing up in $params signifying proper loading and a die('testing...') in the plugin methods does not fire. Was hoping to get a fresh pair of eyes on this to see what I'm doing incorrectly.

articlepublishemail/articlepublishemail.php:

<?php
defined( '_JEXEC' ) or die;

class plgContentArticlepublishemail extends JPlugin
{
    protected $autoloadLanguage = true;

    function __construct(& $subject, $config)
    {
        parent::__construct($subject,$config);
        $this->loadLanguage();
    }

    function onContentPrepareForm($form,$data)
    {
        ...
        switch($option)
        {
            case 'com_content' :
                if ($app->isAdmin())
                {
                    JForm::addFormPath(__DIR__ . '/forms');
                    $form->loadFile('content',false);
                }
                return true;
        }
        return true
    }
}

articlepublishemail/articlepublishemail.xml:

<?xml version="1.0" encoding="utf-8"?>
...
<files>
    <folder>language</folder>
    <folder>forms</folder>
    <filename plugin="articlepublishemail">articlepublishemail.php</filename>
</files>    
<languages>
    <language tag="en-GB">en-GB.plg_content_articlepublishemail.ini</language>
</languages>      
<config>
    <fields name="params">
    </fields>
</config>

articlepublishemail/forms/content.xml:

<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="attribs">
    <fieldset name="articlepublishemail" label="PLG_CONTENT_ARTICLEPUBLISHEMAIL_FIELDSET_LABEL">
        <field
            name="email_send"
            type="radio"
            default="0"
            label="PLG_CONTENT_ARTICLEPUBLISHEMAIL_EMAIL_SEND_LABEL">
            <option value="0">JOFF</option>
            <option value="1">JON</option>
        </field>
        <field
            name="email_sendto"
            type="text"
            label="PLG_CONTENT_ARTICLEPUBLISHEMAIL_EMAIL_SENDTO_LABEL"
        />
    </fieldset>
</fields>
</form>

I've changed the names of fields and fieldsets several times trying to get something positive going and nothing. I don't entirely understand how the directory structure for a plugin is supposed to work either so that could be it...Either way, any help would be appreciated.



Answers 1


Plugins, like other Joomla extensions, must be enabled in order work and the code be executed.

Please ensure you've enabled it, by going to the Plugin Manager via the Joomla backend.

Lodder
Lodder
July 12, 2016 13:01 PM

Related Questions



Custom field "article id"

Updated March 24, 2018 13:10 PM



Joomla custom fields in mod_articles_category

Updated February 28, 2018 19:10 PM