-
Notifications
You must be signed in to change notification settings - Fork 0
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
Include additional info in $entityinfo #10
Comments
$entityinfo now contains the mentioned properties as described above:
(If a value has not yet been set for the study, the field contains |
As requested here, $entityinfo now contains a |
In order to support this feature, we need additional properties in I noticed there are two methods in csis_helpers.module which apparently do the same: I want to extend |
They do the same because we need it once done for a node entity and once for a group entity as the source of the data. Since the way how to get the data is different for node and group we have to do it twice in slightly different ways. As far as I can see the the data package uuid is already included in the entityinfo.
So you could load the data package by REST API and extract the properties then. If you want to have the properties direct in the entity info you can extract them in the module in the
blocks in the functions you mentioned (don't forget to do it in both) and then add the value to the
array. Extracting the value might be tricky. Always the same will be the beginning with |
Ah I misunderstood you, sorry. So you want to use the entity info for other than gl-step nodes? First step is to determine which node type we have: change the current code of the function to
In the case part fort the data package node type you can then query the fields of the data package by using
Doing so throws some questions: What if the resource is in more than one datapackage? how to know which one is the correct data package?. After you have done this you will have to modify
Add a
Block for each content type and set in this
When do need this infos? Only if the data package is viewed? I ask because in current design, if you view a page with Study/Step and Datapackage the entitity info will only show the info from one of them. The one which is rendered last.
to something like
|
Ok, thanks. I'll give it a try.
No that's not problem. In Data Package Nodes, I'm only interested in the data package uuid, in resource nodes, only the resource uuid. |
That's a problem. E.g. for this Data Package, |
I've spilt entityinfo in studyInfo, datapackageInfo and resourceInfo in /feature/010-extend-entityinfo. entityInfo should no longer be used. BTW, |
Splitting is what I wanted to suggest. The field spatial extend is an entity reference field so we need the entity which is referenced and get the wanted field value from it.
|
Unfortunately, this doesn't work. studyInfo, datapackageInfo and resourceInfo, etc, always contain all properties of all entity types. I have the impression, that $spatial_extends = $entity->get('field_spatial_extent')->referencedEntities();
if(!empty($spatial_extends) && is_array($spatial_extends) && sizeof($spatial_extends) > 0) This returns |
Now, this statement seems to evaluate to false on the Data Package Node: $type = $entity->bundle();
if ($type == ("gl_step" || "data_package" || "data_package_metadata") && $view_mode != "compact") { |
csis_entity_info.js needs to be updated, too. What's the purpose of this script? Where is it used? |
I was wondering about that myself. That's a question to @fgeyer16, do we even need this anymore? @p-a-s-c-a-l : So for example to check the content of the $spatial_extends it would look like this: From that I learned that for the spatial extend the fields have different names than what @fgeyer16 wrote above. To extract the values, the code should look like this:
In addition I deactivated all your Checking the drupal-settings in the html document for above data package, I found:
Something to keep in mind: |
This was thought to provide helper functions so nobody needs to know where in the drupal settings the entity infos are.If nobody uses this or wants this we can remove this file as well. Regarding debugging: I use kint($variable). This is function/module provided by the devel module. You need to enable the devel Kint module. @patrickkaleta provides dump also information on available methods for objects?
I'm thinking if there is away to fill the entityinfos only if the node is not rendered because it is referenced by another one. |
No it does not. However, I noticed that |
yes that can happen because if you kint() the "right" variable it will load the page multiple times and then run out of memory especially if somewhere in the variable there is a reference to the(a) (sub)variable which can cause some kind of endless loop I assume. In |
@p-a-s-c-a-l: You wait for me to solve that with the additional infos right? Not that we work on the same thing an may against each other as well ;-) |
@fgeyer16 No, finally I've managed implemented all changes I need in https://github.com/clarity-h2020/csis-helpers-module/tree/feature/010-extend-entityinfo, now testing with iFrame Map Components. If this work's I'll merge the branch in DEV. So ATM no action from your side needed. Thanks! |
done |
It would be helpful if we could include some additional properties from study group node in $entityinfo so that we can avoid some API calls in our external components.
ATM we would need
a8ff7930-4a9f-4289-8246-3383ba13c30f
value
property of the geofiled entity, e.g.POLYGON((14.149017 40.8268,14.149017 40.894051,14.316902 40.894051,14.316902 40.8268,14.149017 40.8268))
The text was updated successfully, but these errors were encountered: