Element ElementForm Filter

Usage

Customize the form for a particular element. This only applies to forms generated by the element_form() helper function.

The name is an array:

array('ElementForm', $recordType, $elementSetName, $elementName);
  • $recordType: The type of Omeka object to filter the metadata for. Most commonly, this will be ‘Item’.

  • $elementSetName: The name of the element set containing the metadata field to be filtered. Possible values include ‘Dublin Core’ and ‘Item Type Metadata’.

  • $elementName: The name of the specific element within the set to be filtered.

Value

array $components

The form components, like:

$components = array(
    'label' => $labelComponent,
    'inputs' => $inputsComponent,
    'description' => $descriptionComponent,
    'comment' => $commentComponent,
    'add_input' => $addInputComponent,
    'html' => null
);

Except for 'html', the array elements are the components that will be combined together to make the element form. Uniquely, setting a string to the 'html' key will use that string directly as the complete HTML for the element form, ignoring all other values.

Arguments

Omeka_Record_AbstractRecord record

The model being edited.

Element element

The element being edited

array options

An array of additional options for the form

Examples

class MyPlugin extends Omeka_Plugin_AbstractPlugin
{

    $_filters = array('relabelItemTitle' => array('ElementForm', 'Item', 'Dublin Core', 'Title'));

    public function relabelItemTitle($components, $args)
    {
        $components['label'] = "Label";
        return $components;
    }
}

See Also

Element ElementInput Filter