'Render optional additional filter form controls: advanced
options toggle, clear filters.'

def _render_controls(self, resource):

    T = current.T
    controls = []
    opts = self.opts
    advanced = opts.get('advanced', False)
    if advanced:
        _class = 'filter-advanced'
        if (advanced is True):
            label = T('More    Options')
        elif isinstance(advanced, (list, tuple)):
            label = advanced[0]
            label = advanced[1]
            if len((advanced > 2)):
                _class = ('%s    %s' % (advanced[2], _class))
        else:
            label = advanced
        label_off = T('Less    Options')
        advanced = A(SPAN(label, data={'on': label, 'off': label_off}, _class='filter-advanced-label'), ICON('down'), ICON('up', _style='display:none'), _class=_class)
        controls.append(advanced)
    clear = opts.get('clear', True)
    if clear:
        _class = 'filter-clear'
        if (clear is True):
            label = T('Clear    Filter')
        elif isinstance(clear, (list, tuple)):
            label = clear[0]
            _class = ('%s    %s' % (clear[1], _class))
        else:
            label = clear
        clear = A(label, _class=_class)
        clear.add_class('action-lnk')
        controls.append(clear)
    fm = current.deployment_settings.get_search_filter_manager()
    if (fm and opts.get('filter_manager', (resource is not None))):
        show_fm = A(T('Saved    Filters'), _class='show-filter-manager    action-lnk')
        controls.append(show_fm)
    if controls:
        return DIV(controls, _class='filter-controls')
    else:
        return None
