Forums | Mahara Community

Developers /
Checkbox formatting problem


Gregor Anželj's profile picture
Posts: 348

15 June 2009, 6:53 AM

I would like to create a Pieform with multiple checkboxes. Instead of textual title, I would like to have a picture. It seems, it can't be done, so I managed to add the picture to the description. Is there any way that the checkbox and the picture can be at the same row?

Please, see the image of what I've accomplished.

The source code:

'licence_no' => array(
'type' => 'checkbox',
'title' => get_string('nodrivinglicence', 'artefact.europass'),
),
'licence_a1' => array(
'type' => 'checkbox',
'description' => '<img src="' . get_config('wwwroot') . 'images/a1.jpg">',
),

anonymous profile picture
Deleted user
Posts: 1643

15 June 2009, 7:44 PM

Hi,

There's two ways I can think of to do this. One would be a small patch to pieforms, which I think might be a useful addition. The other way would be to use a pieform template.

A pieform template allows you to lay out the form however you like. You write a PHP script that has access to all the elements, and you output whatever HTML you feel like. The wall post form is the only form that does this in Mahara currently, I think. See blocktype/wall/theme/default/pieforms/wallpost.php, and look in the lib.php for that blocktype to see how to include it. It's a little bit undocumented and arcane though - Pieforms renderers normally handle the job for other fields.

So the other solution, and one I'm thinking might be a little better, is to add a flag to Pieforms to say whether a title is HTML escaped or not (which defaults to false). Then you can set it to true for those elements, and thus "trick" pieforms into outputting the image.

If you're able to add such a flag, I'd be happy to merge it upstream. If not, I could find some time to write this support, though it might take a little while Wink

2 results