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
$componentsThe input components, like:
$components = array( 'input' => $formTextarea, 'form_controls' => $removeButton, 'html_checkbox' => $useHtmlCheckbox, 'html' => null );
Arguments
string
input_name_stemThe name of the input, e.g.,
Elements[1][0]
string
valueThe value for the input
Omeka_Record_AbstractRecord
recordThe model being edited
Element
elementThe element being edited
string
indexThe index of the input for the element
boolean
is_htmlWhether 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;
}
}