function views_plugin_display::unpack_handler

Same name in other branches
  1. 7.x-3.x plugins/views_plugin_display.inc \views_plugin_display::unpack_handler()

Special method to unpack items that have handlers.

This method was specified in the option_definition() as the method to utilize to export fields, filters, sort criteria, relationships and arguments. This passes the export off to the individual handlers so that they can export themselves properly.

File

plugins/views_plugin_display.inc, line 2770

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function unpack_handler(&$translatable, $storage, $option, $definition, $parents) {
    $output = '';
    // cut the 's' off because the data is stored as the plural form but we need
    // the singular form. Who designed that anyway? Oh yeah, I did. :(
    if ($option != 'header' && $option != 'footer' && $option != 'empty') {
        $type = substr($option, 0, -1);
    }
    else {
        $type = $option;
    }
    $types = views_object_types();
    foreach ($storage[$option] as $id => $info) {
        if (!empty($types[$type]['type'])) {
            $handler_type = $types[$type]['type'];
        }
        else {
            $handler_type = $type;
        }
        $handler = views_get_handler($info['table'], $info['field'], $handler_type);
        if ($handler) {
            $handler->init($this->view, $info);
            $handler->unpack_translatables($translatable, array_merge($parents, array(
                $type,
                $info['table'],
                $info['id'],
            )));
        }
        // Prevent reference problems.
        unset($handler);
    }
    return $output;
}