1.20.x file.install | file_update_1000() |
Add a view for managing files.
File
- modules/
file/ file.install, line 284 - Install, update and uninstall functions for File module.
Code
function file_update_1000() {
$view_config = array(
'name' => 'file_admin',
'description' => 'Administrative listing for managing files.',
'module' => 'file',
'storage' => 4,
'tag' => 'default',
'disabled' => FALSE,
'base_table' => 'file_managed',
'human_name' => 'Administer files',
'core' => '1.6',
'display' => array(
'default' => array(
'display_title' => 'Master',
'display_plugin' => 'default',
'display_options' => array(
'query' => array(
'type' => 'views_query',
'options' => array(),
),
'access' => array(
'type' => 'perm',
'perm' => 'access file overview',
),
'cache' => array(
'type' => 'none',
),
'exposed_form' => array(
'type' => 'basic',
'options' => array(
'submit_button' => 'Filter',
'reset_button' => 0,
'reset_button_label' => 'Reset',
'exposed_sorts_label' => 'Sort by',
'expose_sort_order' => 1,
'sort_asc_label' => 'Asc',
'sort_desc_label' => 'Desc',
'autosubmit' => 0,
'autosubmit_hide' => 1,
),
),
'pager' => array(
'type' => 'full',
'options' => array(
'items_per_page' => '50',
'offset' => '0',
'id' => '0',
'total_pages' => '',
'quantity' => '9',
'tags' => array(
'first' => '« first',
'previous' => '‹ previous',
'next' => 'next ›',
'last' => 'last »',
),
'expose' => array(
'items_per_page' => 0,
'items_per_page_label' => 'Items per page',
'items_per_page_options' => '5, 10, 20, 40, 60',
'items_per_page_options_all' => 0,
'items_per_page_options_all_label' => '- All -',
'offset' => 0,
'offset_label' => 'Offset',
),
),
),
'style_plugin' => 'table',
'row_plugin' => 'fields',
'fields' => array(
'bulk_form' => array(
'id' => 'bulk_form',
'table' => 'file_managed',
'field' => 'bulk_form',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Operations',
'element_label_colon' => 0,
'element_default_classes' => 0,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'include_exclude' => 'exclude',
'selected_actions' => array(),
),
'filename' => array(
'id' => 'filename',
'table' => 'file_managed',
'field' => 'filename',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_file' => 1,
),
'filemime' => array(
'id' => 'filemime',
'table' => 'file_managed',
'field' => 'filemime',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Type',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 1,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'link_to_file' => 0,
'filemime_image' => 0,
),
'timestamp' => array(
'id' => 'timestamp',
'table' => 'file_managed',
'field' => 'timestamp',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Uploaded',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 1,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'date_format' => 'short',
'custom_date_format' => '',
'timezone' => '',
),
'filesize' => array(
'id' => 'filesize',
'table' => 'file_managed',
'field' => 'filesize',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Size',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 1,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'file_size_display' => 'formatted',
),
'status' => array(
'id' => 'status',
'table' => 'file_managed',
'field' => 'status',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Status',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 1,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
),
'count' => array(
'id' => 'count',
'table' => 'file_usage',
'field' => 'count',
'relationship' => 'none',
'group_type' => 'sum',
'ui_name' => '',
'label' => 'Use count',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 1,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'set_precision' => false,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
),
'delete' => array(
'id' => 'delete',
'table' => 'file_managed',
'field' => 'delete',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => '',
'exclude' => 1,
'element_label_colon' => 0,
'element_default_classes' => 0,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'text' => '',
),
'dropbutton' => array(
'id' => 'dropbutton',
'table' => 'views',
'field' => 'dropbutton',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => 'Operations',
'exclude' => 0,
'element_label_colon' => 0,
'element_default_classes' => 0,
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'fields' => array(
'delete' => 'delete',
'bulk_form' => 0,
'filename' => 0,
'filemime' => 0,
'timestamp' => 0,
'filesize' => 0,
'status' => 0,
),
'destination' => 1,
),
),
'filters' => array(
'filename' => array(
'id' => 'filename',
'table' => 'file_managed',
'field' => 'filename',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'operator' => 'contains',
'value' => '',
'group' => '1',
'exposed' => true,
'expose' => array(
'operator_id' => 'filename_op',
'label' => 'File name contains',
'description' => '',
'use_operator' => 0,
'operator' => 'filename_op',
'identifier' => 'filename',
'required' => 0,
'remember' => 0,
'multiple' => false,
'remember_roles' => array(
'authenticated' => 'authenticated',
'anonymous' => 0,
'administrator' => 0,
),
),
'is_grouped' => false,
'group_info' => array(
'label' => '',
'description' => '',
'identifier' => '',
'optional' => true,
'widget' => 'select',
'multiple' => false,
'remember' => 0,
'default_group' => 'All',
'default_group_multiple' => array(),
'group_items' => array(),
),
),
),
'sorts' => array(),
'title' => 'Content',
'empty' => array(
'area' => array(
'id' => 'area',
'table' => 'views',
'field' => 'area',
'relationship' => 'none',
'group_type' => 'group',
'ui_name' => '',
'label' => '',
'empty' => true,
'content' => '<p>No files available.</p>\n',
'format' => 'filtered_html',
'tokenize' => 0,
),
),
'group_by' => 1,
'style_options' => array(
'grouping' => array(),
'row_class' => '',
'default_row_class' => 1,
'row_class_special' => 1,
'override' => 1,
'sticky' => 0,
'caption' => '',
'summary' => '',
'columns' => array(
'bulk_form' => 'bulk_form',
'filename' => 'filename',
'filemime' => 'filemime',
'timestamp' => 'timestamp',
'filesize' => 'filesize',
'status' => 'status',
'count' => 'count',
'delete' => 'delete',
'dropbutton' => 'dropbutton',
),
'info' => array(
'bulk_form' => array(
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'filename' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'filemime' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'timestamp' => array(
'sortable' => 1,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'filesize' => array(
'sortable' => 1,
'default_sort_order' => 'desc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'status' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'count' => array(
'sortable' => 1,
'default_sort_order' => 'desc',
'align' => 'views-align-center',
'separator' => '',
'empty_column' => 0,
),
'delete' => array(
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'dropbutton' => array(
'align' => '',
'separator' => '',
'empty_column' => 0,
),
),
'default' => 'timestamp',
'empty_table' => 1,
),
),
),
'page' => array(
'display_title' => 'Page',
'display_plugin' => 'page',
'display_options' => array(
'query' => array(
'type' => 'views_query',
'options' => array(),
),
'path' => 'admin/content/files',
'menu' => array(
'type' => 'tab',
'title' => 'Manage files',
'description' => 'Find and manage files.',
'name' => 'management',
'weight' => '0',
'context' => 0,
'context_only_inline' => 0,
),
),
),
),
);
$config = config('views.view.file_admin');
if ($config->isNew()) {
$config->setData($view_config);
$config->save();
}
}