You are here

function imceimage_widget_settings in Imce CCK Image 6

Same name and namespace in other branches
  1. 6.2 imceimage.module \imceimage_widget_settings()

Handle the parameters for a widget.

Parameters

$op: The operation to be performed. Possible values:

  • "form": Display the widget settings form.
  • "validate": Check the widget settings form for errors.
  • "save": Declare which pieces of information to save back to the database.
  • "callbacks": Describe the widget's behaviour regarding hook_widget operations.

$widget: The widget on which the operation is to be performed.

Return value

This varies depending on the operation.

  • "form": an array of form elements to add to the settings page.
  • "validate": no return value. Use form_set_error().
  • "save": an array of names of form elements to be saved in the database.
  • "callbacks": an array describing the widget's behaviour regarding hook_widget operations. The array is keyed by hook_widget operations ('form', 'validate'...) and has the following possible values : CONTENT_CALLBACK_NONE : do nothing for this operation CONTENT_CALLBACK_CUSTOM : use the behaviour in hook_widget(operation) CONTENT_CALLBACK_DEFAULT : use content.module's default bahaviour Note : currently only the 'default value' operation implements this feature. All other widget operation implemented by the module _will_ be executed no matter what.

File

./imceimage.module, line 235

Code

function imceimage_widget_settings($op, $widget) {
  switch ($op) {
    case 'form':
      $form = array();
      $form['imceimage_file_types'] = array(
        '#type' => 'textfield',
        '#title' => t('Valid File Types'),
        '#default_value' => $widget['imceimage_file_types'] ? $widget['imceimage_file_types'] : 'png,gif,jpg,jpeg',
        '#description' => t('This is not implemented currently'),
        '#required' => TRUE,
      );
      return $form;
    case 'validate':
      break;
    case 'save':
      return array(
        'imceimage_file_types',
      );
    case 'callbacks':
      return array(
        'default value' => CONTENT_CALLBACK_NONE,
      );
  }
}