Guest User

Untitled

a guest
Apr 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /**
  2. * Implements hook_install().
  3. */
  4. function achievements_optout_install() {
  5. field_create_field(array(
  6. 'field_name' => 'achievements_optout',
  7. 'type' => 'list_boolean',
  8. 'settings' => array(
  9. 'allowed_values' => array(0 => '', 1 => ''),
  10. ),
  11. ));
  12.  
  13. field_create_instance(array(
  14. 'bundle' => 'user',
  15. 'entity_type' => 'user',
  16. 'field_name' => 'achievements_optout',
  17. 'label' => t('I DO NOT wish to participate in or unlock achievements'),
  18. 'description' => t('DANGER! Checking this box will remove your unlocked achievements and delete your stored statistics.'),
  19. 'widget' => array(
  20. 'type' => 'options_onoff',
  21. 'weight' => 1,
  22. 'settings' => array(
  23. 'display_label' => 1,
  24. ),
  25. ),
  26. ));
  27. }
  28.  
  29. /**
  30. * Implements hook_uninstall().
  31. */
  32. function achievements_optout_uninstall() {
  33. field_delete_field('achievements_optout');
  34. }
Add Comment
Please, Sign In to add comment