When using has_many's or many_many's it is easy in Silverstripe to navigate from one DataObject to the other. But now I would like the same functionality for the has_one's: Add a link to the selected dataobject in the CMS. In this case the format of a has_one in the CMS will become the following:
Title - Dropdown with values - clickable link to selected object.
Is there a way to do this? I don't mind the breadcrumb path to break, or that you'd first have to save in order to show the link.
Couple of approaches here:
I'm assuming you use a GridField for the has_many or many_many lists? If you want to use the same approach, create a temporary list with just the has_one record and use this as the source of the GridField. Use the GridFieldConfig_Base or GridFieldConfig_RecordEditor as the config so you can add or remove the new records. Add the link in the $summary_fields array of your has_one record so it appears on the GridField.
Second (and easier) approach is to add a LiteralField after where you has_one record field is to output the link to the record.
What do you think?
Related
I'm working with Symfony2 to set up a form, where a Shelf-Entity can be edited.
A shelf contains a collection of Readable-Entities (e.g. Book, Magazine, etc. - all inherit from Readable).
The user has the possibility to add more Readable-Entities (the form is extended via JavaScript) and from a dropdown he can select the type of Readable he wants to add. Depending on the selected dropdown-value, different form fields are rendered. So far so good.
Now, when the form is submitted to the server, depending on the Readable-Type the user selected in the form, a different entity-type should be instantiated.
If I don't do anything, Symfony just instantiates the base class Readable (and not Book, Magazine, etc.).
How can I tell Symfony to instantiate the correct type of Readable depending on the selected value from the dropdown?
I tried with FormEvent-Listeners, but:
in PRE_SUBMIT I only get an array containing the "raw" form data with $event->getData(), i.e. no entities have been instatiated so far. However, at this stage, I still have access to value of the dropdown.
in SUBMIT the form data was already assigned to the appropriate entities. Also the new Readable was already instatiated with the base Readable-Class. But now, I cannot access anymore the value from the dropdown.
What is the correct way to do this?
EDIT
Added a minimal Code-Example for the Shelf FormType:
https://gist.github.com/anonymous/401495b701982adafb96
Code for infinite_form_polycollection:
https://gist.github.com/anonymous/b5f0ed10ca9c52177f01
Have you tried looking at this part of the doc? As "embedding a form" seems to fit your needs.
It seems that there was something wrong with the PHP-Files of the PolyCollection in the vendor-directory, because after removing everything related to the Infinite Form Bundle from the vendor-dir and reinstalling it with composer, everything is working now. But thanks for your efforts YoannCh
I'd like to implement a tag system to a SugarCRM that has the following characteristics:
User can create any new tag just by writing the new tag into the tag field
Existing tags are suggested for user to choose, in order to avoid having similar tags (e.g. if user tried to enter "sugar" as tag, it should be suggested for them to choose "SugarCRM")
Search by tag should result only records that have that tag, but not records that have that tag as a keyword in title or description fields
All record in all modules should have a tag field
It would be nice if a search by tag could be made throughout all modules
Does anyone know if there is already some implementation for this?
There are several on SugarForge. I've used SugarTAGS from CARRENET (http://www.sugarforge.org/projects/sugartags/) as a starting point before.
I need a content element that cointains apsects from the "Textpic" and the "Media" content elements.
Basically I need the whole palette of input masks of the textpic CE (headline, rte text, images) plus the media tab (swf, mp4, mov) from the media content element.
This special requirements for our project comes from the need that we can only use one content element for our specific javascript content slieder. So I can not use like a Textpic and underneath a media CE. No it really has to be just one CE which can handle the textpic + the media CE stuff.
Generally I ask you: Is there already a extension, trick, modification or a framework which I can/should be use to achive that i can "fusionate" content elements? Like an "all-in-one"-content element, a multi content element?
Ps: I do not use Templavoila. My Typo3 version is 4.5
I think this is the tutorial you're looking for:
http://castironcoding.com/resources/our-blog/sp/view/single/post/reason-6-for-choosing-typo3-custom-content-elements-and-extbase-again-part-23.html
Follow step 2 and 3.
You'll also need to add a specific rendering config in Typoscript ie: tt_content._your-ce_
But it can be copied from out of tt_content.textpic and tt_content.media. You can find the expample typoscript of before mentioned CE's in: typo3/sysext/css_styled_content/static/setup.txt. Just don't alter it there, but make a copy and alter in your own file.
As you seem to only talk about reusing already exisiting fields, you really only need to change the backend interface (big keyword: "showitem"). You'll need the database names of the fields (peek into the tt_content table of some records where you know the contents), alternatively visit the module Admin Tools / Configuration, select TCA in top dropdown menu, open tt_content and columns.
Try http://blog.chandanweb.com/typo3/adding-new-fields-to-existing-typo3-tables-at-desired-location, you'll of course have to substitue tt_content for tt_news etc.
You might also want to make a new type (the above recipe is for changing a preexisitent), but I'm sorry, I'm currently out of time for explaining that. It's not very hard, though, and the castiron link by Koopa will help you on your way.
Perhaps you can wrap the content column in another div? You can use that outer div for your content slider. Now you actually use all content elements seperately, but combine then for usage.
This is either very annoying or very embarrassing. I've set up most of my blog, but I can't figure out where or how the heck I set up single entry templates as opposed to the section/weblog containing them. I just can't find information on how to do it for the life of me.
This is especially important, because I want to define the canonical link for all entries, since ExpressionEngine links to entries in all kinds of ways.
So, the case is that I have a Blog section/weblog with an index working as the front page for mydomain.com. This lists all my entries as you would imagine a regular blog to do. The problem arises when I need to customize the code for the single entries' links.
If you have a template set up already which is showing a multitude of entries and you want a single entry page for each entry then what you need to do is this :
{exp:channel:entries
channel="default_site"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
Then in the template shown above by template_group/template_name (please change those to whatever your template group and template names actually are ;-) ) you will place this code :
{exp:channel:entries
channel="default_site"
limit="1"
dynamic="yes"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
This will then show you just the one entry as you will have used the {url_title_path="template_group/template_name"} in the first channel entries tag above which would basically create a URI something like this :
http://www.example.com/template_group/template_name/url_title_of_my_posted_entry
On the second (template_group/template_name) single entry template page it will see the URL title and use this to filter down the channel entries tag to just that one entry.
Hope that helps a bit.
Best wishes,
I am creating a Zend Form to allow the user to change the current Locale from a list saved in my DB. I would like to know how to add more attribs to the option list.
$obj_locales_select = new Zend_Form_Element_Select('sel_locale');
$obj_locales_select->setLabel('form-params-language-changelocale-sel_locale-label');
$obj_locales_select->setMultiOptions($this->_arr_locales);
$obj_locales_select->setValue($this->_str_selected_locale);
$obj_locales_select->setRequired(true);
$obj_locales_select->setAttrib('tabindex', '100');
The $this->_arr_locales is just an associative array with key - values. But I want, in example, to add a title attrib to each option generated, so when the user's mouse is over an option, the browser displays a tip with additional info about that option, or some other standard attribs (according to the w3schools OPTION tag).
Thanks for help.
ZF does not support title attribute for Zend_Form_Element_Select options. You should write custom view helper to do that.