You are here

function brightcove_field_get_matched_playlists in Brightcove Video Connect 7.3

Same name and namespace in other branches
  1. 7.4 brightcove_field/brightcove_field.playlist.inc \brightcove_field_get_matched_playlists()
  2. 7.5 brightcove_field/brightcove_field.playlist.inc \brightcove_field_get_matched_playlists()

Return the playlists which contain the given string.

Parameters

string $string: String to search for - will match playlists by this text.

boolean $reset: (Optional) If TRUE, then reset the cached playlists.

Return value

array The matching playlists.

2 calls to brightcove_field_get_matched_playlists()
brightcove_field_autocomplete in brightcove_field/brightcove_field.browse.inc
Menu callback for brightcove_field/autocomplete.
brightcove_field_browser_playlist_validate in brightcove_field/brightcove_field.module
Validate callback for the playlist field.

File

brightcove_field/brightcove_field.playlist.inc, line 272
Holds all of the playlist field related methods.

Code

function brightcove_field_get_matched_playlists($string, $reset = FALSE) {
  module_load_include('inc', 'brightcove', 'brightcove.playlist');
  $playlists = brightcove_get_playlists($reset);

  // Search for the matching elements.
  $result = array();
  if (count($playlists)) {
    foreach ($playlists as $playlist) {
      if (strpos($playlist->name, $string) !== FALSE) {
        $result[] = $playlist;
      }
    }
  }
  return $result;
}