We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Input data into tab field

Development and Programming

MAYO's avatar
MAYO
53 posts
13 years ago
MAYO's avatar MAYO

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);
    
 }
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.