You are here

function _customfilter_filter_add_edit_fields in Custom filter 7

Same name and namespace in other branches
  1. 6 customfilter.admin.inc \_customfilter_filter_add_edit_fields()
  2. 7.2 customfilter.module \_customfilter_filter_add_edit_fields()
2 calls to _customfilter_filter_add_edit_fields()
customfilter_filter_add in ./customfilter.module
Return the form to add a new filter.
customfilter_filter_edit in ./customfilter.module
Return the filter edit form.

File

./customfilter.module, line 1438
Allows the users with the right permission to define custom filters.

Code

function _customfilter_filter_add_edit_fields(&$form, $item) {
  $form['fid'] = array(
    '#type' => 'value',
    '#value' => $item['fid'],
  );
  $form['type'] = array(
    '#type' => 'textfield',
    '#title' => t('Type'),
    '#description' => t('The machine-readable name of the filter. This name must contain only lowercase letters, numbers, and underscores.'),
    '#default_value' => $item['type'],
    '#maxlength' => 32,
    // This function do not exist or is with wrong name

    //'#element_validate' => array('customfilter_filter_type_validate'),
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#description' => t('The human-readable name of the filter. It is recommended that this name begin with a capital letter and contain only letters, numbers, and <em>spaces</em>.'),
    '#default_value' => $item['name'],
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['cache'] = array(
    '#type' => 'checkbox',
    '#title' => t('Cache'),
    '#description' => t('If checked, the content will be cached.'),
    '#default_value' => $item['cache'],
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t('A description of the purpose of this filter.'),
    '#default_value' => $item['description'],
  );
  $form['shorttip'] = array(
    '#type' => 'textarea',
    '#title' => t('Tips (short)'),
    '#default_value' => $item['shorttip'],
    '#rows' => 5,
  );
  $form['longtip'] = array(
    '#type' => 'textarea',
    '#title' => t('Tips (full)'),
    '#default_value' => $item['longtip'],
    '#rows' => 20,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
}