class scald_views_handler_field_representation in Scald: Media Management made easy 6
Same name and namespace in other branches
- 7 includes/scald_views_handler_field_representation.inc \scald_views_handler_field_representation
@file Provides a field containing the representation of an atom, in a choosen context.
Hierarchy
- class \scald_views_handler_field_representation extends \views_handler_field
Expanded class hierarchy of scald_views_handler_field_representation
1 string reference to 'scald_views_handler_field_representation'
- scald_views_data in includes/
scald.views.inc - @file Provides support for the Views module.
File
- includes/
scald_views_handler_field_representation.inc, line 7 - Provides a field containing the representation of an atom, in a choosen context.
View source
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,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
scald_views_handler_field_representation:: |
function | Allow to choose in which context the atom should be rendered. | ||
scald_views_handler_field_representation:: |
function | Add a default context to the option definition. | ||
scald_views_handler_field_representation:: |
function | Renders the atom according in the context specified in the option form. |