<?php
function expose_plugin_html_checkboxes( & $expose, $params )
{
$params = exposeMergeParameters( $params, array(
'name' => '',
'options' => array(),
'selected' => array(),
'attr' => '',
'separator' => ''
) );
$params['options'] = exposeReadArray( $params['options'] );
$params['selected'] = exposeReadArray( $params['selected'] );
$count = count( $params['options'] );
$i = 0;
foreach( $params['options'] as $key => $value )
{
if( is_array( $value ) ) {
$key = $value[0];
$value = $value[1];
}
$checkState = in_array( $key, $params['selected'] ) ? 'checked="checked"' : '';
echo( "<label><input name=\"{$params['name']}[$key]\" value=\"$key\" type=\"checkbox\" {$params['attr']} $checkState/>$value</label>" );
if( ++$i < $count ) {
echo( $params['separator'] );
}
}
}
?>
|