Displaying elements from one element set in another

8 views
Skip to first unread message

Caitlin Nelson

unread,
Apr 29, 2014, 11:24:40 PM4/29/14
to omek...@googlegroups.com
Hi guys, 

This may have been answered somewhere already, but I wonder if it's possible to display an element from one set on the tab for another?  For example we're creating custom element sets that will appear on tabs designed to be viewed by different users (don't worry about permissions here...) - if we have say "Extent" as part of the "Partner Element Set", is it possible to call it in to display on the "Admin Element Set" tab?  I'd like the same element to appear in two places with the value entered in it to also appear in two places.

I know how to call elements into a new tab, but I'm not quite sure how to call it into an existing tab.

Thanks for the help, as always :)

Caitlin

Patrick Murray-John

unread,
Apr 30, 2014, 10:06:54 AM4/30/14
to omek...@googlegroups.com
Caitlin,

If I'm following right, you are happily using the admin_items_form_tabs filter to add in your new tabs? If so, I _think_ you could make the changes to existing tab within the same filter. (I haven't tried this yet).

You could add content to the end of an existing tab just by looking it up in the array of tabs that's passed in. The keys and values are the name of the tab and the HTML content.

To dig up the particular elements, you could use something like this:

$elementTable = get_db()->getTable('Element');
$extentElement = $elementTable->findByElementSetNameAndElementName('Partner Element Set', 'Extent');

The second line is the pattern for digging up the elements. To turn it into the HTML for the form with the correct data filled in you'd do something like:
 
$extentHtml = element_form($extentElement, $item);

The $item is passed to the filter in the $args parameter
$item = $args['item'];

Then you would add that HTML to whichever form tab from the array of tabs.

Like I said, I haven't tried it, so there might be things I'm missing, but that's at least what I'd try first. Also, with the same element appearing on multiple tabs, I'm pretty sure that new values will stack up. That is, if you put "2 meters" as the extent in one tab, then switch to another tab and put in "2 feet", I'm pretty sure that both values will get recorded, which might be a complication.

Hope that helps
Patrick
--
You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omeka-dev+...@googlegroups.com.
To post to this group, send email to omek...@googlegroups.com.
Visit this group at http://groups.google.com/group/omeka-dev.
For more options, visit https://groups.google.com/d/optout.

Caitlin Nelson

unread,
Apr 30, 2014, 10:14:48 AM4/30/14
to omek...@googlegroups.com
Hi Patrick,

I'm actually feeling kind of ambivalent about our tabs, and perhaps stepping back and asking your advice would be good.  I think there are two ways to go: (a) one giant element set, with custom tabs calling in different elements to separate them out visually / workflow-wise, or (b) separate element sets, each with their own automatically-created tab.

I am actually leaning towards (b), because that means that naming conventions will be easier (I don't have to have 160 unique field names, since I can duplicate field names across element sets), because the tabs are already set up and with the order elements plugin we can reorder them through the GUI rather than a hard-coded tab plugin, and because it just seems cleaner over all. 

But I'm running into issues where it would make more sense to have one element set and just do the separating via another display plugin. Argh Argh.  I think I'm stuck because I don't want to make a design decision now that seems to make things easier, but 6 months down the line when all our metadata is finally in place we realize the opposite.

Given that I'm leaning toward separate element sets, do you have any particular advice?  Thanks, as always for the info and the great conversations :)

- Caitlin


--
You received this message because you are subscribed to a topic in the Google Groups "Omeka Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omeka-dev/4DZGNGdIkYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omeka-dev+...@googlegroups.com.

Patrick Murray-John

unread,
Apr 30, 2014, 10:39:46 AM4/30/14
to omek...@googlegroups.com
Caitlin,

Yeah, that's a sticky question! I'm leaning the same way, though, to separate element sets. It sounds like there are good reasons for it now, and having them in separate element sets sorta lets you have another piece of data that you can use about the elements. That is, with the extra data distinguishing element sets, you have more info to work with when building the tabs. If changes need to happen later on, it will be easier to go from having more information to less, than going the other direction.

Patrick
Reply all
Reply to author
Forward
0 new messages