Révision 4eeb3b46
Ajouté par Assos Assos il y a presque 8 ans
drupal7/sites/all/modules/uuid/uuid_path/uuid_path.module | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* UUID path module functions.
|
|
5 |
* UUID path module functions. |
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
24 | 24 |
*/ |
25 | 25 |
function _uuid_path_load_url_aliases(&$entities, $entity_type) { |
26 | 26 |
$info = entity_get_info($entity_type); |
27 |
// we only care about entities with URLs.
|
|
27 |
// We only care about entities with URLs.
|
|
28 | 28 |
if (!isset($info['uri callback'])) { |
29 | 29 |
return; |
30 | 30 |
} |
... | ... | |
35 | 35 |
$aliases = _uuid_path_url_alias_load($path['path']); |
36 | 36 |
|
37 | 37 |
// Ignore local IDs. |
38 |
foreach($aliases as &$alias) { |
|
38 |
foreach ($aliases as &$alias) {
|
|
39 | 39 |
unset($alias->pid); |
40 | 40 |
unset($alias->source); |
41 | 41 |
} |
... | ... | |
50 | 50 |
function _uuid_path_save_url_aliases(&$entity, $entity_type) { |
51 | 51 |
$info = entity_get_info($entity_type); |
52 | 52 |
|
53 |
// We only care when there is a url callback |
|
53 |
// We only care when there is a url callback.
|
|
54 | 54 |
if (!isset($info['uri callback'])) { |
55 | 55 |
return FALSE; |
56 | 56 |
} |
... | ... | |
63 | 63 |
path_delete(array('source' => $path)); |
64 | 64 |
|
65 | 65 |
// Continue if aliases are present. |
66 |
if(empty($entity->url_alias)) { |
|
66 |
if (empty($entity->url_alias)) {
|
|
67 | 67 |
return FALSE; |
68 | 68 |
} |
69 | 69 |
|
... | ... | |
77 | 77 |
/** |
78 | 78 |
* Loads all aliases associated with a path. |
79 | 79 |
* |
80 |
* @param $path |
|
80 |
* @param string $path
|
|
81 | 81 |
* The source path to look up. |
82 | 82 |
* |
83 |
* @return |
|
83 |
* @return array
|
|
84 | 84 |
* Array of paths or NULL if none found. |
85 | 85 |
*/ |
86 | 86 |
function _uuid_path_url_alias_load($path) { |
... | ... | |
90 | 90 |
->execute() |
91 | 91 |
->fetchAll(PDO::FETCH_OBJ); |
92 | 92 |
} |
93 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules