TransWikia.com

Update field within Table using column handle in CraftCMS

Craft CMS Asked by mooonli on March 3, 2021

I am writing a CraftCMS plugin out of which I need to update an existing Entry. Within this entry there is a field of type table which has some columns (with custom handles). No I d like to update one of those columns using my Plugin.

The thing is I cannot find out how to access the columns using my custom handles from within my plugin to update them. If I access the column using Craft’s default col1/2/… keys it works, but not with my custom handles.

Lets say col3 has a customHandle named "myHandle".

example how it works:
$table[$rowId]['col3'] = "123"

example how it does not work:
$table[$rowId]['myHandle'] = "123"

So to me it looks like its possible to use those custom handles to read values (since it works in twig files) but not to update values. Is that possible? And if yes, is there a way on how I can find out the corresponding key for a custom handle? So to find out that col3 belongs to myHandle?

I am looking forward to your help.

Thx in advance.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP