Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
My goal is to add categories if there is a one of specified keywords in title description or both.
I am trying to execute a php script using feeds php tamper module my problem is that I don't know how I should I format term ids...
$title = $item['jsonpath_parser:1'];
$description = $item['jsonpath_parser:2'];
$keywords = array(
'1' => array('tags1', 'tag2'),
'2' => array('tg3','tags','lorem'),
'3' => array('ipsum', 'dor'),
'4' => array('set', 'amet'),
'5' => array('et'),
'6' => array('ista', 'kulpa', 'la'),
'7' => array('bora') );
$cat_list = array();
foreach ($keywords as $cat => $tags) {
foreach ($tags as $key => $tag) {
if (strpos($title, $tag) !== false && strpos($description, $tag) !== false) {
array_push($cat_list, $cat);
}
}
}
return implode(',', $cat_list);