function views_db_object::add_item

Add an item with a handler to the view.

These items may be fields, filters, sort criteria, or arguments.

1 call to views_db_object::add_item()
view::fix_missing_relationships in includes/view.inc
Attempt to discover if the view has handlers missing relationships.

File

includes/view.inc, line 2539

Class

views_db_object
Base class for views' database objects.

Code

public function add_item($display_id, $type, $table, $field, $options = array(), $id = NULL) {
    $types = views_object_types();
    $this->set_display($display_id);
    $fields = $this->display[$display_id]->handler
        ->get_option($types[$type]['plural']);
    if (empty($id)) {
        $id = $this->generate_item_id($field, $fields);
    }
    $new_item = array(
        'id' => $id,
        'table' => $table,
        'field' => $field,
    ) + $options;
    $fields[$id] = $new_item;
    $this->display[$display_id]->handler
        ->set_option($types[$type]['plural'], $fields);
    return $id;
}