I've got a custom plugin where I'm trying to update a global variable. The variable field type is of type
I'm getting the set using
getSetByHandle then using
getContent on the set. However, when I do a
count on the retrieved content, the value is 1. I have about 10 global variables so would've expected a
count of 10.
I'm clearly doing something wrong, so a nudge in the right direction would be appreciated.
Here's the code I'm currently using
$global_set = craft()->globals->getSetByHandle('globalVariables'); $selected_poll = craft()->entries->getEntryById($poll_id); $content = $global_set->getContent(); craft()->globals->saveSet($globalSet);
I've also tried the following, with no luck:
$globalSet = craft()->globals->getSetByHandle('tempSet'); $content = $globalSet->getContent(); $content->currentItem = craft()->entries->getEntryById($itemID); $globalSet->setContent($content); craft()->globals->saveContent($globalSet);