Datamanager 2 Chooser widget

As with all subclasses, the actual initialization is done in the initialize() function, not in the constructor, to allow for error handling.

It can only be bound to a select type (or subclass thereof), and inherits the configuration from there as far as possible.

Available configuration options:

Example: (The simplest ones)

'contacts' => Array
(
    'title' => 'contacts',
    'storage' => null,
    'type' => 'select',
    'type_config' => array
    (
         'multiple_storagemode' => 'array',
    ),
    'widget' => 'chooser',
    'widget_config' => array
    (
        'clever_class' => 'contact',
    ),
),

OR

 'styles' => Array
 (
     'title' => 'styles',
     'storage' => null,
     'type' => 'select',
     'type_config' => array
     (
          'multiple_storagemode' => 'array',
     ),
     'widget' => 'chooser',
     'widget_config' => array
     (
         'clever_class' => 'style',
     ),
 ),
package midcom.helper.datamanager2

 Methods

_generate_extra_params ()

_init_widget_options ()

_on_initialize ()

The initialization event handler post-processes the maxlength setting.

Returns

booleanIndicating Success

add_elements_to_form ($attributes)

Adds a simple search form and place holder for results.

Also adds static options to results.

Parameters

$attributes

freeze ()

get_default ()

The defaults of the widget are mapped to the current selection.

is_frozen ()

render_content ()

sync_type_with_widget ($results)

Reads the given get/post data and puts to type->selection

Parameters

$results

unfreeze ()

Unfreezes all form elements associated with the widget.

The default implementation works on the default field name, you don't need to override this function unless you have multiple widgets in the form.

This maps to the HTML_QuickForm_element::unfreeze() function.

_add_existing_item_as_static ($key)

Parameters

$key

_add_items_to_form ()

_check_class ()

_check_clever_class ()

_check_renderer ()

_enable_creation_mode ()

_get_key_data ($key, $in_render_mode, $return_object)

Parameters

$key

$in_render_mode

$return_object

_get_request_elements ()

Internal helper for parsing the $_REQUEST data for including the elements requested via GET or POST

Returns

Array

_initialize_from_clever_class ($class)

Parameters

$class

_initialize_from_reflector ()

_is_replication_safe ()

Check that the id_field is replication-safe

_object_to_jsdata ($object)

Parameters

$object

_resolve_object_name ($object)

Parameters

$object

 Properties

 

mixed $allow_multiple

 

string $auto_wildcards

Whether to automatically append/prepend wildcards to the query

Valid values: 'both', 'start', 'end' and (0, '', false & null)

Example:

    'auto_wildcards' => 'both',
 

string $class

Class to search for
 

string $clever_class

Clever class
 

string $component

Which component the searched class belongs to
 

array $constraints

Array of constraints (besides the search term), always AND

Attention: If the type defines constraints, they always take precedence

Example:

    'constraints' => array
    (
        array
        (
            'field' => 'username',
            'op' => '<>',
            'value' => '',
        ),
    ),
 

mixed $creation_default_key

 

mixed $creation_handler

 

mixed $creation_mode_enabled

   

array $generate_path_for

In search results replaces given field with full path to the object

Example: (in topics)

     'generate_path_for' => 'extra',
 

string $id_field

Field/property to use as the key/id
 

mixed $js_format_items

 

integer $min_chars

Minimum characters necessary to trigger a search
 

array $orders

associative array of ordering info, always added last

Example:

    'orders' => array
    (
        array
        (
            'lastname' => 'ASC',
        ),
        array
        (
            'firstname' => 'ASC',
        )
    ),
 

mixed $reflector_key

 

mixed $renderer

Renderer
 

mixed $require_corresponding_option

 

array $result_headers

Fields/properties to show on results

Example:

     'result_headers' => array
     (
         array
         (
             'name' => 'firstname',
             'title' => 'first name',
         ),
         array
         (
             'name' => 'lastname',
             'title' => 'last name',
         ),
     ),
 

array $searchfields

Fields/properties to search the keyword for, always OR and specified after the constraints above

Example:

     'searchfields' => array
     (
         'firstname',
         'lastname',
         'email',
         'username'
     ),
 

boolean $sortable

Should the sorting be enabled
 

array $static_options

These options are always visible
 

array $widget_elements

The group of widgets items as QuickForm elements
 

mixed $_added_static_items

 

\class $_callback

In case the options are returned by a callback, this member holds the class.
 

mixed $_callback_args

The arguments to pass to the option callback constructor.
 

string $_callback_class

In case the options are returned by a callback, this member holds the name of the class.
 

String $_element_id

id of the input element
 

Array $_js_widget_options

Array of options that are passed to javascript widget
 

string $_jscript

The javascript to append to the page
 

\class $_renderer_callback

Renderer callback
 

array $_renderer_callback_args

Renderer callback arguments
 

string $_renderer_callback_class

Renderer callback class name
 

mixed $_static_items_html