summaryrefslogtreecommitdiffstats
path: root/link.devel_generate.inc
blob: af0e2d5da5aa82031e02276a09ea90a1725a0766 (plain)
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
<?php

/**
 * @file
 * Devel Generate support for Link module.
 */

/**
 * Implements hook_devel_generate().
 */
function link_devel_generate($object, $field, $instance, $bundle) {
  if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_CUSTOM) {
    return devel_generate_multiple('_link_devel_generate', $object, $field, $instance, $bundle);
  }
  else {
    return _link_devel_generate($object, $field, $instance, $bundle);
  }
}

/**
 * Callback for hook_devel_generate().
 */
function _link_devel_generate($object, $field, $instance, $bundle) {
  $link = array(
    'url' => url('<front>', array('absolute' => TRUE)),
    'attributes' => _link_default_attributes(),
  );
  if ($instance['settings']['title'] != 'none') {
    $link['title'] = devel_create_greeking(mt_rand(1, 3), TRUE);
  }
  return $link;
}