1 views_plugin_display_block.inc views_plugin_display_block::get_argument_input()

Adjust the array of argument input to match the current list of arguments available for this display. This ensures that changing the arguments doesn't cause the argument input field to just break.

File

core/modules/views/plugins/views_plugin_display_block.inc, line 441
Contains the block display plugin.

Class

views_plugin_display_block
The plugin that handles a block.

Code

function get_argument_input() {
  $arguments = $this->get_option('argument_input');
  $handlers = $this->get_handlers('argument');

  // We use a separate output to seamlessly discard info for
  // arguments that no longer exist.
  $output = array();

  foreach ($handlers as $id => $handler) {
    if (empty($arguments[$id])) {
      $output[$id] = array(
        'type' => 'none',
        'layout' => '',
        'fixed' => '',
        'name' => $handler->ui_name(),
        'position' => '',
      );
    }
    else {
      $output[$id] = $arguments[$id];
      $output[$id]['name'] = $handler->ui_name();
    }
  }

  return $output;
}