-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathparser_prepare_entity.inc
41 lines (34 loc) · 1.16 KB
/
parser_prepare_entity.inc
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
33
34
35
36
37
38
39
40
<?php
/**
* Prepare Node
*/
function _parser_prepare_entity_node($entity, $entity_wrapper) {
$entity->title = trim($entity->title);
if (drupal_strlen($entity->title) > 255) {
$title = $entity->title;
$entity->title = drupal_substr($title, 0, 255);
_parser_watchdog('Обрезан заголовок ноды: "<i>' . check_plain($title) . '</i>" => "<i>' . check_plain($entity->title) . '</i>".');
}
}
/**
* Prepare Taxonomy term
*/
function _parser_prepare_entity_taxonomy_term($entity, $entity_wrapper) {
$entity->name = trim($entity->name);
if (empty($entity->vid)) {
$entity->vid = taxonomy_vocabulary_machine_name_load($entity->vocabulary_machine_name)->vid;
}
}
/**
* Prepare Commerce product
*/
function _parser_prepare_entity_commerce_product($entity, $entity_wrapper) {
if (drupal_strlen($entity->title) > 255) {
$title = $entity->title;
$entity->title = drupal_substr($title, 0, 255);
_parser_watchdog('Обрезан заголовок товара: "<i>' . check_plain($title) . '</i>" => "<i>' . check_plain($entity->title) . '</i>".');
}
if (empty($entity->language)) {
$entity->language = LANGUAGE_NONE;
}
}