function kaltura_populate_nodes in Kaltura 5
Same name and namespace in other branches
- 6.2 plugins/kaltura_playlist/kaltura_playlist.install \kaltura_populate_nodes()
- 6 plugins/kaltura_playlist/kaltura_playlist.install \kaltura_populate_nodes()
1 call to kaltura_populate_nodes()
- kaltura_playlist_install in plugins/
kaltura_playlist/ kaltura_playlist.install - Implementation of hook_install().
File
- plugins/
kaltura_playlist/ kaltura_playlist.install, line 68
Code
function kaltura_populate_nodes() {
if (!module_exists('views')) {
return;
}
include_once 'kaltura_playlist.module';
// get views with _get_relevant_views()
$views = kaltura_get_relevant_views();
$count = 0;
// for each relevant view, build a node object (view title = node title)
foreach ($views as $key => $view) {
$node = new stdClass();
$node->title = str_replace('_', ' ', $view);
$node->type = 'kaltura_playlist';
$node->playlist_view = $key;
$node->promote = 0;
$node->sticky = 0;
$node->status = 1;
$node->uid = 1;
$node->created = time();
$node->changed = time();
// save node
node_save($node);
kaltura_playlist_insert($node);
$count++;
}
// notify user about X nodes created.
drupal_set_message('Kaltura Playlist module has created ' . $count . ' playlist nodes based on your existing views.');
}