You are here

function bynder_selected_facets in Bynder 7

Return selected facets.

1 call to bynder_selected_facets()
bynder_generate_search in includes/bynder.browser.inc
Generate search page.

File

includes/bynder.browser.inc, line 375
Manages the Bynder media browser functionality

Code

function bynder_selected_facets($state) {
  $selected_facets = array();
  if (isset($state['values']['search'])) {
    $selected_facets = array_merge($selected_facets, array(
      "keyword" => (array) $state['values']['search'],
    ));
  }
  if (isset($state['values']['filters'])) {
    $filters_json = json_decode($state['values']['filters']);
    $filters = $filters_json->filters;
    foreach ($filters as $filter) {
      $selected_facets = array_merge($selected_facets, array(
        $filter->key => $filter->value,
      ));
    }
  }
  return $selected_facets;
}