I am trying to get a custom field value on entries.onBeforeSaveEntry
, event. So I can perform some action depending on the value of that field.
craft()->on('entries.onBeforeSaveEntry', function(Event $event)
{
$entry = $event->params['entry'];
$entry->publishOnMobileApp; //publishOnMobileApp is the field handle
});
Now this line.
$entry->publishOnMobileApp;
Returns
Craft\MultiOptionsFieldData Object (
[_options:Craft\MultiOptionsFieldData:private] =>
Array ( [0] => Craft\OptionData Object
(
[label] => Yes [value] => yes [selected] => )
)
[storage:ArrayObject:private] => Array()
)
I am not sure how exactly I can access just the value of the field (which is "yes" in this case) so I can perform a check.