Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional exhibit configuration ideas (that should be fairly easy to extend) #3

Open
wgilling opened this issue Mar 22, 2018 · 3 comments

Comments

@wgilling
Copy link
Contributor

I believe that each block's configure could really use a couple more settings.

  1. Sort field to order the results (the default order may not be desired, but rather the object's issued date)
  2. additional Solr filter (supposing that we only want the images from a collection that contains more than one type of object -- or whatever filter condition that could be imagined).

Please let me know if you would prefer that I forked your repo and made these changes as a pull-request.

@simonhm
Copy link
Owner

simonhm commented Mar 23, 2018

Those add-on sort/filter features should be useful in some cases.
Sure, it's great if you could fork and make those changes.
I'm in process of setting up a new site for our customer. So I can't focus on this module now.
Thanks.

@wgilling
Copy link
Contributor Author

I was not certain in the little time I spent in the code how to add these options to the existing "islandora_exhibits_browse_fields_data" -- it does seem that these options should be available for each exhibit that is created, so it would need to be represented as two individual values to these islandora_exhibits_browse_fields_data fields, right?

I stopped because I didn't see a clear way to pull the fields for a given exhibit without the "hack" approach which would need to inspect the current URI to get the exhibit path -- and then loop through all the fields to find the one that has ['path'] = the current exhibit path to then get that field settings' related Solr sort field and Solr filter. (to me it seems like a bit of a hack way to get the right field settings)

If you feel that my understanding of that drupal variable is correct, I can proceed, but I really don't want to change anything that causes any issues down the road.

Thoughts?

@simonhm
Copy link
Owner

simonhm commented Mar 23, 2018

it does seem that these options should be available for each exhibit that is created, so it would need to be represented as two individual values to these islandora_exhibits_browse_fields_data fields, right? <<< Correct !

You can add those 2 options as same as I've done for headline, description, start_date (in islandora_exhibits_browse.admin.inc) .... for each exhibit that is created.

$headline = isset($fields_data[$key]['configuration']['timeline']['headline']) ? $fields_data[$key]['configuration']['timeline']['headline'] : 'dc.title';

The loop is you're talking about is here:

foreach ($fields as $key => $value) {

$list_fields is an array variable I use to pull out those fields:

$list_fields = $value['configuration']['timeline'];

If you use dpm($list_fields), you will see:

image

So we will need to create 2 more options in the configuration exhibit page named as: sort_field and filter_field
You will pull their values by: $list_fields['sort_field'] and $list_fields['filter_field']

We will need to update this function:

function islandora_exhibits_browse_build_results($solr, $pid) {

Adding the $list_fields when calling this function, something like this: function islandora_exhibits_browse_build_results($solr, $pid, $list_fields) {

And then $fl_params and $sort_params will be made based on this $list_fields << This is what I was planning to do with $fl_params ^_^

and then this line will need to be updated as well:

$result_fields = islandora_exhibits_browse_build_results($solr, $pid);

It should be like this: $result_fields = islandora_exhibits_browse_build_results($solr, $pid, $list_fields);

Simon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants