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
|
<?php
// $Id$
/**
* @ingroup field_fieldable_type
* @{
*/
/**
* Inform the Field API about one or more fieldable types.
*
* Inform the Field API about one or more fieldable types, (object
* types to which fields can be attached).
*
* @return
* An array whose keys are fieldable object type names and
* whose values identify properties of those types that the Field
* system needs to know about:
*
* name: The human-readable name of the type.
* id key: The object property that contains the primary id for the
* object. Every object passed to the Field API must
* have this property and its value must be numeric.
* revision key: The object property that contains the revision id
* for the object, or NULL if the object type is not
* versioned. The Field API assumes that all revision ids are
* unique across all instances of a type; this means, for example,
* that every object's revision ids cannot be 0, 1, 2, ...
* bundle key: The object property that contains the bundle name for
* the object (bundle name is what nodes call "content type").
* The bundle name defines which fields are connected to the object.
* cacheable: A boolean indicating whether Field API should cache
* loaded fields for each object, reducing the cost of
* field_attach_load().
* bundles: An array of all existing bundle names for this object
* type. TODO: Define format. TODO: I'm unclear why we need
* this.
*/
function hook_fieldable_info() {
$return = array(
'node' => array(
'name' => t('Node'),
'id key' => 'nid',
'revision key' => 'vid',
'bundle key' => 'type',
// Node.module handles its own caching.
'cacheable' => FALSE,
// Bundles must provide human readable name so
// we can create help and error messages about them.
'bundles' => node_type_get_names(),
),
);
return $return;
}
/**
* @} End of "ingroup field_fieldable_type"
*/
/**
* @defgroup field_types Field Types API
* @{
* Define field types, widget types, and display formatter types.
*
* The bulk of the Field Types API are related to field types. A
* field type represents a particular data storage type (integer,
* string, date, etc.) that can be attached to a fieldable object.
* hook_field_info() defines the basic properties of a field type, and
* a variety of other field hooks are called by the Field Attach API
* to perform field-type-specific actions.
*
* The Field Types API also defines widget types via
* hook_field_widget_info(). Widgets are Form API elements with
* additional processing capabilities. A field module can define
* widgets that work with its own field types or with any other
* module's field types. Widget hooks are typically called by the
* Field Attach API when creating the field form elements during
* field_attach_form().
*
* TODO Display formatters.
*/
/**
* Define Field API field types.
*
* @return
* An array whose keys are field type names and whose values are:
*
* label: TODO
* description: TODO
* settings: TODO
* instance_settings: TODO
* default_widget: TODO
* default_formatter: TODO
* behaviors: TODO
*/
function hook_field_info() {
return array(
'text' => array(
'label' => t('Text'),
'description' => t('This field stores varchar text in the database.'),
'settings' => array('max_length' => 255),
'instance_settings' => array('text_processing' => 0),
'default_widget' => 'text_textfield',
'default_formatter' => 'text_default',
),
'textarea' => array(
'label' => t('Textarea'),
'description' => t('This field stores long text in the database.'),
'instance_settings' => array('text_processing' => 0),
'default_widget' => 'text_textarea',
'default_formatter' => 'text_default',
),
);
}
/**
* Define the Field API schema for a field structure.
*
* @param $field
* A field structure.
* @return
* An associative array with the following keys:
* - 'columns': an array of Schema API column specifications, keyed by
* column name. This specifies what comprises a value for a given field.
* For example, a value for a number field is simply 'value', while a
* value for a formatted text field is the combination of 'value' and
* 'format'.
* It is recommended to avoid having the columns definitions depend on
* field settings when possible.
* No assumptions should be made on how storage engines internally use the
* original column name to structure their storage.
* - 'indexes': an array of Schema API indexes definitions. Only columns that
* appear in the 'columns' array are allowed.
* Those indexes will be used as default indexes. Callers of
* field_create_field() can specify additional indexes, or, at their own
* risk, modify the default indexes specified by the field-type module.
* Some storage engines might not support indexes.
*/
function hook_field_schema($field) {
if ($field['type'] == 'text_long') {
$columns = array(
'value' => array(
'type' => 'text',
'size' => 'big',
'not null' => FALSE,
),
);
}
else {
$columns = array(
'value' => array(
'type' => 'varchar',
'length' => $field['settings']['max_length'],
'not null' => FALSE,
),
);
}
$columns += array(
'format' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
);
return array(
'columns' => $columns,
'indexes' => array(
'format' => array('format'),
),
);
}
/**
* Define Field API widget types.
*
* @return
* An array whose keys are field type names and whose values are:
*
* label: TODO
* description: TODO
* field types: TODO
* settings: TODO
* behaviors: TODO
*/
function hook_field_widget_info() {
}
/*
* Define Field API formatter types.
*
* @return
* An array whose keys are field type names and whose values are:
*
* label: TODO
* description: TODO
* field types: TODO
* behaviors: TODO
*/
function hook_field_formatter_info() {
}
/**
* Define custom load behavior for this module's field types.
*
* Unlike other field hooks, this hook operates on multiple objects. The
* $objects, $instances and $items parameters are arrays keyed by object id.
* For performance reasons, information for all available objects should be
* loaded in a single query where possible.
*
* Note that the changes made to the field values get cached by the
* field cache for subsequent loads.
*
* @param $obj_type
* The type of $object.
* @param $objects
* Array of objects being loaded, keyed by object id.
* @param $field
* The field structure for the operation.
* @param $instances
* Array of instance structures for $field for each object, keyed by object id.
* @param $items
* Array of field values already loaded for the objects, keyed by object id.
* @param $age
* FIELD_LOAD_CURRENT to load the most recent revision for all fields, or
* FIELD_LOAD_REVISION to load the version indicated by each object.
* @return
* Changes or additions to field values are done by altering the $items
* parameter by reference.
*/
function hook_field_load($obj_type, $objects, $field, $instances, &$items, $age) {
}
/**
* Define custom validate behavior for this module's field types.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
* @param $errors
* The array of errors, keyed by field name and by value delta, that have
* already been reported for the object. The function should add its errors
* to this array. Each error is an associative array, with the following
* keys and values:
* - 'error': an error code (should be a string, prefixed with the module name)
* - 'message': the human readable message to be displayed.
*/
function hook_field_validate($obj_type, $object, $field, $instance, $items, &$errors) {
foreach ($items as $delta => $item) {
if (!empty($item['value'])) {
if (!empty($field['settings']['max_length']) && drupal_strlen($item['value']) > $field['settings']['max_length']) {
$errors[$field['field_name']][$delta][] = array(
'error' => 'text_max_length',
'message' => t('%name: the value may not be longer than %max characters.', array('%name' => $instance['label'], '%max' => $field['settings']['max_length'])),
);
}
}
}
}
/**
* Define custom presave behavior for this module's field types.
*
* TODO: The behavior of this hook is going to change (see
* field_attach_presave()).
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_presave($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom insert behavior for this module's field types.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_insert($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom update behavior for this module's field types.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_update($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom delete behavior for this module's field types.
*
* This hook is invoked just before the data is deleted from field storage.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_delete($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom delete_revision behavior for this module's field types.
*
* This hook is invoked just before the data is deleted from field storage,
* and will only be called for fieldable types that are versioned.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_delete_revision($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom sanitize behavior for this module's field types.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_sanitize($obj_type, $object, $field, $instance, $items) {
}
/**
* Define custom prepare_translation behavior for this module's field types.
*
* TODO: This hook may or may not survive in Field API.
*
* @param $obj_type
* The type of $object.
* @param $object
* The object for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
* The instance structure for $field on $object's bundle.
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
function hook_field_prepare_translation($obj_type, $object, $field, $instance, $items) {
}
/**
* Return a single form element for a form.
*
* It will be built out and validated in the callback(s) listed in
* hook_elements. We build it out in the callbacks rather than in
* hook_field_widget so it can be plugged into any module that can
* provide it with valid $field information.
*
* Field API will set the weight, field name and delta values for each
* form element. If there are multiple values for this field, the
* Field API will call this function as many times as needed.
*
* @param $form
* The entire form array, $form['#node'] holds node information.
* TODO: Not #node any more.
* @param $form_state
* The form_state, $form_state['values'][$field['field_name']]
* holds the field's form values.
* @param $field
* The field structure.
* @param $instance
* The field instance.
* @param $items
* Array of default values for this field.
* @param $delta
* The order of this item in the array of subelements (0, 1, 2, etc).
* @return
* The form item for a single element for this field.
*/
function hook_field_widget(&$form, &$form_state, $field, $instance, $items, $delta = 0) {
$element = array(
'#type' => $instance['widget']['type'],
'#default_value' => isset($items[$delta]) ? $items[$delta] : '',
);
return $element;
}
/**
* Flag a field-level validation error.
*
* @param $element
* An array containing the form element for the widget. The error needs to be
* flagged on the right sub-element, according to the widget's internal
* structure.
* @param $error
* An associative array with the following key-value pairs, as returned by
* hook_field_validate():
* - 'error': the error code. Complex widgets might need to report different
* errors to different form elements inside the widget.
* - 'message': the human readable message to be displayed.
*/
function hook_field_widget_error($element, $error) {
form_error($element['value'], $error['message']);
}
/**
* @} End of "ingroup field_type"
*/
/**
* @ingroup field_attach
* @{
*/
/**
* Act on field_attach_form.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_form() for details and arguments.
*/
function hook_field_attach_form($obj_type, $object, &$form, &$form_state) {
}
/**
* Act on field_attach_pre_load.
*
* This hook allows modules to load data before the Field Storage API,
* optionally preventing the field storage module from doing so.
*
* This lets 3rd party modules override, mirror, shard, or otherwise store a
* subset of fields in a different way than the current storage engine.
* Possible use cases include : per-bundle storage, per-combo-field storage...
*
* @param $obj_type
* The type of objects for which to load fields; e.g. 'node' or 'user'.
* @param $objects
* An array of objects for which to load fields, keyed by object id.
* @param $age
* FIELD_LOAD_CURRENT to load the most recent revision for all fields, or
* FIELD_LOAD_REVISION to load the version indicated by each object.
* @param $skip_fields
* An array keyed by names of fields whose data has already been loaded and
* therefore should not be loaded again. The values associated to these keys
* are not specified.
* @return
* - Loaded field values are added to $objects. Fields with no values should be
* set as an empty array.
* - Loaded field names are set as keys in $skip_fields.
*/
function hook_field_attach_pre_load($obj_type, $objects, $age, &$skip_fields) {
}
/**
* Act on field_attach_load.
*
* This hook is invoked after the field module has performed the operation.
*
* Unlike other field_attach hooks, this hook accounts for 'multiple loads'.
* It takes an array of objects indexed by object id as its first parameter.
* For performance reasons, information for all available objects should be
* loaded in a single query where possible.
*
* Note that the changes made to the objects' field values get cached by the
* field cache for subsequent loads.
*
* See field_attach_load() for details and arguments.
*/
function hook_field_attach_load($obj_type, $objects, $age) {
}
/**
* Act on field_attach_validate.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_validate() for details and arguments.
*/
function hook_field_attach_validate($obj_type, $object, &$errors) {
}
/**
* Act on field_attach_submit.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_submit() for details and arguments.
*/
function hook_field_attach_submit($obj_type, $object, $form, &$form_state) {
}
/**
* Act on field_attach_presave.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_presave() for details and arguments.
*/
function hook_field_attach_presave($obj_type, $object) {
}
/**
* Act on field_attach_insert.
*
* This hook allows modules to store data before the Field Storage
* API, optionally preventing the field storage module from doing so.
*
* @param $obj_type
* The type of $object; e.g. 'node' or 'user'.
* @param $object
* The object with fields to save.
* @param $skip_fields
* An array keyed by names of fields whose data has already been written and
* therefore should not be written again. The values associated to these keys
* are not specified.
* @return
* Saved field names are set set as keys in $skip_fields.
*/
function hook_field_attach_pre_insert($obj_type, $object, &$skip_fields) {
}
/**
* Act on field_attach_update.
*
* This hook allows modules to store data before the Field Storage
* API, optionally preventing the field storage module from doing so.
*
* @param $obj_type
* The type of $object; e.g. 'node' or 'user'.
* @param $object
* The object with fields to save.
* @param $skip_fields
* An array keyed by names of fields whose data has already been written and
* therefore should not be written again. The values associated to these keys
* are not specified.
* @return
* Saved field names are set set as keys in $skip_fields.
*/
function hook_field_attach_pre_update($obj_type, $object, &$skip_fields) {
}
/**
* Act on field_attach_delete.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_delete() for details and arguments.
*/
function hook_field_attach_delete($obj_type, $object) {
}
/**
* Act on field_attach_delete_revision.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_delete_revision() for details and arguments.
*/
function hook_field_attach_delete_revision($obj_type, $object) {
}
/**
* Act on field_attach_view.
*
* This hook is invoked after the field module has performed the operation.
*
* @param $output
* The structured content array tree for all of $object's fields.
* @param $obj_type
* The type of $object; e.g. 'node' or 'user'.
* @param $object
* The object with fields to render.
* @param $teaser
* Whether to display the teaser only, as on the main page.
*/
function hook_field_attach_view_alter($output, $obj_type, $object, $teaser) {
}
/**
* Act on field_attach_create_bundle.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_create_bundle() for details and arguments.
*/
function hook_field_attach_create_bundle($bundle) {
}
/**
* Act on field_attach_rename_bundle.
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_rename_bundle() for details and arguments.
*/
function hook_field_rename_bundle($bundle_old, $bundle_new) {
}
/**
* Act on field_attach_delete_bundle.
*
* This hook is invoked after the field module has performed the operation.
*
* @param $bundle
* The bundle that was just deleted.
* @param $instances
* An array of all instances that existed for $bundle before it was
* deleted.
*/
function hook_field_attach_delete_bundle($bundle, $instances) {
}
/**
* @} End of "ingroup field_attach"
*/
/**********************************************************************
* Field Storage API
**********************************************************************/
/**
* @ingroup field_storage
* @{
*/
/**
* Load field data for a set of objects.
*
* @param $obj_type
* The entity type of object, such as 'node' or 'user'.
* @param $objects
* The array of objects for which to load data, keyed by object id.
* @param $age
* FIELD_LOAD_CURRENT to load the most recent revision for all
* fields, or FIELD_LOAD_REVISION to load the version indicated by
* each object.
* @param $skip_fields
* An array keyed by names of fields whose data has already been loaded and
* therefore should not be loaded again. The values associated to these keys
* are not specified.
* @return
* Loaded field values are added to $objects. Fields with no values should be
* set as an empty array.
*/
function hook_field_storage_load($obj_type, $objects, $age, $skip_fields) {
}
/**
* Write field data for an object.
*
* @param $obj_type
* The entity type of object, such as 'node' or 'user'.
* @param $object
* The object on which to operate.
* @param $op
* FIELD_STORAGE_UPDATE when updating an existing object,
* FIELD_STORAGE_INSERT when inserting a new object.
* @param $skip_fields
* An array keyed by names of fields whose data has already been written and
* therefore should not be written again. The values associated to these keys
* are not specified.
*/
function hook_field_storage_write($obj_type, $object, $op, $skip_fields) {
}
/**
* Delete all field data for an object.
*
* @param $obj_type
* The entity type of object, such as 'node' or 'user'.
* @param $object
* The object on which to operate.
*/
function hook_field_storage_delete($obj_type, $object) {
}
/**
* Delete a single revision of field data for an object.
*
* Deleting the current (most recently written) revision is not
* allowed as has undefined results.
*
* @param $obj_type
* The entity type of object, such as 'node' or 'user'.
* @param $object
* The object on which to operate. The revision to delete is
* indicated by the object's revision id property, as identified by
* hook_fieldable_info() for $obj_type.
*/
function hook_field_storage_delete_revision($obj_type, $object) {
}
/**
* Act on creation of a new bundle.
*
* @param $bundle
* The name of the bundle being created.
*/
function hook_field_storage_create_bundle($bundle) {
}
/**
* Act on a bundle being renamed.
*
* @param $bundle_old
* The old name of the bundle.
* @param $bundle_new
* The new name of the bundle.
*/
function hook_field_storage_rename_bundle($bundle_old, $bundle_new) {
}
/**
* Act on creation of a new field.
*
* @param $field
* The field structure being created.
*/
function hook_field_storage_create_field($field) {
}
/**
* Act on deletion of a field.
*
* @param $field_name
* The name of the field being deleted.
*/
function hook_field_storage_delete_field($field_name) {
}
/**
* Act on deletion of a field instance.
*
* @param $field_name
* The name of the field in the new instance.
* @param $bundle
* The name of the bundle in the new instance.
*/
function hook_field_storage_delete_instance($field_name, $bundle) {
}
/**
* @} End of "ingroup field_storage"
*/
/**********************************************************************
* Field CRUD API
**********************************************************************/
/**
* @ingroup field_crud
* @{
*/
/**
* Act on a field being created.
*
* This hook is invoked after the field is created and so it cannot modify the
* field itself.
*
* TODO: Not implemented.
*
* @param $field
* The field just created.
*/
function hook_field_create_field($field) {
}
/**
* Act on a field instance being created.
*
* This hook is invoked after the instance record is saved and so it cannot
* modify the instance itself.
*
* @param $instance
* The instance just created.
*/
function hook_field_create_instance($instance) {
}
/**
* Act on a field being deleted.
*
* This hook is invoked just before the field is deleted.
*
* TODO: Not implemented.
*
* @param $field
* The field being deleted.
*/
function hook_field_delete_field($field) {
}
/**
* Act on a field instance being updated.
*
* This hook is invoked after the instance record is saved and so it cannot
* modify the instance itself.
*
* TODO: Not implemented.
*
* @param $instance
* The instance just updated.
*/
function hook_field_update_instance($instance) {
}
/**
* Act on a field instance being deleted.
*
* This hook is invoked just before the instance is deleted.
*
* TODO: Not implemented.
*
* @param $instance
* The instance just updated.
*/
function hook_field_delete_instance($instance) {
}
/**
* Act on field records being read from the database.
*
* @param $field
* The field record just read from the database.
*/
function hook_field_read_field($field) {
}
/**
* Act on a field record being read from the database.
*
* @param $instance
* The instance record just read from the database.
*/
function hook_field_read_instance($instance) {
}
/**
* @} End of "ingroup field_crud"
*/
/**********************************************************************
* TODO: I'm not sure where these belong yet.
**********************************************************************/
/**
* TODO
*
* Note : Right now this belongs to the "Fieldable Type API".
* Whether 'build modes' is actually a 'fields' concept is to be debated
* in a separate overhaul patch for core.
*/
function hook_field_build_modes($obj_type) {
}
/**
* Determine whether the user has access to a given field.
*
* @param $op
* The operation to be performed. Possible values:
* - "edit"
* - "view"
* @param $field
* The field on which the operation is to be performed.
* @param $account
* (optional) The account to check, if not given use currently logged in user.
* @return
* TRUE if the operation is allowed;
* FALSE if the operation is denied.
*/
function hook_field_access($op, $field, $account) {
}
|