link.devel_generate.inc 834 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * Devel Generate support for Link module.
  5. */
  6. /**
  7. * Implements hook_devel_generate().
  8. */
  9. function link_devel_generate($object, $field, $instance, $bundle) {
  10. if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_CUSTOM) {
  11. return devel_generate_multiple('_link_devel_generate', $object, $field, $instance, $bundle);
  12. }
  13. else {
  14. return _link_devel_generate($object, $field, $instance, $bundle);
  15. }
  16. }
  17. /**
  18. * Callback for hook_devel_generate().
  19. */
  20. function _link_devel_generate($object, $field, $instance, $bundle) {
  21. $link = array(
  22. 'url' => url('<front>', array('absolute' => TRUE)),
  23. 'attributes' => _link_default_attributes(),
  24. );
  25. if ($instance['settings']['title'] != 'none') {
  26. $link['title'] = devel_create_greeking(mt_rand(1, 3), TRUE);
  27. }
  28. return $link;
  29. }