Pergunta

this question might be a bit special. I am using this Joomla 2.5 extensions to give authors the abilty to add Attachments to articles: Joomla Attachments

The extension renders an input field called "description" in a backend form to insert an file description for the provided file. Unfortunately it´s not taking HTML tags which I need. By saving the form it seems a strip_tags() or preg_replace() or something similar cleans the input. I combed through the code of the attachments extension but couldn´t find a place where the input is cleaned or saved.

To hopefully stay in the Question + Answer rule of Stackoverflow:

Is there a class which extensions inherit from the Joomla Core to save form data to a DB-table ( which also could be responsible to clean and validate user input )?

thanks for any idea,

tony

Foi útil?

Solução

You should see how the field is defined first:

1. Form definition

look into the

administrator/component/yourcomponent/models/forms/somename.xml

there you could find a form definition, if so it will also specify the field type: depending on the type there are several available filters; for example the default textarea will strip html, and you need to set

filter="raw"

in order to enable it. see http://docs.joomla.org/Standard_form_field_and_parameter_types for a list of fields, click and you can find the available format options.

2. model

If the model inherits from JModelAdmin or JModelForm or other JModel* it will automatically handle binding of the forms' data to the database, look for the Save function which should receive the form $data.

3. more There are at least another dozen possibilities. If the above didn't help, try finding the form: possibly you could find it just by looking at the markup. Once you have the form, check the following fields:

  • option
  • task
  • view

This should help you find the php code that is invoked based on the form:

  • if view is set, maybe in ./views/someview/view.html.php you could find the saving logic.
  • if task is set, look for a function with the same name in ./controller.php
  • if task contains a ".", look for the controller in the ./controllers/ folder.
  • if option is not the name of your component, your component is sending the data to another component for saving, and most likely set a return-url
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top