You are here

function token_insert_text_table in Token Insert 7.2

1 call to token_insert_text_table()
_token_insert_add_token_insert in token_insert_text/token_insert_text.module

File

token_insert_text/token_insert_text.module, line 64
token insert module.

Code

function token_insert_text_table($element) {
  $form = array();
  if (isset($element['#title'])) {
    $name = md5(print_r($element, TRUE));
    $table_id = drupal_html_id("token-insert-text-table-{$name}");
    $name = md5(print_r($element, TRUE));
    $settings = array(
      'token_insert' => array(
        'tables' => array(
          $table_id => $element['#id'],
        ),
      ),
    );
    $form['token_insert_text_table_wrapper'] = array(
      '#type' => 'container',
      '#attributes' => array(
        'id' => $table_id,
        'class' => array(
          'token-insert-text-table',
        ),
      ),
      '#attached' => array(
        'js' => array(
          array(
            'data' => $settings,
            'type' => 'setting',
          ),
          array(
            'data' => drupal_get_path('module', 'token_insert') . '/token_insert.js',
          ),
          array(
            'data' => drupal_get_path('module', 'token_insert_text') . '/token_insert_text.js',
          ),
        ),
      ),
    );
    $form['token_insert_text_table_wrapper']['token_insert_text_table'] = array(
      '#theme' => 'token_insert_tree',
    );
  }
  return $form;
}