Skip to content

Instantly share code, notes, and snippets.

@dgrammatiko
Created April 7, 2016 20:03
Show Gist options
  • Save dgrammatiko/ec0e2afe879c5d07ffadd2c8a639e1a7 to your computer and use it in GitHub Desktop.
Save dgrammatiko/ec0e2afe879c5d07ffadd2c8a639e1a7 to your computer and use it in GitHub Desktop.
Insert the part from desc.xml to the module/plugin/template xml and create a folder field and copy the file testing.php inside it
<field name="testone" class="" type="testone" default="0"
label="test one"
description="test one" />
<?php
defined('JPATH_BASE') or die;
JFormHelper::loadFieldClass('list');
class JFormFieldTestOne extends JFormFieldList
{
protected $type = 'TestOne';
public function getOptions()
{
$x = array (
0 => array(
'value' => '0',
'text' => 'test',
),
1 => array(
'value' => '1',
'text' => 'test',
),
);
return array_merge(parent::getOptions(), $x);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment