You are here

function _cacheflush_advanced_table_row in CacheFlush 7

Same name and namespace in other branches
  1. 8 modules/cacheflush_advanced/cacheflush_advanced.module \_cacheflush_advanced_table_row()
  2. 7.3 modules/cacheflush_advanced/cacheflush_advanced.module \_cacheflush_advanced_table_row()
  3. 7.2 cacheflush_advanced/cacheflush_advanced.module \_cacheflush_advanced_table_row()

Build cacheflush custom settings row form elements.

Parameters

int $delta: Row weight.

string $cid: Cache ID.

string $table: Table id to be flushed.

boolan $wildcard: Wildcard checkbox value.

Return value

string Advanced table row.

1 call to _cacheflush_advanced_table_row()
cacheflush_advanced_form_alter in cacheflush_advanced/cacheflush_advanced.module
Implements hook_form_alter().

File

cacheflush_advanced/cacheflush_advanced.module, line 189
Cacheflush advanced preset form.

Code

function _cacheflush_advanced_table_row($delta, $cid = '', $table = '', $wildcard = FALSE) {
  static $table_options;
  if (empty($table_options)) {
    $cache_tables = array_merge(array(
      'cache',
      'cache_block',
      'cache_filter',
      'cache_page',
    ), module_invoke_all('flush_caches'));
    asort($cache_tables);
    $table_options = array_combine($cache_tables, $cache_tables);
    array_unshift($table_options, "- Select a table -");
  }
  $form['cid'] = array(
    '#type' => 'textfield',
    '#default_value' => $cid,
    '#size' => 20,
  );
  $form['table'] = array(
    '#type' => 'select',
    '#default_value' => $table,
    '#options' => $table_options,
  );
  $form['wildcard'] = array(
    '#title' => t('TRUE'),
    '#type' => 'checkbox',
    '#default_value' => $wildcard,
  );
  $form['operations'] = array(
    '#name' => 'remove_' . $delta,
    '#type' => 'button',
    '#value' => t('Remove'),
    '#limit_validation_errors' => array(),
    '#ajax' => array(
      'callback' => '_cacheflush_advanced_form_callback',
      'wrapper' => 'cacheflush-advanced-settings-table',
      'method' => 'replace',
      'effect' => 'fade',
    ),
  );
  return $form;
}