Hello,
I've been trying and trying but cannot get it to work. I hope someone can give some useful clues here.
I want people to enter calendar events: date, hour, minute, description. Nothing more. So I hide title, alias, publish up, publish down, category.
I have a template override (/templates/MYTEMPLATE/html/com_k2/MYSUBTEMPLATE/itemform.php) to hide all but the few extra fields. As far as I can tell, I have to use this:
And when I have all fields in the $efs array, I do stuff like this:
Then, in /plugins/k2/MYPLUGIN/myplugin.php, function onBeforeK2Save, I only get &$item and $isNew. The $_POST has K2ExtraField_1 etc. How do I get my definition of extra fields here? Or is the order the only way? How can I use something like K2ExtraField_Datum?
If I do that myself, I have to generate the inputs myself completely, making the extra field type useless. And I bet the extra fields will not be filled correctly.
Thanks!
Jerry
I've been trying and trying but cannot get it to work. I hope someone can give some useful clues here.
I want people to enter calendar events: date, hour, minute, description. Nothing more. So I hide title, alias, publish up, publish down, category.
I have a template override (/templates/MYTEMPLATE/html/com_k2/MYSUBTEMPLATE/itemform.php) to hide all but the few extra fields. As far as I can tell, I have to use this:
$efs = array();
foreach ( $this->extraFields as $ef ) {
switch ( $ef->id ) {
case 1:
$efs[ "datum" ] = $ef;
break;
// for all extra fields, I check for the ID to know which field it is
// the name/label might change afterwards so I cannot use that
// pity that when I reinstall this website to production environment,
// the IDs will change
}And when I have all fields in the $efs array, I do stuff like this:
<tr>
<td align="right" class="key">Datum:</td>
<td class="inputbox">
<span id="datum"><?php print $efs[ "datum" ]->element; ?></span>
</td>
</tr>Then, in /plugins/k2/MYPLUGIN/myplugin.php, function onBeforeK2Save, I only get &$item and $isNew. The $_POST has K2ExtraField_1 etc. How do I get my definition of extra fields here? Or is the order the only way? How can I use something like K2ExtraField_Datum?
If I do that myself, I have to generate the inputs myself completely, making the extra field type useless. And I bet the extra fields will not be filled correctly.
Thanks!
Jerry