This is my first ever EE add-on… So i’m a bit lost….
I’ve managed to get my add-on to install and create a database and install a tabs file as well.
I can submit data from my tab to the database perfectly. It also deletes duplicate entries if they exist.
But the problem i’m having is displaying data in the fields of the tab, that already exists in the database.
I’m guessing I need to grab the Entry_id and do a comparision somewhere to then pull the data through?
I currently have this:
$settings[] = array(
'field_id' => 'open_graph_title',
'field_label' => $this->EE->lang->line('field_open_graph_title'),
'field_required' => 'n',
'field_data' => $selected_title,
'field_list_items' => '',
'field_fmt' => '',
'field_instructions' => '',
'field_show_fmt' => 'n',
'field_fmt_options' => array(),
'field_pre_populate' => 'n',
'field_text_direction' => 'ltr',
'field_type' => 'text'
);and
function publish_data_db($params)
{
/* Remove existing DB row IF matching Entry ID exists */
$this->EE->db->where('entry_id', $params['entry_id']);
$this->EE->db->delete('mbm_open_graph_entries');
/* Insert */
$data = array(
'entry_id' => $params['entry_id'],
'title' => $params['mod_data']['open_graph_title']
);
$this->EE->db->insert('mbm_open_graph_entries', $data);
}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.