Element ElementInput Filter

Usage

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

The name of the filter is an array:

array('ElementInput', $recordType, $elementSet, $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 input components, like:

$components = array(
    'input' => $formTextarea,
    'form_controls' => $removeButton,
    'html_checkbox' => $useHtmlCheckbox,
    'html' => null
);

Arguments

string input_name_stem
The name of the input, e.g., Elements[1][0]
string value
The value for the input
Omeka_Record_AbstractRecord record
The model being edited
Element element
The element being edited
string index
The index of the input for the element
boolean is_html
Whether the input uses html

Examples

class MyPlugin extends Omeka_Plugin_AbstractPlugin
{

    protected $_filters = array('shortenSubjectField' => array('ElementInput', 'Item', 'Dublin Core', 'Title'));

    public function shortenSubjectField($components, $args)
    {
        $components['input'] = get_view()->formText($args['input_name_stem'] . '[text]', $args['value']);
        return $components;
    }
}