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