function pathauto_entity_pathauto in Pathauto Entity 7
Implements hook_pathauto().
File
- ./
pathauto_entity.module, line 181 - Implements custom entity type support for Pathauto module.
Code
function pathauto_entity_pathauto($op) {
switch ($op) {
case 'settings':
$settings = array();
$available = pathauto_entity_available_entity_types();
if (!empty($available)) {
foreach ($available as $entity_type => $status) {
if ($status != '0') {
$entity_info = entity_get_info($entity_type);
$settings[$entity_type] = (object) array(
'module' => $entity_type,
'token_type' => $entity_info['token type'],
'groupheader' => t('!entity_type paths', array(
'!entity_type' => $entity_info['label'],
)),
'patterndescr' => t('Default path pattern (applies to all !entity_type entity types with blank patterns below)', array(
'!entity_type' => $entity_info['label'],
)),
'patterndefault' => '',
'batch_update_callback' => 'pathauto_entity_bulk_update_batch_callback',
'batch_file' => drupal_get_path('module', 'pathauto_entity') . '/includes/pathauto_entity.batch.inc',
);
// Sort through each Entity Type to add support for bundles
if (!empty($entity_info['bundles'])) {
foreach ($entity_info['bundles'] as $bundle => $values) {
$settings[$entity_type]->patternitems[$bundle] = t('Pattern for all @bundle paths', array(
'@bundle' => $values['label'],
));
}
}
}
}
}
return $settings;
default:
break;
}
}