You are here

function command_buttons_form_command_buttons_entity_edit_form_alter in Command Buttons 7

Implements hook_form_FORM_ID_alter().

File

./command_buttons.module, line 815

Code

function command_buttons_form_command_buttons_entity_edit_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($form['field_command_link'])) {
    $entity_info = entity_get_info('command_button');

    // Add token module replacements fields.
    $form['tokens'] = array(
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 20,
      '#title' => t('Placeholder tokens'),
      '#description' => t("The following placeholder tokens can be used in both paths and titles. When used in a path or title, they will be replaced with the appropriate values."),
    );
    $form['tokens']['help'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        $entity_info['token type'],
      ),
      '#global_types' => TRUE,
      '#click_insert' => TRUE,
    );
    if (isset($form['field_link_icon'])) {
      foreach ($form['field_link_icon'][LANGUAGE_NONE]['#options'] as $key => $option) {
        if ($key != '_none') {
          $form['field_link_icon'][LANGUAGE_NONE]['#options'][$key] = "<i class='" . $option . "'></i> " . $option;
        }
      }
    }
  }
}