New to php and plugin building. I am a front end guy but need to learn templates building in Joomla. I have a small one working that gives you the ability to insert and change some text in the function onContentAfterTitle.
class plgContentmyplugin extends JPlugin
{
public function onContentAfterTitle($context, $article, $params, $limitstart)
{
if ($this->params->get('alt-text')) {
return $this->params->get('alt-text');
} else {
return "<p>Hello World!</p>";
}
Now I am understanding that the XML determines the backend options in the admin control panel. Then using the php to display it.
I want to be able to extend this plugin, for mostly learning purposes. I have some XML displaying options to change font colour and size. I am just a little unsure on the php and which function I should be calling in order to achieve that. Should I be using one of the other parameters? e.g. $context or $article? Any help would be much appreciated.
<field name="font-size" type="list" default="12" description="What size font should the message use?" label="Font size">
<option value="8">8px</option>
<option value="12">12px</option>
<option value="16">16px</option>
</field>
Again my intention here is to expand my php knowledge and ultimately be able to build templates that other people can use. I have already worked out how to assemble and hack a template by just styling what is already there which would be totally acceptable but I am not sure how much the end user will need to change and the options they will need. Which does require building on the backend.