-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathphp.snippets
More file actions
9397 lines (9316 loc) · 255 KB
/
php.snippets
File metadata and controls
9397 lines (9316 loc) · 255 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
snippet php
<?php
${1}
?>
snippet ec
echo "${1:string}"${2};
snippet inc
include '${1:file}';${2}
snippet inc1
include_once '${1:file}';${2}
snippet req
require '${1:file}';${2}
snippet req1
require_once '${1:file}';${2}
# $GLOBALS['...']
snippet globals
$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
snippet $_ COOKIE['...']
$_COOKIE['${1:variable}']${2}
snippet $_ ENV['...']
$_ENV['${1:variable}']${2}
snippet $_ FILES['...']
$_FILES['${1:variable}']${2}
snippet $_ Get['...']
$_GET['${1:variable}']${2}
snippet $_ POST['...']
$_POST['${1:variable}']${2}
snippet $_ REQUEST['...']
$_REQUEST['${1:variable}']${2}
snippet $_ SERVER['...']
$_SERVER['${1:variable}']${2}
snippet $_ SESSION['...']
$_SESSION['${1:variable}']${2}
# Start Docblock
snippet /*
/**
* ${1}
**/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @author ${3:`g:snips_author`}
**/${4}
# Class Variable - post doc
snippet doc_vp
/**
* ${1:undocumented class variable}
*
* @var ${2:string}
**/${3}
# Class Variable
snippet doc_v
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
**/
${1:var} $${2};${5}
# Class
snippet doc_c
/**
* ${3:undocumented class}
*
* @packaged ${4:default}
* @author ${5:`g:snips_author`}
**/
${1:}class ${2:}
{${6}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
/**
* ${1:undocumented constant}
**/${2}
# Constant Definition
snippet doc_d
/**
* ${3:undocumented constant}
**/
define(${1}, ${2});${4}
# Function - post doc
snippet doc_fp
/**
* ${1:undocumented function}
*
* @return ${2:void}
* @author ${3:`g:snips_author`}
**/${4}
# Function signature
snippet doc_s
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3});${7}
# Function
snippet doc_f
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3})
{${7}
}
# Header
snippet doc_h
/**
* ${1}
*
* @author ${2:`g:snips_author`}
* @version ${3:$Id$}
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default}
**/
/**
* Define DocBlock
*//
# Interface
snippet doc_i
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
**/
interface ${1:}
{${5}
} // END interface $1
# class ...
snippet class
/**
* ${1}
**/
class ${2:ClassName}
{
${3}
function ${4:__construct}(${5:argument})
{
${6:// code...}
}
}
# define(...)
snippet def
define('${1}'${2});${3}
# defined(...)
snippet def?
${1}defined('${2}')${3}
snippet wh
while (${1:/* condition */}) {
${2:// code...}
}
# do ... while
snippet do
do {
${2:// code... }
} while (${1:/* condition */});
snippet if
if (${1:/* condition */}) {
${2:// code...}
}
snippet ife
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
${4}
snippet else
else {
${1:// code...}
}
snippet elseif
elseif (${1:/* condition */}) {
${2:// code...}
}
# Tertiary conditional
snippet t
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
snippet switch
switch ($${1:variable}) {
case '${2:value}':
${3:// code...}
break;
${5}
default:
${4:// code...}
break;
}
snippet case
case '${1:value}':
${2:// code...}
break;${3}
snippet for
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4: // code...}
}
snippet foreach
foreach ($${1:variable} as $${2:key}) {
${3:// code...}
}
snippet fun
${1:public }function ${2:FunctionName}(${3})
{
${4:// code...}
}
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});${4}
# DRUPAL 7 Hooks
snippet h_simpletest_alter
/**
* Implements hook_simpletest_alter()
*/
function `Filename()`_simpletest_alter(&$groups) {
${1:/* Your code here */}
}
snippet h_test_group_started
/**
* Implements hook_test_group_started()
*/
function `Filename()`_test_group_started() {
${1:/* Your code here */}
}
snippet h_test_group_finished
/**
* Implements hook_test_group_finished()
*/
function `Filename()`_test_group_finished() {
${1:/* Your code here */}
}
snippet h_test_finished
/**
* Implements hook_test_finished()
*/
function `Filename()`_test_finished($results) {
${1:/* Your code here */}
}
snippet h_aggregator_fetch
/**
* Implements hook_aggregator_fetch()
*/
function `Filename()`_aggregator_fetch($feed) {
${1:/* Your code here */}
}
snippet h_aggregator_fetch_info
/**
* Implements hook_aggregator_fetch_info()
*/
function `Filename()`_aggregator_fetch_info() {
return array(
'title' => t('${1}'),
'description' => t('${2}'),
);
}
snippet h_aggregator_parse
/**
* Implements hook_aggregator_parse()
*/
function `Filename()`_aggregator_parse($feed) {
${1:/* Your code here */}
}
snippet h_aggregator_parse_info
/**
* Implements hook_aggregator_parse_info()
*/
function `Filename()`_aggregator_parse_info() {
return array(
'title' => t('${1}'),
'description' => t('${2}'),
);
}
snippet h_aggregator_process
/**
* Implements hook_aggregator_process()
*/
function `Filename()`_aggregator_process($feed) {
${1:/* Your code here */}
}
snippet h_aggregator_process_info
/**
* Implements hook_aggregator_process_info()
*/
function `Filename()`_aggregator_process_info($feed) {
return array(
'title' => t('${1}'),
'description' => t('${2}'),
);
}
snippet h_aggregator_remove
/**
* Implements hook_aggregator_remove()
*/
function `Filename()`_aggregator_remove($feed) {
${1:/* Your code here */}
}
snippet h_overlay_parent_initialize
/**
* Implements hook_overlay_parent_initialize()
*/
function `Filename()`_overlay_parent_initialize() {
${1:/* Your code here */}
}
snippet h_overlay_child_initialize
/**
* Implements hook_overlay_child_initialize()
*/
function `Filename()`_overlay_child_initialize() {
${1:/* Your code here */}
}
snippet h_entity_info
/**
* Implements hook_entity_info()
*/
function `Filename()`_entity_info() {
'node' => array(
'label' => t('${1}'),
'controller class' => '${2}',
'base table' => '${3}',
'revision table' => '${4}',
'uri callback' => '${5}',
'fieldable' => ${6},
'translation' => array(
'locale' => ${7},
),
'entity keys' => array(
'id' => '${8}',
'revision' => '${9}',
'bundle' => '${10}',
),
'bundle keys' => array(
'bundle' => '${11}',
),
'bundles' => array(),
'view modes' => array(
'${12}' => array(
'label' => t('${13}'),
'custom settings' => ${14},
),
),
),
);
return $return;
}
snippet h_entity_info_alter
/**
* Implements hook_entity_info_alter()
*/
function `Filename()`_entity_info_alter(&$entity_info) {
${1:/* Your code here */}
}
snippet h_entity_load
/**
* Implements hook_entity_load()
*/
function `Filename()`_entity_load($entities, $type) {
foreach ($entities as $entity) {
$entity->${1} = mymodule_add_something($entity, $type);
}
}
snippet h_entity_insert
/**
* Implements hook_entity_insert()
*/
function `Filename()`_entity_insert($entity, $type) {
${1:/* Your code here */}
}
snippet h_entity_update
/**
* Implements hook_entity_update()
*/
function `Filename()`_entity_update($entity, $type) {
${1:/* Your code here */}
}
snippet h_entity_query_alter
/**
* Implements hook_entity_query_alter()
*/
function `Filename()`_entity_query_alter($query) {
$query->${1} = 'my_module_query_callback';
}
snippet h_admin_paths
/**
* Implements hook_admin_paths()
*/
function `Filename()`_admin_paths() {
$paths = array(
${1:/* Your code here */}
);
return $paths;
}
snippet h_admin_paths_alter
/**
* Implements hook_admin_paths_alter()
*/
function `Filename()`_admin_paths_alter(&$paths) {
$paths['${1}'] = ${2};
}
snippet h_entity_prepare_view
/**
* Implements hook_entity_prepare_view()
*/
function `Filename()`_entity_prepare_view($entities, $type) {
${1:/* Your code here */}
}
snippet h_cron
/**
* Implements hook_cron()
*/
function `Filename()`_cron() {
${1:/* Your code here */}
}
snippet h_cron_queue_info
/**
* Implements hook_cron_queue_info()
*/
function `Filename()`_cron_queue_info() {
$queues['${1}'] = array(
'worker callback' => '${2}',
'time' => ${3},
);
return $queues;
}
snippet h_cron_queue_info_alter
/**
* Implements hook_cron_queue_info_alter()
*/
function `Filename()`_cron_queue_info_alter(&$queues) {
$queues['${1}']['time'] = ${2};
}
snippet h_element_info
/**
* Implements hook_element_info()
*/
function `Filename()`_element_info() {
$types['${1}'] = array(
${2:/* Your code here */}
);
return $types;
}
snippet h_element_info_alter
/**
* Implements hook_element_info_alter()
*/
function `Filename()`_element_info_alter(&$type) {
if (isset($type['${1}'])) {
$type['${2}'] = ${3};
}
}
snippet h_exit
/**
* Implements hook_exit()
*/
function `Filename()`_exit($destination = NULL) {
${1:/* Your code here */}
}
snippet h_js_alter
/**
* Implements hook_js_alter()
*/
function `Filename()`_js_alter(&$javascript) {
${1:/* Your code here */}
}
snippet h_library
/**
* Implements hook_library()
*/
function `Filename()`_library() {
$libraries['${1}'] = array(
'title' => '${2}',
'website' => '${3}',
'version' => '${4}',
'js' => array(
drupal_get_path('module', 'my_module') . '/${5}' => array(),
),
'css' => array(
drupal_get_path('module', 'my_module') . '/${6}' => array(
'type' => 'file',
'media' => '${7}',
),
),
'dependencies' => array(
array('system', 'ui'),
),
);
return $libraries;
}
snippet h_library_alter
/**
* Implements hook_library_alter()
*/
function `Filename()`_library_alter(&$libraries, $module) {
${1:/* Your code here */}
}
snippet h_css_alter
/**
* Implements hook_css_alter()
*/
function `Filename()`_css_alter(&$css) {
${1:/* Your code here */}
}
snippet h_ajax_render_alter
/**
* Implements hook_ajax_render_alter()
*/
function `Filename()`_ajax_render_alter($commands) {
$commands[] = ${1}
}
snippet h_page_build
/**
* Implements hook_page_build()
*/
function `Filename()`_page_build(&$page) {
$page['${1}']['${2}'] = array(
'#markup' => t('${3}'),
'#weight' => ${4},
);
}
snippet h_menu
/**
* Implements hook_menu()
*/
function `Filename()`_menu() {
$items['${1}'] = array(
'title' => '${2}',
'page callback' => '${3}',
'page arguments' => array('${4}'),
'access arguments' => array('${5}'),
'type' => ${6},
'file' => ${7},
);
return $items;
}
snippet h_menu_alter
/**
* Implements hook_menu_alter()
*/
function `Filename()`_menu_alter(&$items) {
${1:/* Your code here */}
}
snippet h_menu_link_alter
/**
* Implements hook_menu_link_alter()
*/
function `Filename()`_menu_link_alter(&$item) {
${1:/* Your code here */}
}
snippet h_translated_menu_link_alter
/**
* Implements hook_translated_menu_link_alter()
*/
function `Filename()`_translated_menu_link_alter(&$item, $map) {
${1:/* Your code here */}
}
snippet h_menu_link_insert
/**
* Implements hook_menu_link_insert()
*/
function `Filename()`_menu_link_insert($link) {
${1:/* Your code here */}
}
snippet h_menu_link_update
/**
* Implements hook_menu_link_update()
*/
function `Filename()`_menu_link_update($link) {
${1:/* Your code here */}
}
snippet h_menu_link_delete
/**
* Implements hook_menu_link_delete()
*/
function `Filename()`_menu_link_delete($link) {
db_delete('${1}')
->condition('mlid', $link['mlid'])
->execute();
}
snippet h_menu_local_tasks_alter
/**
* Implements hook_menu_local_tasks_alter()
*/
function `Filename()`_menu_local_tasks_alter(&$data, $router_item, $root_path) {
${1:/* Your code here */}
}
snippet h_menu_breadcrumb_alter
/**
* Implements hook_menu_breadcrumb_alter()
*/
function `Filename()`_menu_breadcrumb_alter(&$active_trail, $item) {
${1:/* Your code here */}
}
snippet h_menu_contextual_links_alter
/**
* Implements hook_menu_contextual_links_alter()
*/
function `Filename()`_menu_contextual_links_alter(&$links, $router_item, $root_path) {
if ($root_path == '${1}') {
$links['${2}'] = array(
'title' => t('${3}'),
'href' => '${4}',
'localized_options' => array(
'query' => array(
'${5}' => '${6}',
),
),
);
}
}
snippet h_page_alter
/**
* Implements hook_page_alter()
*/
function `Filename()`_page_alter(&$page) {
${1:/* Your code here */}
}
snippet h_form_alter
/**
* Implements hook_form_alter()
*/
function `Filename()`_form_alter(&$form, &$form_state, $form_id) {
$form['${1}'] = array(
'#type' => '${2}',
'#title' => t('${3}'),
'#default_value' => $settings['${4}'],
'#required' => ${5},
'#element_validate' => array('${6}'),
'#description' => t('${7}'),
'#${8}' => ${9}
);
}
snippet h_forms
/**
* Implements hook_forms()
*/
function `Filename()`_forms($form_id, $args) {
$forms['${1}'] = array(
'callback' => '${2}',
'callback arguments' => array('${3}'),
);
return $forms;
}
snippet h_boot
/**
* Implements hook_boot()
*/
function `Filename()`_boot() {
${1:/* Your code here */}
}
snippet h_init
/**
* Implements hook_init()
*/
function `Filename()`_init() {
${1:/* Your code here */}
}
snippet h_image_toolkits
/**
* Implements hook_image_toolkits()
*/
function `Filename()`_image_toolkits() {
return array(
'${1}' => array(
'title' => t('${2}'),
'available' => TRUE,
),
);
}
snippet h_mail_alter
/**
* Implements hook_mail_alter()
*/
function `Filename()`_mail_alter(&$message) {
if ($message['id'] == '${1}') {
$message['body'][] = "${2}";
}
}
snippet h_module_implements_alter
/**
* Implements hook_module_implements_alter()
*/
function `Filename()`_module_implements_alter(&$implementations, $hook) {
if ($hook == '${1}') {
${2:/* Your code here */}
}
}
snippet h_system_info_alter
/**
* Implements hook_system_info_alter()
*/
function `Filename()`_system_info_alter(&$info, $file, $type) {
${1:/* Your code here */}
}
snippet h_permission
/**
* Implements hook_permission()
*/
function `Filename()`_permission() {
return array(
'${1}' => array(
'title' => t('${2}'),
'description' => t('${3}'),
),
);
}
snippet h_theme
/**
* Implements hook_theme()
*/
function `Filename()`_theme($existing, $type, $theme, $path) {
return array(
'${1}' => array(
'render element' => '${2}',
'file' => '${3}',
'variables' => array('${4}' => NULL, '${5}' => NULL${6}),
),
);
}
snippet h_theme_registry_alter
/**
* Implements hook_theme_registry_alter()
*/
function `Filename()`_theme_registry_alter(&$theme_registry) {
${1:/* Your code here */}
}
snippet h_custom_theme
/**
* Implements hook_custom_theme()
*/
function `Filename()`_custom_theme() {
${1:/* Your code here */}
}
snippet h_xmlrpc
/**
* Implements hook_xmlrpc()
*/
function `Filename()`_xmlrpc() {
${1:/* Your code here */}
}
snippet h_xmlrpc_alter
/**
* Implements hook_xmlrpc_alter()
*/
function `Filename()`_xmlrpc_alter(&$methods) {
${1:/* Your code here */}
}
snippet h_watchdog
/**
* Implements hook_watchdog()
*/
function `Filename()`_watchdog(array $log_entry) {
${1:/* Your code here */}
}
snippet h_mail
/**
* Implements hook_mail()
*/
function `Filename()`_mail($key, &$message, $params) {
${1:/* Your code here */}
}
snippet h_flush_caches
/**
* Implements hook_flush_caches()
*/
function `Filename()`_flush_caches() {
return array('${1}');
}
snippet h_modules_installed
/**
* Implements hook_modules_installed()
*/
function `Filename()`_modules_installed($modules) {
${1:/* Your code here */}
}
snippet h_modules_enabled
/**
* Implements hook_modules_enabled()
*/
function `Filename()`_modules_enabled($modules) {
${1:/* Your code here */}
}
snippet h_modules_disabled
/**
* Implements hook_modules_disabled()
*/
function `Filename()`_modules_disabled($modules) {
${1:/* Your code here */}
}
snippet h_modules_uninstalled
/**
* Implements hook_modules_uninstalled()
*/
function `Filename()`_modules_uninstalled($modules) {
foreach ($modules as $module) {
db_delete('${1}')
->condition('module', $module)
->execute();
}
${2}_cache_rebuild();
}
snippet h_stream_wrappers
/**
* Implements hook_stream_wrappers()
*/
function `Filename()`_stream_wrappers() {
return array(
'${1}' => array(
'name' => t('${2}'),
'class' => '${3}',
'description' => t('${4}'),
),
)
);
}
snippet h_stream_wrappers_alter
/**
* Implements hook_stream_wrappers_alter()
*/
function `Filename()`_stream_wrappers_alter(&$wrappers) {
${1:/* Your code here */}
}
snippet h_file_load
/**
* Implements hook_file_load()
*/
function `Filename()`_file_load($files) {
${1:/* Your code here */}
}
snippet h_file_validate
/**
* Implements hook_file_validate()
*/
function `Filename()`_file_validate(&$file) {
$errors = array();
if (${1}) {
$errors[] = t("${2}");
}
return $errors;
}
snippet h_file_insert
/**
* Implements hook_file_insert()
*/
function `Filename()`_file_insert($file) {
${1:/* Your code here */}
}
snippet h_file_update
/**
* Implements hook_file_update()
*/
function `Filename()`_file_update($file) {
${1:/* Your code here */}
}
snippet h_file_copy
/**
* Implements hook_file_copy()
*/
function `Filename()`_file_copy($file, $source) {
${1:/* Your code here */}
}
snippet h_file_move
/**
* Implements hook_file_move()
*/
function `Filename()`_file_move($file, $source) {
${1:/* Your code here */}
}
snippet h_file_delete
/**
* Implements hook_file_delete()
*/
function `Filename()`_file_delete($file) {
${1:/* Your code here */}
}
snippet h_file_download
/**
* Implements hook_file_download()
*/
function `Filename()`_file_download($uri) {
${1:/* Your code here */}
}
snippet h_file_url_alter
/**
* Implements hook_file_url_alter()
*/
function `Filename()`_file_url_alter(&$uri) {
${1:/* Your code here */}
}
snippet h_requirements
/**
* Implements hook_requirements()
*/
function `Filename()`_requirements($phase) {
$requirements = array();
${1:/* Your code here */}
return $requirements;
}
snippet h_schema
/**
* Implements hook_schema()
*/
function `Filename()`_schema() {
$schema['${1}'] = array(
'description' => '${2}',
'fields' => array(
'${3}' => array(
'description' => '${4}',
'type' => '${5}',
'unsigned' => ${6},
'not null' => ${7},
'default' => ${8}),
),
'indexes' => array(
'${9}' => array('${10}'),
),
'unique keys' => array(
'${11}' => array('${12}')
),
'foreign keys' => array(
'${13}' => array(
'table' => '${14}',
'columns' => array('${15}' => '${16}'),
),
),
'primary key' => array('${17}'),
);
return $schema;
}
snippet h_schema_alter
/**
* Implements hook_schema_alter()
*/
function `Filename()`_schema_alter(&$schema) {
${1:/* Your code here */}
}
snippet h_query_alter
/**
* Implements hook_query_alter()
*/
function `Filename()`_query_alter(QueryAlterableInterface $query) {
if ($query->hasTag('${1}')) {
${2:/* Your code here */}
}
}
snippet h_install
/**
* Implements hook_install()
*/
function `Filename()`_install() {
${1:/* Your code here */}
}
snippet h_update_dependencies
/**
* Implements hook_update_dependencies()
*/
function `Filename()`_update_dependencies() {
$dependencies['${1}']['${2}'] = array(
'${3}' => ${4},
);
return $dependencies;
}
snippet h_update_last_removed
/**
* Implements hook_update_last_removed()
*/
function `Filename()`_update_last_removed() {
${1:/* Your code here */}
}
snippet h_uninstall
/**
* Implements hook_uninstall()
*/
function `Filename()`_uninstall() {
variable_del('${1}');
}
snippet h_enable
/**
* Implements hook_enable()
*/
function `Filename()`_enable() {
${1:/* Your code here */}
}
snippet h_disable
/**
* Implements hook_disable()
*/
function `Filename()`_disable() {
${1:/* Your code here */}
}