Project:Node Reference/Embed Media Browser (nrembrowser)
Version:6.x-1.0-beta12
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:nrembrowser, video

Issue Summary

In the admin/settings/nrembrowser configuration page, I (the admin) state what content type I want to display as well as a field to reference a thumbnail from. We created a content type Video which is a CCK FileField type. This field type creates its own thumbnails as well as a reference to the video. When the user inserts the value from the nrem browser interface into the rich text field, the value is saved as [[nid]]. The issue we're having: video type doesn't give us a link to launch a url or even a video within the rich text field. We need an active link to the video. How do we accomplish this?

Comments

#1

Bill,

Here is an example of adding a custom style for a filefield and linking to its content directly with a link. This will still give you blank thumbnails in the browser window but there is a snippet #849472: Integrate w/ views comment #4 for using views to make it list something different.

http://img.skitch.com/20101014-msi8dpubd9fycx2mwcdx2ji65e.jpg
http://img.skitch.com/20101014-g7shw7tawgqhgqgksg99f6mada.jpg
http://img.skitch.com/20101014-nk5p8i9ygexk1386ra91dqne1b.jpg

custom_nrembrowser.info

; $Id$
name = Custom nrembrowser
description = Creates a custom video style for the node.
core = 6.x
dependencies[] = nrembrowser

custom_nrembrowser.module

<?php
// $Id$


/**
* @file custom_nrembrowser.module
* Custom Styles and Container registration and definition for nrembrowser.
*/

/**
* Implementation of Styles module hook_styles_register().
*/
function custom_nrembrowser_styles_register() {
  return array(
   
'CustomNrembrowserStyles' => array(
     
'field_types' => 'nodereference',
     
'name' => t('CustomNrembrowserVideo'),
     
'description' => t('nrembrowser desc...'),
     
'path' => drupal_get_path('module', 'custom_nrembrowser') .'/includes',// Path to our custom Styles class.
     
'file' => 'custom_nrembrowser.styles.inc',// Our custom styles class file.
   
),
  );
}

/**
* Adds new styles class so that the video container knows to use the 'CustomNrembrowserStyles' class.
*/
function custom_nrembrowser_styles_default_containers_alter(&$containers) {
 
$containers['nodereference']['containers']['video']['class'] = 'CustomNrembrowserStyles';
}

/**
* Adds custom 'video' style to be used with nrembrowser.
*/
function custom_nrembrowser_styles_default_styles_alter(&$styles) {
 
$styles['nodereference']['styles']['large'] = array(
   
'label' => t('Large'),
   
'description' => t('Render the field as a video or a thumbnail.'),
   
'name' => 'large',
   
'module' => 'custom_nrembrowser', // Otional, as this will automatically be created/overridden by styles.
   
'storage' => 4, // Optional, as this will automatically be created/overridden by styles.
 
);
}

/**
* Implementation of hook_styles_default_presets_alter().
*/
function custom_nrembrowser_styles_default_presets_alter(&$presets) {
 
$presets['nodereference']['containers']['video']['default preset'] = 'large';
 
$presets['nodereference']['containers']['video']['styles']['large']['default preset'] = 'large';
 
$presets['nodereference']['containers']['video']['presets']['large'] = array(
    array(
     
'name' => 'video',// What method to apply to the Styles for the containers(Located within our custom Styles class).
     
'settings' => array(),
    ),
  );
}
?>

includes/custom_nrembrowser.styles.inc

<?php
// $Id$

/**
* @file custom_nrembrowser.styles.inc
* Custom Styles definitions for nrembrowser.
*/
class CustomNrembrowserStyles extends NrembrowserStyles {
  function
video($effect) {
   
$node = $this->set('node', node_load($this->get_nid()));
   
$this->set_output(l(t('Check out the video %title', array('%title' => $node->title)), $node->field_video[0]['filepath'], array('html' => TRUE)));
  }
}
?>

Enjoy!

AttachmentSize
custom_style_nrembrowser.tar_.gz 4.14 KB

#2

Status:active» fixed

Still have questions just re-open this issue.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#4

I was wondering how I can extend this function for the images and audio also?

#5

Status:closed (fixed)» active
nobody click here