handler_form.inc 1.68 KB
Newer Older
Cody Craven's avatar
Cody Craven committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// $Id$

/**
 * Abstract class to act as the taxonomy display plugins form handing.
 *
 * The $form and $form_state parameters listed within this section are not true
 * $form and $form_state but rather a fieldset and form_state['values'] for the
 * fields in that fielset.
 */
abstract class TaxonomyDisplayHandlerForm {
  /**
   * Prepare the form that users will configure.
   *
   * @param array $form
   *   A fieldset for configuration to display to the user for this handler.
   * @param array $form_state
   *   The form state.
   *
   * @return TaxonomyTermDisplayHandler
   */
  abstract public function formFieldset(&$form, &$form_state);

  /**
   * Perform any processing desired and return the result to be stored.
   *
   * @param array $form
   *   A fieldset for configuration to display to the user for this handler.
   * @param array $form_state
   *   The form state.
   *
   * @return mixed
   *   Any single variable or no variable can be returned. Whatever is returned
   *   will be stored on behalf of the plugin for later use.
   */
  abstract public function formSubmit(&$form, &$form_state);

  /**
   * Perform validation on the custom formFieldset when the user submits.
   *
   * This method does not need to be defined in the implementing class as
   * validation can be skipped in some cases.
   *
   * @param array $form
   *   A fieldset for configuration to display to the user for this handler.
   * @param array $form_state
   *   The form state.
   *
   * @return TaxonomyTermDisplayHandler
   */
  public function formValidate(&$form, &$form_state) {
    // Override formValidate in your implementing handler if any validation work
    // is to be done.

    return $this;
  }
}