Term List on Homepage

52 views
Skip to first unread message

r.ruti...@docuteam.ch

unread,
Feb 11, 2021, 10:37:08 AM2/11/21
to AtoM Users
Hi all

I tried to load the term list into my custom Theme /modules/staticpage/homeSuccess.php by adding the line:

<?php echo get_component('term', 'treeView') ?>

After that I get a 500 Error. 

Log:
[error] 1132#1132: *685 FastCGI sent in stderr: "PHP message: Unknown record property "ancestors" on "QubitStaticPage"" while reading response header from upstream, client: 10.0.2.2, server: _, request: "GET /index.php/?sf_culture=de HTTP/1.1", upstream: "fastcgi://unix:/run/php7.2-fpm.atom.sock:", host: "localhost:8484", referrer: "https://localhost:8484/index.php/"

Does somebody know what I'll have to do?

Roger

José Raddaoui

unread,
Feb 22, 2021, 9:57:25 AM2/22/21
to AtoM Users
Hi Roger,

To display the terms tree-view in the homepage you'll need to select a taxonomy or a term first, and also modify the related component to avoid taking that taxonomy/term dynamically from the URL. So, in the homeSuccess template you could set the taxonomy as follows ...

<?php echo get_component('term', 'treeView', array('resource' => QubitTaxonomy::getById(QubitTaxonomy::SUBJECT_ID))) ?>

Change SUBJECT_ID by PLACE_ID, GENRE_ID or the taxonomy you want to display. And overwrite the following component in the theme:


Wrapping line 24 within the following condition:

if (!isset($this->resource))
{
  $this->resource = $request->getAttribute('sf_route')->resource;
}

I have not fully tested this, but I hope it sets you on the right direction.

Best regards,
Radda.

r.ruti...@docuteam.ch

unread,
Feb 27, 2021, 3:43:30 PM2/27/21
to AtoM Users
Hi Radda

It works very well, thanks a lot!

I ran into a small bug, well, just a strange behaviour really. 
On your demo-Site, I tried to recreate what I have seen on my own AtoM-Site, and it looks the same.

Steps to reproduce:
1) create a child term (subject) to "Access systems"
3) the arrow shows to the bottom, although the child element(s) are not shown by default. i think it's rather disturbing.
atom-term-1.JPG
4) when you click on the arrow next to "Access systems", the arrow has the correct direction (to the right), and the list becomes shorter, and the three dots appear.
atom-term-2.JPG
5) click again on the arrow next to "Access systems", finally the child appears, and the arrow is pointing to the bottom, which makes sense.
atom-term-3.JPG

How would you fix that? 
I think in my case, I am going to replace the CSS class "ancestor" of the first <li> with the class "expand" with jQuery on document ready. Then it'll look fine.

Kind regards
Roger

Reply all
Reply to author
Forward
0 new messages