function linkit_profiles_export_ui_form in Linkit 7.2
Generate a profile form.
File
- plugins/
export_ui/ linkit_profiles.inc, line 34
Code
function linkit_profiles_export_ui_form(&$form, &$form_state) {
// Get all plugins.
$plugins = linkit_get_plugins();
$profile = $form_state['item'];
$form['#theme'] = 'linkit_profiles_export_ui_form';
$form['#attached']['css'] = array(
drupal_get_path('module', 'linkit') . '/css/linkit.css',
);
$form['data']['#tree'] = TRUE;
$form['info']['#weight'] = -100;
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $profile->weight,
'#delta' => 10,
'#weight' => -98,
'#description' => t('If the user has multiple roles, the profile with lowest weight will then be assigned to the user. In general, the most permissive profile should be assigned the lowest weight.'),
);
$form['roles'] = array(
'#type' => 'fieldset',
'#title' => t('Roles with access'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
'#weight' => -97,
'#description' => t('Roles which may use this profile. Note that if <em>authenticated user</em> is ticked, all roles (except anonymous) will have permission to this profile.'),
);
// Append role form elements to the settings form.
_linkit_build_role_associate_form_fields($form, $profile);
// Append plugin form element to the setttings form.
_linkit_build_plugin_form_fields($form, $profile, $plugins);
foreach ($plugins as $plugin) {
// Get an instance og the handler for this plugin.
$handler = linkit_get_plugin_handler($plugin, $profile);
$plugin_form = $handler
->buildSettingsForm();
if ($plugin_form) {
// Add the handler settings form to the generic.
$form['data'] += $plugin_form;
}
}
if (module_invoke('imce', 'access')) {
$form['data']['imce'] = array(
'#type' => 'fieldset',
'#title' => t('IMCE file picking'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
);
$form['data']['imce']['use_imce'] = array(
'#title' => t('Enable IMCE file picking'),
'#type' => 'checkbox',
'#default_value' => isset($profile->data['imce']['use_imce']) ? $profile->data['imce']['use_imce'] : '',
'#description' => t('Note that only public files are supported.'),
);
}
$form['data']['autocomplete'] = array(
'#type' => 'fieldset',
'#title' => t('Autocomplete options'),
'#description' => t('Linkit uses !bac which may be configured with focus on performance.', array(
'!bac' => l('Better Autocomplete', 'https://github.com/betamos/Better-Autocomplete'),
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
'#weight' => 100,
);
$form['data']['autocomplete']['charLimit'] = array(
'#title' => t('Character limit'),
'#type' => 'textfield',
'#default_value' => isset($profile->data['autocomplete']['charLimit']) ? $profile->data['autocomplete']['charLimit'] : '3',
'#size' => 5,
'#description' => t('Minimum number of characters to perform server polling. A higher value reduces server load. <em>Default: 3</em>'),
'#element_validate' => array(
'linkit_isnumeric_validate',
),
);
$form['data']['autocomplete']['wait'] = array(
'#title' => t('Key press delay'),
'#type' => 'textfield',
'#default_value' => isset($profile->data['autocomplete']['wait']) ? $profile->data['autocomplete']['wait'] : '350',
'#size' => 5,
'#description' => t('Time from last key press to poll the server. A higher value reduces server load. <em>Default: 350</em>'),
'#field_suffix' => t('ms'),
'#element_validate' => array(
'linkit_isnumeric_validate',
),
);
$form['data']['autocomplete']['remoteTimeout'] = array(
'#title' => t('Remote timeout'),
'#type' => 'textfield',
'#default_value' => isset($profile->data['autocomplete']['remoteTimeout']) ? $profile->data['autocomplete']['remoteTimeout'] : '10000',
'#size' => 5,
'#description' => t('Client side timeout for a request to the server. <em>Default: 10000</em>'),
'#field_suffix' => t('ms'),
'#element_validate' => array(
'linkit_isnumeric_validate',
),
);
// Append attributes form element to the setttings form.
_linkit_build_attribute_form_fields($form, $profile);
}