Changing Reusable Elements Content Type Dynamically

I have a reusable element for the classic menu items like Edit, Archive, Delete.

Right now it’s set to ‘Properties’, but I also want to use is on another data type called ‘Rooms’.

Is this achievable/possible?

Cheers!

Sure, just use custom states…

Thanks for coming back to me. I was trying to get this to work… unsuccessfully. Seems like I can change the Data Source but not the Type of Content

Could you give me a pointer in the right direction for what the expression would look like?

Just add a custom state of each type of data you want to work with (forget about the Type Of Content)…

Then, whenever you display the element, just set the relevant custom state value with the specific data you want to work with.

Then just use conditions on the internal elements and workflows to change the correct data depending on the custom state values of the element.

Be sure to clear the custom state values whenever the element is closed.

Awesome idea with the custom states. I think I’m following your advice, but still hitting a wall and perhaps I’m missing something obvious.

I’ve created the custom state for my two data types on the Reusable element itself:

And when the Icon is clicked I added in the workflow to set the state:

You can see that it’s asking me to change the parent content type but I would like it to be set depending on the result of the custom state. That way I can use the element on different repeating groups of different data to delete, edit, archive etc.

Where am I going wrong here?

Thanks for the help though brother and sorry if I’m being a bit noob!

I’m not entirely sure what you’re asking (or what you’re trying to do)…

But, it looks as though the parent group doesn’t have a defined content type… so you can’t use that to set the Property Data custom state value…

So, you’ll either have to set the parent group’s content type to Property, or define the specific Property you’re trying to set the custom state value to some other way (depending on exactly what you’re trying to do and where that data is coming from…)

If you have workflows right on those buttons then I don’t think what you’re trying to do is possible, because your workflows to trigger the delete will be “Delete a thing” and you’ll need to hardcode pick a specific data type.

What you can do is reuse the element just the visual part, and put custom states right on the reusable element like a “yes/no” for each button. But then you’ll need to setup some “If condition is true” workflows so when the button is pressed, it sets the specific custom state to yes. Then when you drag that reusable element onto your page, have another “If condition is true” workflow for each yes/no and have that trigger what you want the button to do.

It might be easier just to clone the reusable element and make them specific to each page, because later if you add a button you only want specific for the Property then it’s going to show up for the Room as well. And it just sounds complicated setting up :joy:

1 Like