function pathauto_i18n_configuration_form in Pathauto i18n 8
Same name and namespace in other branches
- 7 pathauto_i18n.module \pathauto_i18n_configuration_form()
PORTED to 8.x-1.x - src/Pathautoi18nWidget.php.
Attach Pathauto i18n field configuration to form.
Parameters
array $form: Form to attach.
object $entity: Entity object.
string $entity_type: Entity type.
See also
pathauto_field_attach_form()
2 calls to pathauto_i18n_configuration_form()
- pathauto_i18n_taxonomy_form_taxonomy_form_term_alter in modules/
pathauto_i18n_taxonomy/ pathauto_i18n_taxonomy.module - PORTED to 8.x-1.x - pathauto_i18n.module:pathauto_i18n_field_widget_info_alter().
- pathauto_i18n_user_form_alter in modules/
pathauto_i18n_user/ pathauto_i18n_user.module - Implements hook_form_alter().
File
- ./
pathauto_i18n.module, line 89 - Provides common functions and callbacks for pathauto_i18n submodules.
Code
function pathauto_i18n_configuration_form(&$form, $entity, $entity_type, $bundle) {
$access = user_access('create url aliases') || user_access('administer url aliases');
if ($entity && $access) {
$default = pathauto_i18n_get_bundle_default($entity_type, $bundle);
$form['path']['pathauto_i18n_status'] = array(
'#type' => 'checkbox',
'#title' => t('Generate automatic URL alias for all languages'),
'#description' => t('Allows you to generate aliases for all available languages.', array(
'@entity_type' => $entity_type,
)),
'#default_value' => isset($entity->path['pathauto_i18n_status']) ? $entity->path['pathauto_i18n_status'] : $default,
'#weight' => -0.99,
);
$form['path']['pathauto_i18n_undefined_language_tip'] = array(
'#type' => 'item',
'#markup' => t('URL alias for "Language neutral" <strong>won\'t be created</strong>, because you use automatic alias.') . '</strong>',
'#weight' => -0.98,
'#states' => array(
'visible' => array(
'select[name="language"]' => array(
'value' => LANGUAGE_NONE,
),
'input[name="path[pathauto]"]' => array(
'checked' => TRUE,
),
'input[name="path[pathauto_i18n_status]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['path']['pathauto_i18n_undefined_language_custom_tip'] = array(
'#type' => 'item',
'#markup' => t('URL alias for "Language neutral" <strong>will be created</strong>, because you use custom alias.'),
'#weight' => -0.98,
'#states' => array(
'visible' => array(
'select[name="language"]' => array(
'value' => LANGUAGE_NONE,
),
'input[name="path[pathauto]"]' => array(
'checked' => FALSE,
),
'input[name="path[pathauto_i18n_status]"]' => array(
'checked' => TRUE,
),
),
),
);
}
}