/**
* Displays a single category checkbox.
*/
public static function display_category_checkbox($category, $selected_categories, $form_field, $enable_parents = FALSE)
{
$html = '';
$cid = $category->id;
// Get locale
$l = Kohana::config('locale.language.0');
$category_title = Category_Lang_Model::category_title($cid, $l);
//$category_title = $category->category_title;
$category_color = $category->category_color;
// Category is selected.
$category_checked = in_array($cid, $selected_categories);
// Visible Child Count
$vis_child_count = 0;
foreach ($category->children as $child) {
$child_visible = $child->category_visible;
if ($child_visible) {
// Increment Visible Child count
++$vis_child_count;
}
}
$disabled = "";
if (!$enable_parents and $category->children->count() > 0 and $vis_child_count > 0) {
$disabled = " disabled=\"disabled\"";
}
$html .= form::checkbox($form_field . '[]', $cid, $category_checked, ' class="check-box"' . $disabled);
$html .= $category_title;
return $html;
}