Plugin defined filters for SimpleVocab

I would like to add the plugin SimpleVocab to another plugin that I have for handling persons. I alter the file SelectFilter.php in the SimpleVocab plugin like this:

foreach ($simpleVocabTerms as $simpleVocabTerm) {
if($this->startsWith($simpleVocabTerm->element_id,"p-")){ //Persons
$individualElements = $individ->getElements();
$elementName = $individualElements[substr($simpleVocabTerm->element_id,2)];
add_filter(array('sofie-individuals', ' individuals', "Persons", elementName),
array($this, 'filterElementInput'));
}else{
$element = $db->getTable('Element')->find($simpleVocabTerm->element_id);
$elementSet = $db->getTable('ElementSet')->find($element->element_set_id);
add_filter(array('ElementInput', 'Item', $elementSet->name, $element->name),
array($this, 'filterElementInput'));
}
}

, but I don’t know how to catch the filter that I've added above in my other plugin where the add/edit forms are displayed and need the vocabulary dropdowns. The forms are created in my plugin like this

$form = new Omeka_Form_Admin($formOptions);
$form->addElementToEditGroup('text', 'efternamn',array(
'id' => 'individual-givenname,
'label' => __(Givenname),
'value' => $individual->givenname,
'title' => __(The givenname (mandatory)')
)
);
…..

Has anyone done this (applied filters) on data other than what’s included in the vanilla Omeka (Items, Collections, etc). How to add it to Collections is somewhat described in http://omeka.org/forums/topic/simple-vocab-for-collections, but that doesn'ät relly apply to this problem.

Any hints or help is really appreciated!

Regards,
Daniel Lind

You use apply_filters to actually run filters added by add_filter.

You may not be able to simply use the filterElementInput method provided by Simple Vocab, though: it's written under the assumption that it's going to be used on an Element data form.

Thanks John! I've almost got it working thanks to your answer. I just have to figure out how to pass variables from the add_filter to the filter function.