Skip to content

Instantly share code, notes, and snippets.

@rshk
Created November 7, 2012 19:09
Show Gist options
  • Save rshk/4033693 to your computer and use it in GitHub Desktop.
Save rshk/4033693 to your computer and use it in GitHub Desktop.
Drupal Link Sharer
/*******************************************************************************
(C)2010 Samuele ~redShadow~ Santi - http://www.hackzine.org
Under GPL v3
*******************************************************************************/
$content['type'] = array (
'name' => 'Bookmark',
'type' => 'bookmark_link',
'description' => 'A link to an external web resource (bookmark-like).',
'title_label' => 'Title',
'body_label' => 'Description',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => false,
'sticky' => false,
'revision' => false,
),
'language_content_type' => '0',
'upload' => '0',
'creativecommons_lite' => 0,
'ffp_upload' =>
array (
'file_path' => '',
'file_path_cleanup' =>
array (
'file_path_pathauto' => 0,
'file_path_tolower' => 0,
'file_path_transliterate' => 0,
),
'file_name' => '[filefield-onlyname-original].[filefield-extension-original]',
'file_name_cleanup' =>
array (
'file_name_pathauto' => 0,
'file_name_tolower' => 0,
'file_name_transliterate' => 0,
),
'retroactive_update' => '',
'active_updating' => 0,
),
'old_type' => 'bookmark_link',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'image_attach' => '0',
'image_attach_maximum' => 0,
'image_attach_size_teaser' => 'thumbnail',
'image_attach_size_body' => 'thumbnail',
'xmlsitemap_node_type_priority' => '0.2',
'comment' => '0',
'comment_default_mode' => '4',
'comment_default_order' => '1',
'comment_default_per_page' => '50',
'comment_controls' => '3',
'comment_anonymous' => '0',
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '0',
'print_display' => 1,
'print_display_comment' => 0,
'print_display_urllist' => 1,
'print_pdf_display' => 1,
'print_pdf_display_comment' => 0,
'print_pdf_display_urllist' => 1,
'skinr_settings' =>
array (
'comment_group' =>
array (
'fusion_starter' =>
array (
'widgets' =>
array (
'grid-width' =>
array (
),
'fusion-content-alignment' => '',
),
'advanced' =>
array (
'_additional' => '',
'_template' => '',
),
),
'hackzineorange' =>
array (
'advanced' =>
array (
'_additional' => '',
'_template' => '',
),
),
),
'node_group' =>
array (
'fusion_starter' =>
array (
'widgets' =>
array (
'grid-width' =>
array (
),
'fusion-content-alignment' => '',
'fusion-float-imagefield' => '',
),
'advanced' =>
array (
'_additional' => '',
'_template' => '',
),
),
'hackzineorange' =>
array (
'advanced' =>
array (
'_additional' => '',
'_template' => '',
),
),
),
),
);
$content['fields'] = array (
0 =>
array (
'label' => 'URL',
'field_name' => 'field_url',
'type' => 'link',
'widget_type' => 'link',
'change' => 'Change basic information',
'weight' => '-4',
'description' => '',
'default_value' =>
array (
0 =>
array (
'title' => '',
'url' => '',
),
),
'default_value_php' => '',
'default_value_widget' => NULL,
'group' => false,
'required' => 0,
'multiple' => '0',
'url' => 0,
'title' => 'none',
'title_value' => '',
'enable_tokens' => 0,
'display' =>
array (
'url_cutoff' => '80',
),
'attributes' =>
array (
'target' => '_blank',
'rel' => '',
'class' => '',
),
'op' => 'Save field settings',
'module' => 'link',
'widget_module' => 'link',
'columns' =>
array (
'url' =>
array (
'type' => 'varchar',
'length' => 255,
'not null' => false,
'sortable' => true,
),
'title' =>
array (
'type' => 'varchar',
'length' => 255,
'not null' => false,
'sortable' => true,
),
'attributes' =>
array (
'type' => 'text',
'size' => 'medium',
'not null' => false,
),
),
'display_settings' =>
array (
'weight' => '-4',
'parent' => '',
'label' =>
array (
'format' => 'inline',
),
'teaser' =>
array (
'format' => 'default',
'exclude' => 0,
),
'full' =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
2 =>
array (
'format' => 'default',
'exclude' => 0,
),
3 =>
array (
'format' => 'default',
'exclude' => 0,
),
5 =>
array (
'format' => 'default',
'exclude' => 0,
),
'token' =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
);
$content['extra'] = array (
'title' => '-5',
'body_field' => '-3',
'revision_information' => '-1',
'comment_settings' => '2',
'menu' => '-2',
'path' => '0',
'print' => '1',
);
/*******************************************************************************
(C)2010 Samuele ~redShadow~ Santi - http://www.hackzine.org
Under GPL v3
*******************************************************************************/
$view = new view;
$view->name = 'Boolkmarks';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 1,
'text' => '<strong>[title]</strong>',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'body' => array(
'label' => '',
'alter' => array(
'alter_text' => 1,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 1,
'max_length' => '128',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 1,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'relationship' => 'none',
),
'field_url_url' => array(
'label' => '',
'alter' => array(
'alter_text' => 1,
'text' => '<em>[field_url_url]</em>',
'make_link' => 1,
'path' => '[field_url_url]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '_blank',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_url_url',
'table' => 'node_data_field_url',
'field' => 'field_url_url',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'tid' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 1,
'path' => 'bookmarks/[tid-name]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'type' => 'separator',
'separator' => ', ',
'link_to_taxonomy' => 0,
'limit' => 0,
'vids' => array(
'1' => 0,
),
'exclude' => 0,
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'random' => array(
'id' => 'random',
'table' => 'views',
'field' => 'random',
),
'title' => array(
'order' => 'ASC',
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => 'Bookmarks in %1',
'breadcrumb' => '%1',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'none',
'transform_dash' => 1,
'add_table' => 0,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_image_size' => '_original',
'default_argument_php' => '',
'validate_argument_node_type' => array(
'blog' => 0,
'geshinode' => 0,
'image' => 0,
'bookmark_link' => 0,
'docnote' => 0,
'page' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'image_size' => array(
'_original' => '_original',
'thumbnail' => 'thumbnail',
'preview' => 'preview',
),
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'bookmark_link' => 'bookmark_link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'status_extra' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Bookmarks');
$handler->override_option('items_per_page', 5);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('sorts', array(
'changed' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'changed',
'table' => 'node',
'field' => 'changed',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'title' => array(
'order' => 'ASC',
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('items_per_page', 50);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler->override_option('path', 'bookmarks');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Bookmarks',
'description' => '',
'weight' => '0',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view->new_display('block', 'Random Bookmarks', 'block_1');
$handler->override_option('fields', array(
'field_url_url' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '_blank',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 1,
'id' => 'field_url_url',
'table' => 'node_data_field_url',
'field' => 'field_url_url',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 1,
'text' => '<strong>[title]</strong>',
'make_link' => 1,
'path' => '[field_url_url]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'random' => array(
'order' => 'ASC',
'id' => 'random',
'table' => 'views',
'field' => 'random',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Random Bookmarks');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'Blogroll', 'block_2');
$handler->override_option('fields', array(
'field_url_url' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '<em>[field_url_url]</em>',
'make_link' => 0,
'path' => '[field_url_url]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '_blank',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 1,
'id' => 'field_url_url',
'table' => 'node_data_field_url',
'field' => 'field_url_url',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '<strong>[title]</strong>',
'make_link' => 1,
'path' => '[field_url_url]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'bookmark_link' => 'bookmark_link',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'status_extra' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status_extra',
'table' => 'node',
'field' => 'status_extra',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'tid' => array(
'operator' => 'or',
'value' => array(
'0' => '157',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'type' => 'textfield',
'limit' => TRUE,
'vid' => '1',
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 0,
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('title', 'Blogroll');
$handler->override_option('style_plugin', 'list');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment