├── README
├── help
├── installing-vim.html
└── snippets.help.ini
├── php.snippets
├── snippets.info
└── snippets.module
/README:
--------------------------------------------------------------------------------
1 | /**
2 | * Vim snippets for Drupal 7
3 | */
4 |
5 | - REQUIRED: snipMate for vim: http://www.vim.org/scripts/script.php?script_id=2540
6 | - Included: All 330+ Drupal 7 hooks
7 | - Missing: Other functions
8 |
9 | - Replace the php.snippets file in the ~/.vim/snippets directory with the one included.
10 | - Type hook_HOOKNAME Vim snippets for Drupal 7
8 |
9 |
17 |
13 |
18 | Example 1: h_block_view
20 | /**
21 | * Implements hook_block_view()
22 | */
23 | function test_block_view($delta = '') {
24 | $block = array();
25 |
26 | switch ($delta) {
27 | case '':
28 | $block['subject'] = t('');
29 | $block['content'] = theme('', array('' =>));
30 | break;
31 |
32 | }
33 | return $block;
34 | }
35 |
36 | Example 2: hook_block_view
38 | /**
39 | * Implements hook_block_view()
40 | */
41 | function test_block_view($delta = '') {
42 | $block = array();
43 |
44 | switch ($delta) {
45 | /*
46 | *case 'syndicate':
47 | * $block['subject'] = t('Syndicate');
48 | * $block['content'] = theme('feed_icon', array('url' => url('rss.xml'), 'title' => t('Syndicate')));
49 | * break;
50 | *
51 | *case 'recent':
52 | * if (user_access('access content')) {
53 | * $block['subject'] = t('Recent content');
54 | * if ($nodes = node_get_recent(variable_get('node_recent_block_count', 10))) {
55 | * $block['content'] = theme('node_recent_block', array(
56 | * 'nodes' => $nodes,
57 | * ));
58 | * } else {
59 | * $block['content'] = t('No content available.');
60 | * }
61 | * }
62 | * break;
63 | */
64 | case '':
65 | $block['subject'] = t('');
66 | $block['content'] = theme('', array('' =>));
67 | break;
68 |
69 | }
70 | return $block;
71 | }
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/help/snippets.help.ini:
--------------------------------------------------------------------------------
1 | [installing-vim]
2 | title = Installing snippets for vim
3 | weight = -10
4 |
--------------------------------------------------------------------------------
/snippets.info:
--------------------------------------------------------------------------------
1 | name = Snippets
2 | description = "Snippet files and instructions for installing them on vim"
3 | package = Other
4 |
5 | version = 7.x-1.x-dev
6 | core = 7.x
7 | project = snippets
8 |
9 | files[] = snippets.module
10 |
--------------------------------------------------------------------------------
/snippets.module:
--------------------------------------------------------------------------------
1 | ' . t('Please see the advanced help topic for installing snippets.') . '