function linkit_picker_form_alter in Linkit Picker 7.2
Same name and namespace in other branches
- 6 linkit_picker.module \linkit_picker_form_alter()
- 7.3 linkit_picker.module \linkit_picker_form_alter()
- 7 linkit_picker.module \linkit_picker_form_alter()
Implements hook_form_alter().
File
- ./
linkit_picker.module, line 12 - Main file for linkit_pikcer module.
Code
function linkit_picker_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == "linkit_dashboard_form") {
$profile = linkit_get_dashboard_profile();
$form['link']['link']['#field_suffix'] = '<input type="submit" id="linkit-imce" name="linkit-imce" value="Choose File ..." class="form-submit" />';
$form['link']['attributes']['#weight'] = 3;
$form['link']['browser_wrapper'] = array(
'#type' => 'fieldset',
'#title' => t('Select From List'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 2,
'#attributes' => array(
'class' => array(
'linkit_picker',
),
),
);
$views = array();
if (isset($profile->data['plugins']['entity:node']['enabled']) && $profile->data['plugins']['entity:node']['enabled']) {
$views[] = 'linkit_picker_node';
$form['link']['browser_wrapper']['node'] = array(
'#type' => 'button',
'#value' => t('Node'),
'#weight' => 0,
'#attributes' => array(
'class' => array(
'linkit_picker_button',
),
),
);
}
if (isset($profile->data['plugins']['entity:user']['enabled']) && $profile->data['plugins']['entity:user']['enabled']) {
$views[] = 'linkit_picker_user';
$form['link']['browser_wrapper']['user'] = array(
'#type' => 'button',
'#value' => t('User'),
'#weight' => 1,
'#attributes' => array(
'class' => array(
'linkit_picker_button',
),
),
);
}
if (isset($profile->data['plugins']['entity:taxonomy_term']['enabled']) && $profile->data['plugins']['entity:taxonomy_term']['enabled']) {
$views[] = 'linkit_picker_term';
$form['link']['browser_wrapper']['term'] = array(
'#type' => 'button',
'#value' => t('Term'),
'#weight' => 2,
'#attributes' => array(
'class' => array(
'linkit_picker_button',
),
),
);
}
$form['link']['browser_wrapper']['container'] = array(
'#prefix' => '<div id="linkit-picker-container">',
'#suffix' => '</div>',
'#markup' => _linkit_picker_render_container($views),
'#weight' => 10,
);
}
if (strstr($form_id, "_node_form")) {
$form['#attached']['css'][] = drupal_get_path('module', 'linkit_picker') . '/linkit_picker.css';
$form['#attached']['js'][] = drupal_get_path('module', 'linkit_picker') . '/linkit_picker.js';
}
}