Replace all implementations of hook_pathauto()
with hook_path_info()
.
Before:
function field_collection_pathauto($op) {
if ('settings' === $op) {
$settings = array();
$settings['module'] = 'field_collection';
$settings['token_type'] = 'field_collection_item';
$settings['groupheader'] = t('Field collection item paths');
$settings['patterndescr'] = t('Default path pattern (applies to all field collections with blank patterns below)');
$settings['patterndefault'] = '';
// @todo Implement bulk update:
// $settings['batch_update_callback'] = 'field_collection_pathauto_bulk_update_batch_process';
// $settings['batch_file'] = backdrop_get_path('module', 'field_collection') . '/field_collection.pathauto.inc';
$settings['patternitems'] = array();
$instances = field_info_instances();
foreach ($instances as $entity_type => $type_bundles) {
foreach ($type_bundles as $bundle => $bundle_instances) {
foreach ($bundle_instances as $field_name => $instance) {
$field = field_info_field($field_name);
if ($field['type'] === 'field_collection') {
// @todo We may need different patterns depending on the.
// host entity type or the host bundle. If so we need to prefix
// field-name with $entity_type . '_' . $bundle . '_' and also need
// to implement our own version of pathauto_pattern_load_by_entity()
// searching for the best matching pattern.
$settings['patternitems'][$field_name] = t('Pattern for all field collection @field-collection paths', array('@field-collection' => $field_name));
}
}
}
}
return (object) $settings;
}
}
After:
function field_collection_path_info() {
$info['field_collection'] = array(
'entity type' => 'field_collection',
'label' => t('Field collection item paths'),
'pattern description' => t('Default path pattern (applies to all field collections with blank patterns below)'),
'pattern default' => '',
'pattern items' => array(),
'type delete callback' => '',
'batch update callback' => '',
'batch file' => '',
'token_type' => 'field_collection_item'
);
$instances = field_info_instances();
foreach ($instances as $entity_type => $type_bundles) {
foreach ($type_bundles as $bundle => $bundle_instances) {
foreach ($bundle_instances as $field_name => $instance) {
$field = field_info_field($field_name);
if ($field['type'] === 'field_collection') {
$info['field_collection']['pattern items'][$field_name] = t('Pattern for all field collection @field-collection paths', array('@field-collection' => $field_name));
}
}
}
}
return $info;
}
Introduced in branch:
1.1.x
Introduced in version:
1.1.0
Impacts:
Module developers