scald_views_handler_field_representation.inc in Scald: Media Management made easy 6
Same filename and directory in other branches
Provides a field containing the representation of an atom, in a choosen context.
File
includes/scald_views_handler_field_representation.incView source
<?php
/**
* @file
* Provides a field containing the representation of an atom, in a choosen
* context.
*/
class scald_views_handler_field_representation extends views_handler_field {
/**
* Renders the atom according in the context specified in the option form.
*/
function render($values) {
$sid = $values->{$this->field_alias};
return scald_render($sid, $this->options['context']);
}
/**
* Add a default context to the option definition.
*/
function option_definition() {
$options = parent::option_definition();
$options['context'] = array(
'default' => 'sdl_library_item',
);
return $options;
}
/**
* Allow to choose in which context the atom should be rendered.
*/
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$scald_config = variable_get('scald_config', 0);
foreach ($scald_config->contexts as $name => $context) {
$options[$name] = $name;
}
$form['context'] = array(
'#type' => 'select',
'#title' => t('Context'),
'#default_value' => $this->options['context'],
'#description' => t('The context in which the atom should be rendered.'),
'#options' => $options,
);
}
}
Classes
Name | Description |
---|---|
scald_views_handler_field_representation | @file Provides a field containing the representation of an atom, in a choosen context. |