Skip to content

Instantly share code, notes, and snippets.

@dreadfullyposh
Created June 20, 2013 01:53
Show Gist options
  • Save dreadfullyposh/5819725 to your computer and use it in GitHub Desktop.
Save dreadfullyposh/5819725 to your computer and use it in GitHub Desktop.
// if field_id_4 is your playa field it works like this
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
$this->EE->api->instantiate('channel_fields');
$data = array(
'title' => $entry->title,
'field_id_4' => '',
'field_ft_4' => 'none',
'entry_date' => time(),
'edit_date' => time()
);
$data['field_id_4']['selections'] = array($site->entry_id);
$this->EE->api_channel_fields->setup_entry_settings(2, $data);
$this->EE->api_channel_entries->submit_new_entry(2, $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment