Jump to content

Recommended Posts

Posted

Hello everyone,

Is there a way to access the key number of an item in a page reference field and then output it as a value?
So for example I want to automatically output the number 1 if the referenced page is the first in the list and have it be updated when the list is reordered via drag and drop.

Thanks in advance!

Posted
6 hours ago, wesp said:

and then output it as a value

In the frontend? Or right in the backend GUI, whenever you re-order page references?

Posted
22 hours ago, wesp said:

Is there a way to access the key number of an item in a page reference field and then output it as a value?

You're nearly answering your own question there. The key is the position number in the field (zero-indexed like all arrays).

Using this field as an example...

2019-12-05_214504.png.e2557e32afc1ec8199f8ff06279e16fa.png

The key is the position:

2019-12-05_214759.png.7959f5f73b79af31b31c3d0e6479e7c4.png

 

  • Thanks 1
Posted

yes that works!! thanks

the => command was what I was missing, I had actually tried to get the $key with a bunch of other commands and didn't know about this one

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...