% show_component_switch = false component_switch_value = false component_map = {"resource" => "archival_object", "digital_object" => "digital_object_component"} if @search_data && @search_data[:criteria].has_key?("type[]") types = @search_data[:criteria]["type[]"] if types.length === 1 if component_map.keys.include?(types[0]) show_component_switch = true component_switch_value = false parent_type = types[0] end elsif types.length === 2 intersection = component_map.keys & types if intersection.length === 1 show_component_switch = true component_switch_value = true parent_type = intersection[0] end end end %> <% if show_component_switch %>