You are here

function customfilter_set_edit in Custom filter 5

Edit a filter set.

1 string reference to 'customfilter_set_edit'
customfilter_menu in ./customfilter.module
Implements hook_menu().

File

./customfilter.module, line 426

Code

function customfilter_set_edit($op, $sid = 0) {
  switch ($op) {
    case 'edit':
      $item = customfilter_get_set($sid, '*');
      break;
    case 'add':
      $item = array(
        'sid' => 0,
        'name' => 'Filter set #',
        'cache' => 1,
        'description' => '',
        'shorttips' => '',
        'longtips' => '',
      );
      break;
  }
  $form['sid'] = array(
    '#type' => 'value',
    '#value' => $item['sid'],
  );
  $form['operation'] = array(
    '#type' => 'value',
    '#value' => $op,
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#default_value' => $item['name'],
    '#description' => t('The name of the filter set.'),
    '#required' => TRUE,
  );
  $form['cache'] = array(
    '#type' => 'checkbox',
    '#title' => t('Cache'),
    '#default_value' => $item['cache'],
    '#description' => t('If checked, the content will be cached (i.e. this filter will be executed once per content edit).'),
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $item['description'],
    '#description' => t('Some text to describe this filter set.'),
  );
  $form['shorttips'] = array(
    '#type' => 'textarea',
    '#title' => t('Tips (short)'),
    '#default_value' => $item['shorttips'],
    '#description' => '',
  );
  $form['longtips'] = array(
    '#type' => 'textarea',
    '#title' => t('Tips (full)'),
    '#default_value' => $item['longtips'],
    '#description' => '',
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}