How to add a custom form to sulu CMS (example: complex contact form) and save values to database? Is there any good example? Documentation does not mention about custom development.
Regards,
As long as your forms are static (meaning the content manager is not able to choose which fields are appearing), you can simply do what is described in the Symfony documentation.
There are two (probably even more) different possibilities to include Symfony forms:
The first one is to create your own route and controller, working with Symfony forms as you would do in any other Symfony application.
The second one is to use the template system of Sulu as described in our documentation. Then you can add a few fields for content management around the form the content manager can use. In the template defined in the <view> tag of the XML you can again use Symfony form stuff. If you need any special information from the system you can even change the <controller> tag of the XML, to pass more than only the data from the content management.
There are also some ideas concerning a more sophisticated form manager floating around, but that's far from being published.
Related
I am using Sonata Admin bundle in my Symfony app with doctrine. Now I am facing to some specific requirement whose solution or good/best practice I could not find anywhere.
To explain my issue I will use three simple entities as below.
So every news can have title and description different for every language.
Now what I need. In form view (detail) of news I want to:
have inputs of news attributes. (like code or created_date in this case)
then I want to see titles and descriptions for all languages related to current news. And in case, that news has not translation for some language, it means that there is no relation in News_Translation, I want to see empty inputs.
So everything in one view (maybe split it into more tabs). And here is a simple example of news detail (form view) for better understanding
Is it possible to attain something like this? I am open to any other ideas how to solve it using sonata-admin.
KunstmaanTranslatorBundle is a bundle which enables editing translations in the admin interface without need for editing the translations files. Translations will be stored in a (default) database and retrieved on the most efficient way possible.
KunstmaanTranslatorBundle
Doc
I'm developing a template system for webpages. A template consists of the following properties.
A name (part of the "template" class)
Sections (linked to the template class)
Fields (linked to a section)
It's pretty basic and it works when I got the template all setup in the database itself.
Now I want to create a template in my CMS application. To accomplish this I have rendered a pretty basic formtype form which has the name property of the template.
After the user has entered a name for the template, the user should be able to create sections and fields on the fly(directly from the rendered page itself). To spare me some time I want to ask you if it's possible to attach the sections and fields to the formtype dynamically so Doctrine can pick it up and persist the objects automatically without too much trouble.
What you are looking for is probably a combination of Form Events and Collection of Forms
I'm creating a module in joomla 2.5, I would like to fetch data from a component to a module configuration like what would happen to this one:
<field
name="catid"
type="category"
extension="com_content"
published=""
label="Category"
description="A content category"/>
I'm aware that this specific sample code from my module XML configuration file would able to fetch a list of categories from the component com_content, but I couldn't figure out where it's coming from, how does joomla do this? could I also enable my custom components to do it? if yes how? I'm not sure if this was asked before in this forum but I'm really having a hard time to figure it out if you could give me a link that will teach me how to do it that would be great. :)
When you create a component with it's various models, you can create custom forms for them as you're probably aware. This lets Joomla! do a lot of the backend form work for you - all you have to do is define the contents/structure for the form in a XML file.
Of course, Joomla! can't know about every data type so forms need to be extensible. To this end Joomla! provides support for custom form field types... these are defined alongside the forms directory in your model, in a fields directory.
By defining an extension and type value you tell Joomla! to use that specific extension's field type. So for your example field Joomla will look for /administrator/components/com_content/models/fields/cateogry.php
You can read more about "Adding a new field type" in the tutorial on creating a component.
I am writing a component for Joomla 1.5. There is a need for a Form in it, infact three forms are needed.
I have searched and looked a lot but could not find where to start so that i should be able to show the form on the front end. The forms will show up in the front end depending upon user information. There will be some difference in each from.
How can i program the form? I know how the components are written, but confused about how forms are integrated in components.
Here you can find a good tutorial about creating a Joomla Component http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
Probably you have to create 3 views for each form.
I have some joomla articles. some values in that article has to be updated by data obtained through a soap call to other site. Is there any plugin available for joomla by which i can embed custom php inside articles?? How can i do this.??
To me, the ideal way is to create a traditional component that gets all the data. This component inserts these values in specified article ids. These articles act as "data containers".
Why create a traditional component? Because you'll be going to use libraries, error corrections and such and a component solution can be more robust. IMHO it's a good idea to avoid php logic in your editor panel.
Then, in the articles that are shown to users in the frontend, using Include Content Item Joomla Plugin, you add {include_content_item 123}, being 123 the id of the article you inserted data you want to show in your component. Doing the {} call outputs the article which id is "123".
Check out the Joomla plugin repository for "custom code in content"
Good luck!
There are a lot of such component, they are more or less the same.
I use Sourcerer, but pay attention as version of php is crucial sometimes.
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-content/5051
Allows to insert php/js/css code to articles and modules.