Hi Everyone,
I’ve developed a custom field for storing nutrition information for food products. There is now just one small glitch remaining that I can’t figure out.
I need to be able to access the settings for the particular field but I only see global settings stored in $this->settings… Where can I find the settings specified under admin -> channel administration -> custom fields?
Thanks!
Hi Pascal,
I am trying to access field settings from the replace_tag() method.
I believe my initial mistake was sticking the global settings into an array with the same name as the field-specific settings. The global settings are really only used to provide default values for when a new field is created. I have since changed the name of the global array but still can’t see anything else inside the settings property.
If you are saying that I should be able to see the field settings under the following circumstances then I will go looking for whatever I’ve done to clobber them:
function replace_tag($data, $params = array(), $tagdata = FALSE)
{
$stuff = $this->settings['field_settings'];
...
}Thanks!
So I ended up having to pull the field settings directly out of the database as follows:
$query = $this->EE->db->query('SELECT field_settings FROM exp_channel_fields WHERE field_id="'.$this->field_id.'"');
if ($query->num_rows() == 1) {
$query = unserialize(base64_decode($query->row('field_settings')));
}Please let me know if these settings are already in memory so I can avoid an unnecessary query. Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.