Adding "Latest videos" to Widget Manager Custom Index

I want to add a "Latest videos" widget on widget manager custom index. Problem is that I managed to create the widget but it does not display any latest videos. The videos plugin I'm using is Webgalli's "videos"

What I did was to create "index_videos" folder in widget_manager\widgets\ and then a "start.php" file in \widget_manager\widgets\index_videos. The content of the \widget_manager\widgets\index_videos\start.php file is the following:

 

<?php
/* init file for index_videos widget */

function widget_index_videos_init(){
if(elgg_is_active_plugin("videos")){
elgg_register_widget_type("index_videos", elgg_echo("videos"), elgg_echo("widget_manager:widgets:index_videos:description"), "index", true);
elgg_register_plugin_hook_handler('widget_url', 'widget_manager', "widget_index_videos_url");
}
}

function widget_index_videos_url($hook_name, $entity_type, $return_value, $params){
$result = $return_value;
$widget = $params["entity"];
if(empty($result) && ($widget instanceof ElggWidget) && $widget->handler == "index_videos"){
$result = "/videos/all";
}
return $result;
}

elgg_register_event_handler("widgets_init", "widget_manager", "widget_index_videos_init");

 

In fact what I did was to copy paste the index_bookmards folder and its start.php file and replace "bookmarks" with "videos". The result is that a videos widget appears on the widget selection screen but when selected it does not display the latest videos.

Any help would be appreciated!

 

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking