1 users online. Create an account or sign in to join them.Users
Fetching `$dsParamINCLUDEDELEMENTS` in `appendFormattedElement()` context?
This is an open discussion with 13 replies, filed under General.
Search
This seems to be tricky. Does anybody know if the name of a data source is available anywhere in the field context?
I don’t think so, I think Symphony makes it a point to treat each Field as a blackbox.
I believe not. They are de-coupled so that a field doesn’t know about the Data Source that is calling it. The only way of really communicating between the two is to use delegates. There is only a single delegate that fires during DS execution and that is DataSourceEntriesBuilt.
I’m guessing the reason is that appendFormattedElement might not always be called by a Data Source, so leaving the implementation more open.
For the appendFormattedElement method to know about the DS you’d need to pass a reference to the DS object through the call to appendFormattedElement in datasource.section.php. I think. But I don’t think it’d be good practice to do so.
Brendan can say in 15 words what I need 100 to ;-)
Haha, as soon as I posted that though I found this on php.net.
Perhaps this could be of use in a roundabout sort of way?
Hm, get_called_class() looks good but it requires at least PHP 5.3 but Symphony is supposed to work with PHP 5.2.
Maybe I have to rephrase: Does anybody know a simple solution to offer a subselection of included fields for a field like Subsection Manager or Mediathek directly in the datasource manager?
I don’t.
Could you add another “Included elements” to the field’s configuration for when you add it to a section? This could then give you the option in a Data Source to choose:
photos: items onlyphotos: included elements onlyphotos: all elements
This is Bi-Link-esque: the items only replicates the <item>...</item> of a Select Box Link, included elements only would be the fields you’ve selected in the configuration of the field, and all elements would be all elements from the section.
Adding fine-grained control would be a nice to have, but I think it’s by no means a necessity. We do have Output Parameters for chaining after all.
You might even find that the field: mode structure is limited to a single colon. I don’t quite know how the string parsing is done, but from what I gather it was never intended to support field: sub-field: mode.
I don’t quite know how the string parsing is done, but from what I gather it was never intended to support field: sub-field: mode.
I know …
Is there a chance that Symphony 2.1 will offer more fine-grained options for extension developers in this area?
Lemme talk to A&A and I’ll get back to you.
Lemme talk to A&A
lol
Actually I’m going to start calling them “the A’s”
Create an account or sign in to comment.
Similar to the
formattedandunformattedoptions for textareas, I’m trying to build a direct selection system for subsection fields in the data source editor using my Subsection Manager. In other words I’m trying to add a list of all subsection fields to the data source’sincluded elementslist like this:photos: namephotos: filephotos: description: unformattedphotos: description: formatted(
photosrepresents a Subsection Manager field)While adding this list to the data source manager via
fetchIncludableElements()is quite easy it seems not to be possible to fetch the user’s selection when building the XML on data source execution.Does anybody know if it’s possible to acces the
$dsParamINCLUDEDELEMENTSvariable inside theappendFormattedElement()function which has been called by the current data source? Or at least the name of the current data source which would make it possible to access the data source file containing this variable directly.