{{uri}} in query causing illegal offset type

Hi

I’m trying to output full paths of site grandchildren pages from a select box in the panel so that I can use this later on with a $site->find($grandchild) call in my template.

My blueprint looks like this

linked-courses:
  	label: Link courses
  	type: select
  	options: query
  	query:
  		page: /
  		fetch: grandchildren
  		template: course-single
  		value: {{uri}}

However, this is throwing an error in the panel: Warning: Illegal offset type in /panel/app/src/panel/form/fieldoptions.php on line 104

If I remove the value altogether from the blueprint I get the uri, but without the preceding parent, which I need for the $site->find() to work.

So, is there a better way of getting the full path? What I actually need is to be able to get the children of siblings in the select and then show whichever one is selected… I kinda need a fetch: nieces and nephews option in the query!

I should mention that the parent of these grandchildren can vary, so I can’t hardcode the parent in to the ->find() call.

Is this a bug? Other answers to similar questions suggest the above blueprint template. I’m using version 2.2.3

Thanks in advance!
Nick

You have to wrap the value in quotes:

linked-courses:
  label: Link courses
  type: select
  options: query
  query:
    page: /
    fetch: grandchildren
    template: course-single
    value: '{{uri}}'

If that still does not work, add the text paramter as well:

linked-courses:
  label: Link courses
  type: select
  options: query
  query:
    page: /
    fetch: grandchildren
    template: course-single
    value: '{{uri}}'
    text: '{{uri}}'
1 Like

Oh my word. I’m an idiot. THANK YOU!