Perform a custom validation on the texts for any particular element.
This filter’s name is actually an array of strings. The first string must always be ‘Validate’, but the last three can change depending on exactly what values you want to validate.
array('Validate', $recordType, $elementSetName, $elementName)
string text
The text for the element
Omeka_Record_AbstractRecord record
The record (subclass of Omeka_Record_AbstractRecord) being validated.
Element element
The element (e.g., Dublin Core Title) for the element text.
class MyPlugin extends Omeka_Plugin_AbstractPlugin
{
protected $_filters = array('itemTitleLengthValidator' => array('Validate', 'Item', 'Dublin Core', 'Title'));
public function itemTitleValidator($isValid, $args)
{
$text = $args['text'];
if(strlen($text) > 100) {
return false;
}
return true;
}
}
ElementText::_elementTextIsValid