/**
 *
 *
 * @param array $category
 */
function writeCategoryOptions($category)
{
    $cdd = new DropdownModule('', '', 'dropdown-category-options', 'dropdown-menu-right');
    $cdd->setTrigger(displayAsSymbol($category['DisplayAs']), 'button', 'btn');
    $cdd->setView('dropdown-twbs');
    $cdd->setForceDivider(true);
    $cdd->addGroup('', 'edit')->addLink(t('View'), $category['Url'], 'edit.view')->addLink(t('Edit'), "/vanilla/settings/editcategory?categoryid={$category['CategoryID']}", 'edit.edit');
    $cdd->addGroup(t('Display as'), 'displayas');
    foreach (CategoryModel::getDisplayAsOptions() as $displayAs => $label) {
        $cssClass = strcasecmp($displayAs, $category['DisplayAs']) === 0 ? 'selected' : '';
        $icon = displayAsSymbol($displayAs);
        $cdd->addLink(t($label), '#', 'displayas.' . strtolower($displayAs), 'js-displayas ' . $cssClass, [], ['icon' => $icon, 'attributes' => ['data-displayas' => strtolower($displayAs)]], false);
    }
    $cdd->addGroup('', 'actions')->addLink(t('Add Subcategory'), "/vanilla/settings/addcategory?parent={$category['CategoryID']}", 'actions.add');
    $cdd->addGroup('', 'delete')->addLink(t('Delete'), "/vanilla/settings/deletecategory?categoryid={$category['CategoryID']}", 'delete.delete', 'js-modal');
    echo $cdd->toString();
}