You are here

function theme_matrix_settings_list in Matrix field 6.2

Creates a formatted list of rows/columns for display on the settings page This list is embalished with javascript

Parameters

array $data The definition to process:

Return value

HTML markup

4 theme calls to theme_matrix_settings_list()
matrix_settings_default in ./matrix.module
Prepare default values for the admin interface
matrix_settings_reorder_save in ./admin.inc
@file Provides functions used in the creation of matrix fields.
matrix_settings_throbber_delete in ./admin.inc
Menu callback to delete an element This is part one of the delete process. Accepts parameters via $_REQUEST Echos a delete confirm form.
matrix_settings_throbber_save in ./admin.inc
AJAX callback for saving an individual element Takes parameters from $_REQUEST Saves the data into the Drupal cache Echos JSON data which contains: serialized data (which is what will be eventually saved into the database) list of elements for row/column

File

./matrix.module, line 256
Defines simple matrix field types.

Code

function theme_matrix_settings_list($elements, $rc) {

  // Add table javascript.
  drupal_add_js('misc/tableheader.js');
  drupal_add_tabledrag("matrix{$rc}", 'order', 'sibling', "matrix-settings-{$rc}-order");
  $header = array(
    t('Title'),
    t('Type'),
    t('Edit'),
    t('Order'),
  );
  if (!is_array($elements)) {
    return theme('table', $header, $rows, array(
      'id' => "matrix{$rc}",
    ));
  }
  foreach ($elements as $id => $element) {
    $data = array(
      $element['#title'],
      $element['#type'],
      "<a href='#' id='matrix-element-{$rc}-{$id}' class='matrix-{$rc} matrix-settings-edit'>Edit</a>",
      "<div id='{$id}' class='matrix-settings-{$rc}-order'>{$id}</div>",
    );
    $rows[] = array(
      'data' => $data,
      'class' => 'draggable',
    );
  }
  return theme('table', $header, $rows, array(
    'id' => "matrix{$rc}",
  ));
}