ElementInput filters truncate data after submission

It seems that whenever I replace the input field using an ElementInput filter, any data that gets submitted with the replacement either gets lost or is truncated to its first letter. This is seriously impeding the progress of an item builder plugin I’m working on that relies on custom element inputs.

Here is a short unrelated sample demonstrating the issue (actually the exact same one from the Manual):

class DummyPlugin 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'], $args['value']);
        return $components;
    }
}

Try renaming any item with the plugin activated (the “Title” DC field becomes a single line when it is on), it would lose its title entirely. If you add $components[‘html_checkbox’] = false;, you would get the first character only.

I am currently working with the stable 2.4 branch for Omeka classic, with every other plugin turned off. Can someone please look into where this behaviour comes from?

It sounds like what you are after for changing the Title is to use formTextarea instead of formText.

formTextarea makes a textarea, while formText make an input of type text.

The example, admittedly, could be more clear about what it’s an example of and how it works.

I believe this is just an error in the example: the name of the input should be $inputNameStem . '[text]' and not just $inputNameStem.

The missing [text] suffix was it, thank you.

Would you mind if I update that entry for you?

Sorry about that… A wrong example is definitely worse than no example at all.

Improvements and fixes to the documentation are always welcome through its github repository.

Done: https://github.com/omeka/Documentation/pull/29