Skip to content
Snippets Groups Projects
Commit 7bc4ca4f authored by Angie Byron's avatar Angie Byron
Browse files

#682486 by Bojhan: Clean-ups to profile page configuration form.

parent 9703e5d6
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -180,7 +180,7 @@ function profile_field_form($form, &$form_state, $arg = NULL) {
drupal_not_found();
return;
}
drupal_set_title(t('edit %title', array('%title' => $edit['title'])), PASS_THROUGH);
drupal_set_title(t('Edit %title', array('%title' => $edit['title'])), PASS_THROUGH);
$form['fid'] = array('#type' => 'value',
'#value' => $fid,
);
......@@ -198,7 +198,7 @@ function profile_field_form($form, &$form_state, $arg = NULL) {
return;
}
$type = $arg;
drupal_set_title(t('add new %type', array('%type' => $types[$type])), PASS_THROUGH);
drupal_set_title(t('Add new %type', array('%type' => $types[$type])), PASS_THROUGH);
$edit = array('name' => 'profile_');
$form['type'] = array('#type' => 'value', '#value' => $type);
}
......@@ -212,30 +212,27 @@ function profile_field_form($form, &$form_state, $arg = NULL) {
'required' => '',
'register' => '',
);
$form['fields'] = array('#type' => 'fieldset',
'#title' => t('Field settings'),
);
$form['fields']['category'] = array('#type' => 'textfield',
$form['category'] = array('#type' => 'textfield',
'#title' => t('Category'),
'#default_value' => $edit['category'],
'#autocomplete_path' => 'admin/config/people/profile/autocomplete',
'#description' => t('The category the new field should be part of. Categories are used to group fields logically. An example category is "Personal information".'),
'#required' => TRUE,
);
$form['fields']['title'] = array('#type' => 'textfield',
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $edit['title'],
'#description' => t('The title of the new field. The title will be shown to the user. An example title is "Favorite color".'),
'#required' => TRUE,
);
$form['fields']['name'] = array('#type' => 'textfield',
$form['name'] = array('#type' => 'textfield',
'#title' => t('Form name'),
'#default_value' => $edit['name'],
'#description' => t('The name of the field. The form name is not shown to the user but used internally in the HTML code and URLs.
Unless you know what you are doing, it is highly recommended that you prefix the form name with <code>profile_</code> to avoid name clashes with other fields. Spaces or any other special characters except dash (-) and underscore (_) are not allowed. An example name is "profile_favorite_color" or perhaps just "profile_color".'),
'#required' => TRUE,
);
$form['fields']['explanation'] = array('#type' => 'textarea',
$form['explanation'] = array('#type' => 'textarea',
'#title' => t('Explanation'),
'#default_value' => $edit['explanation'],
'#description' => t('An optional explanation to go with the new field. The explanation will be shown to the user.'),
......@@ -247,7 +244,7 @@ function profile_field_form($form, &$form_state, $arg = NULL) {
'#description' => t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.'),
);
}
$form['fields']['visibility'] = array('#type' => 'radios',
$form['visibility'] = array('#type' => 'radios',
'#title' => t('Visibility'),
'#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC,
'#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')),
......@@ -266,21 +263,21 @@ function profile_field_form($form, &$form_state, $arg = NULL) {
'#description' => t('To enable browsing this field by value, enter a title for the resulting page. An example page title is "People who are employed" . This is only applicable for a public field.'),
);
}
$form['fields']['weight'] = array('#type' => 'weight',
$form['weight'] = array('#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $edit['weight'],
'#description' => t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.'),
);
$form['fields']['autocomplete'] = array('#type' => 'checkbox',
$form['autocomplete'] = array('#type' => 'checkbox',
'#title' => t('Form will auto-complete while user is typing.'),
'#default_value' => $edit['autocomplete'],
'#description' => t('For security, auto-complete will be disabled if the user does not have access to user profiles.'),
);
$form['fields']['required'] = array('#type' => 'checkbox',
$form['required'] = array('#type' => 'checkbox',
'#title' => t('The user must enter a value.'),
'#default_value' => $edit['required'],
);
$form['fields']['register'] = array('#type' => 'checkbox',
$form['register'] = array('#type' => 'checkbox',
'#title' => t('Visible in user registration form.'),
'#default_value' => $edit['register'],
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment