function itoggle_views_handler_field::init in iToggle 7.2
Same name and namespace in other branches
- 7 modules/views/itoggle_views_handler.inc \itoggle_views_handler_field::init()
Init the handler with necessary data.
Parameters
view $view: The $view object this handler is attached to.
array $options: The item from the database; the actual contents of this will vary based upon the type of handler.
Overrides views_handler_field::init
File
- modules/
views/ itoggle_views_handler_field.inc, line 16 - Views field handler for iToggle Views.
Class
- itoggle_views_handler_field
- A handler to provide a custom field for iToggle.
Code
function init(&$view, &$options) {
// Find out the field name (ie what entity type and what property).
$field_name = str_replace('itoggle-', '', $options['id']);
list($type, $property) = explode('-', $field_name);
// Trim suffix if multiple widgets in view.
list($property) = explode('_', $property);
$entity_info = entity_get_info($type);
// Store information in instance.
$this->_itoggle = array(
'id' => $entity_info['entity keys']['id'],
'type' => $type,
'property' => $property,
);
// Add id as additional field.
$this->additional_fields[$this->_itoggle['id']] = $this->_itoggle['id'];
parent::init($view, $options);
}