I’ve created a custom field type in Joomla and need to pass parameters to it. For example, my JForm XML file looks like so:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_gallery/models/fields">
<field name="images"
type="MultiImage"
label="Images"
description=""
imagetable="#__gallery_images"
imagedir="../images/gallery/originals/"
/>
</fieldset>
</form>
And I want to access the imagetable and imagedir attributes within my custom field:
<?php
// No direct access to this file
defined('_JEXEC') or die;
jimport('joomla.form.formfield');
class JFormFieldMultiImage extends JFormField
{
protected $type = 'MultiImage';
public function getInput() {
//this is where i want to access it
$input = $this->imagetable;
return $input;
}
}
I assumed you just used $this->attributename, and when I var_dump($this) I can see the attributes are defined but they are :protected.
I would appreciate some help on this 🙂
Thanks,
Tom
You are so close! Try this and let me know if it works for you, because it works for me. (Joomla 2.5.6)