function upload_views_data

Implementation of hook_views_data()

Related topics

File

modules/upload.views.inc, line 18

Code

function upload_views_data() {
    $data = array();
    // ----------------------------------------------------------------------
    // upload table
    $data['upload']['table']['group'] = t('Upload');
    $data['upload']['table']['join'] = array(
        'node' => array(
            'left_field' => 'vid',
            'field' => 'vid',
        ),
        'node_revisions' => array(
            'left_field' => 'vid',
            'field' => 'vid',
        ),
        'files' => array(
            'left_field' => 'fid',
            'field' => 'fid',
        ),
    );
    $data['upload']['vid'] = array(
        'title' => t('Node'),
        'help' => t('The node the uploaded file is attached to'),
        'relationship' => array(
            'label' => t('upload'),
            'base' => 'node',
            'base field' => 'vid',
            // This allows us to not show this relationship if the base is already
            // node so users won't create circular relationships.
'skip base' => array(
                'node',
                'node_revisions',
            ),
        ),
    );
    $data['upload']['description'] = array(
        'title' => t('Description'),
        'help' => t('The description of the uploaded file.'),
        'field' => array(
            'handler' => 'views_handler_field_upload_description',
            'click sortable' => TRUE,
        ),
        'sort' => array(
            'handler' => 'views_handler_sort',
        ),
        'filter' => array(
            'handler' => 'views_handler_filter_string',
        ),
        'argument' => array(
            'handler' => 'views_handler_argument_string',
        ),
    );
    $data['upload']['list'] = array(
        'title' => t('Listed'),
        'help' => t('Whether or not the file is marked to be listed.'),
        'field' => array(
            'handler' => 'views_handler_field_boolean',
            'click sortable' => TRUE,
        ),
        'filter' => array(
            'handler' => 'views_handler_filter_boolean_operator',
            'label' => t('Published'),
            'type' => 'yes-no',
        ),
        'sort' => array(
            'handler' => 'views_handler_sort',
        ),
    );
    $data['upload']['weight'] = array(
        'title' => t('Weight'),
        'help' => t('The weight, used for sorting.'),
        'field' => array(
            'handler' => 'views_handler_field_numeric',
            'click sortable' => TRUE,
        ),
        'sort' => array(
            'handler' => 'views_handler_sort',
        ),
        'filter' => array(
            'handler' => 'views_handler_filter_numeric',
        ),
    );
    return $data;
}