public function BrightcovePlaylistEntityUIController::overviewForm in Brightcove Video Connect 7.7
Same name and namespace in other branches
- 7.6 brightcove.playlist.inc \BrightcovePlaylistEntityUIController::overviewForm()
Overrides EntityDefaultUIController::overviewForm()
Overrides EntityDefaultUIController::overviewForm
File
- ./
brightcove.playlist.inc, line 157 - Brightcove playlist related functions.
Class
- BrightcovePlaylistEntityUIController
- Entity UI Controller class for brightcove playlists.
Code
public function overviewForm($form, &$form_state) {
$this->form_state = $form_state;
module_load_include('inc', 'brightcove', 'brightcove.client');
$form['bcid'] = brightcove_client_select_element();
$wrapper_id = 'bc-playlists';
if (!isset($form['bcid']['#type'])) {
return $form;
}
switch ($form['bcid']['#type']) {
case 'select':
$form['bcid']['#ajax'] = [
'wrapper' => $wrapper_id,
'callback' => 'brightcove_playlist_tables_ajax_callback',
];
$form['bcid']['#ajax_id'] = 'bc_client_select';
$client_id = filter_input(INPUT_GET, 'client', FILTER_SANITIZE_NUMBER_INT);
if (!empty($client_id) && (!isset($form_state['triggering_element']['#ajax_id']) || isset($form_state['triggering_element']['#ajax_id']) && $form_state['triggering_element']['#ajax_id'] != 'bc_client_select')) {
$bcid = $client_id;
}
else {
$bcid = isset($form_state['values']['bcid']) ? $form_state['values']['bcid'] : $form['bcid']['#default_value'];
}
if (!empty($client_id)) {
$form['bcid']['#default_value'] = $bcid;
}
break;
case 'value':
$bcid = $form['bcid']['#value'];
break;
default:
return $form;
}
$form['playlists'] = [
'#prefix' => '<div id="' . $wrapper_id . '">',
'#suffix' => '</div>',
];
if (!empty($bcid) && $bcid != BRIGHTCOVE_BCID_NONE) {
$client = brightcove_client_load($bcid);
$form['playlists']['#markup'] = $this
->overviewTable([
'client' => $client,
]);
}
return $form;
}