Closed pprw closed 6 years ago
The term is a property term, something like $term = 'dcterms:subject';
.
And type is properties
(default) or resource_classes
.
Thanks! It is working.
Three questions:
I tried to limit the result to a collection with 'query' => ['item_set_id' => '6717'],
but it didn't work. Why?
Is it important to select a property in the module configuration page before using it in the code? I tried with dcterms:title and this property is not ticked in the reference configuration page but it works anyway.
The limit option is for results per page. Is there a way to have all "A" result in one page, then all "B" result and navigate through the heading bar?
<?php
$term = 'dcterms:title';
echo $this->reference()->displayListForTerm($term,
[
'type' => 'properties',
'resource_name' => 'items',
'order' => ['alphabetic' => 'ASC'],
'per_page' => null,
'query' => ['item_set_id' => '6717'],
'page' => null,
],
[
'query_type' => 'eq',
'link_to_single' => true,
'total' => true,
'skiplinks' => true,
'headings' => true,
'raw' => false,
]
);
?>
For 1, I just check with your query and it works. Does the item set 6717 exist?
For 2, no, it's only limiting the routing (/s/mysite/reference/xxxx
). You can always bypass it via the code or the theme. In fact these pages are not really useful, they are more Omeka Classic related. In Omeka S, users can create the same with standard site pages + blocks. So the routed pages would be removed in a future version of the module.
For 3, the module doesn't manage pagination currently. I think it is manageable via a creation of 26 pages and a query "property xxx starts with" a letter, but the query "starts with" is not implemented in the core yet, unlike Omeka Classic. I just pushed a pull request for it (https://github.com/omeka/omeka-s/pull/1274).
For 1. I just updated the module to the last git version and it works now.
Thanks for the information for 2. and for the pull request for 3 (I think it could be a very useful feature).
The pull request omeka/omeka-s#1274 didn't make the 1.2.0.
I need this function (filter items by "start with") so I applied the commit on my installation. I can now filter by "start with" "end with".
I am now trying to insert this request to my reference block inside a page.
Before my request was only item_set_id=6717
now I want a list of items which are in collection 6717 and starts with A.
In advance search the url is:
http://site/admin/item?resource_class_id=&property[0][joiner]=and&property[0][property]=1&property[0][type]=sw&property[0][text]=A&site_id=&item_set_id[]=6717&submit=Recherche
So I tried to put item_set_id=6717&property[0][text]=A
in the filter field of reference block. It doesn't work.
How can I set the condition "start with A" from the reference block inside a static page?
You have to copy some more variables for the property: ?property[0][property]=dcterms:title&property[0][type]=sw&property[0][text]=A&item_set_id=6717
.
Thanks, it works.
I am trying to add reference to the browse.phtml page.
I pasted this code to the page.
bio:place
is indexed by reference and appears in the /reference page.But I have an error:
Undefined variable: term
.Should I define
$term
somewhere?