123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <?php
- function hook_taxonomy_vocabulary_load($vocabularies) {
- $result = db_select('mytable', 'm')
- ->fields('m', array('vid', 'foo'))
- ->condition('m.vid', array_keys($vocabularies), 'IN')
- ->execute();
- foreach ($result as $record) {
- $vocabularies[$record->vid]->foo = $record->foo;
- }
- }
- function hook_taxonomy_vocabulary_presave($vocabulary) {
- $vocabulary->foo = 'bar';
- }
- function hook_taxonomy_vocabulary_insert($vocabulary) {
- if ($vocabulary->machine_name == 'my_vocabulary') {
- $vocabulary->weight = 100;
- }
- }
- function hook_taxonomy_vocabulary_update($vocabulary) {
- db_update('mytable')
- ->fields(array('foo' => $vocabulary->foo))
- ->condition('vid', $vocabulary->vid)
- ->execute();
- }
- function hook_taxonomy_vocabulary_delete($vocabulary) {
- db_delete('mytable')
- ->condition('vid', $vocabulary->vid)
- ->execute();
- }
- function hook_taxonomy_term_load($terms) {
- $result = db_select('mytable', 'm')
- ->fields('m', array('tid', 'foo'))
- ->condition('m.tid', array_keys($terms), 'IN')
- ->execute();
- foreach ($result as $record) {
- $terms[$record->tid]->foo = $record->foo;
- }
- }
- function hook_taxonomy_term_presave($term) {
- $term->foo = 'bar';
- }
- function hook_taxonomy_term_insert($term) {
- db_insert('mytable')
- ->fields(array(
- 'tid' => $term->tid,
- 'foo' => $term->foo,
- ))
- ->execute();
- }
- function hook_taxonomy_term_update($term) {
- db_update('mytable')
- ->fields(array('foo' => $term->foo))
- ->condition('tid', $term->tid)
- ->execute();
- }
- function hook_taxonomy_term_delete($term) {
- db_delete('mytable')
- ->condition('tid', $term->tid)
- ->execute();
- }
- function hook_taxonomy_term_view($term, $view_mode, $langcode) {
- $term->content['my_additional_field'] = array(
- '#markup' => $additional_field,
- '#weight' => 10,
- '#theme' => 'mymodule_my_additional_field',
- );
- }
- function hook_taxonomy_term_view_alter(&$build) {
- if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) {
-
- $build['an_additional_field']['#weight'] = -10;
- }
-
- $build['#post_render'][] = 'my_module_node_post_render';
- }
|