Skip to content

Instantly share code, notes, and snippets.

@chales
Last active December 14, 2015 20:49
Show Gist options
  • Save chales/5146804 to your computer and use it in GitHub Desktop.
Save chales/5146804 to your computer and use it in GitHub Desktop.
Drupal 6 advanced content view. Displays advanced content search info with search options and in a sortable fashion. View is for 6.x-2.x views and requires views bulk operations for manipulations, http://drupal.org/project/views_bulk_operations
$view = new view;
$view->name = 'admin_content';
$view->description = 'Emulates the Drupal content administration page.';
$view->tag = '';
$view->base_table = 'node';
$view->core = 0;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Default', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Title',
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'timestamp' => array(
'label' => 'New?',
'link_to_node' => 0,
'comments' => 0,
'exclude' => 0,
'id' => 'timestamp',
'table' => 'history_user',
'field' => 'timestamp',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'label' => 'Type',
'link_to_node' => 0,
'exclude' => 0,
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'name' => array(
'label' => 'Author',
'link_to_user' => 1,
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'status' => array(
'label' => 'Published',
'type' => 'yes-no',
'not' => 0,
'exclude' => 0,
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'edit_node' => array(
'label' => 'Edit',
'text' => '',
'exclude' => 0,
'id' => 'edit_node',
'table' => 'node',
'field' => 'edit_node',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'changed' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'changed',
'table' => 'node',
'field' => 'changed',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'title' => array(
'operator' => 'contains',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'title_op',
'identifier' => 'title',
'label' => 'Title contains',
'optional' => 1,
'remember' => 0,
),
'case' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'type_op',
'identifier' => 'type',
'label' => 'Type',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'promote' => array(
'operator' => '=',
'value' => 'All',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'promote',
'label' => 'Promoted',
'optional' => 1,
'remember' => 0,
),
'id' => 'promote',
'table' => 'node',
'field' => 'promote',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'status' => array(
'operator' => '=',
'value' => 'All',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'status',
'label' => 'Published',
'optional' => 1,
'remember' => 0,
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'sticky' => array(
'operator' => '=',
'value' => 'All',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'sticky',
'label' => 'Sticky',
'optional' => 1,
'remember' => 0,
),
'id' => 'sticky',
'table' => 'node',
'field' => 'sticky',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'uid' => array(
'operator' => 'in',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 1,
'operator' => 'uid_op',
'identifier' => 'uid',
'label' => 'Author',
'optional' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'administer nodes',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Content');
$handler->override_option('empty', 'There are no objects satisfying the filter settings. Try changing them to get some results.');
$handler->override_option('empty_format', '1');
$handler->override_option('items_per_page', 20);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'bulk');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'timestamp' => 'title',
'type' => 'type',
'name' => 'name',
'status' => 'status',
'edit_node' => 'edit_node',
),
'info' => array(
'title' => array(
'sortable' => 1,
'separator' => ' ',
),
'timestamp' => array(
'separator' => '',
),
'type' => array(
'sortable' => 1,
'separator' => '',
),
'name' => array(
'sortable' => 1,
'separator' => '',
),
'status' => array(
'sortable' => 0,
'separator' => '',
),
'edit_node' => array(
'separator' => '',
),
),
'default' => '-1',
'execution_type' => '1',
'display_type' => '0',
'hide_select_all' => 0,
'display_result' => 1,
'merge_single_action' => 0,
'operations' => array(
'node_assign_owner_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'views_bulk_operations_delete_node_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'views_bulk_operations_script_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_make_sticky_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_make_unsticky_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'views_bulk_operations_fields_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'views_bulk_operations_taxonomy_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_promote_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_publish_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_unpromote_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
'node_unpublish_action' => array(
'selected' => TRUE,
'label' => NULL,
'settings' => NULL,
'skip_confirmation' => 0,
),
),
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'admin/content/node2');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment