function title_entity_info in Title 7
Implements hook_entity_info().
File
- ./
title.core.inc, line 14 - Provide field replacement information.
Code
function title_entity_info() {
$info = array();
$general_settings = variable_get('title_general', array(
'maxlength' => 255,
));
$field = array(
'type' => 'text',
'cardinality' => 1,
'translatable' => TRUE,
'settings' => array(
'max_length' => $general_settings['maxlength'],
),
);
$instance = array(
'required' => TRUE,
'settings' => array(
'text_processing' => 0,
),
'widget' => array(
'weight' => -5,
),
'display' => array(
'default' => array(
'type' => 'hidden',
),
),
);
$info['node'] = array(
'field replacement' => array(
'title' => array(
'field' => $field,
'instance' => array(
'label' => t('Title'),
'description' => '',
) + $instance,
'additional keys' => array(
'format' => 'format',
),
),
),
'efq bundle conditions' => TRUE,
);
if (module_exists('taxonomy')) {
$info['taxonomy_term'] = array(
'field replacement' => array(
'name' => array(
'field' => $field,
'instance' => array(
'label' => t('Name'),
'description' => '',
) + $instance,
'preprocess_key' => 'term_name',
),
'description' => array(
'field' => array(
'type' => 'text_with_summary',
) + $field,
'instance' => array(
'required' => FALSE,
'label' => t('Description'),
'description' => '',
'settings' => array(
'text_processing' => 1,
),
) + $instance,
'callbacks' => array(
'submit' => 'title_field_term_description_submit',
),
'additional keys' => array(
'format' => 'format',
),
),
),
);
}
if (module_exists('comment')) {
$info['comment'] = array(
'field replacement' => array(
'subject' => array(
'field' => $field,
'instance' => array(
'label' => t('Subject'),
'description' => '',
) + $instance,
'preprocess_key' => 'title',
),
),
);
}
return $info;
}