It certainly is!
Here's what you need to do (From the manual) based on your example :
//get the row to edit
$query = ee()->db->select('title, url_title')
if ( $query->num_rows() > 0 )
$row = $query->row();
$data = array(
'entry_id' => $entry_id,
'title' => $row->title,
'url_title' => $row->url_title,
'field_id_306' => '10'
$success = ee()->api_channel_entries->save_entry($data, $channel_id, $entry_id, FALSE);
if ( ! $success)
show_error(implode('<br />', $this->api_channel_entries->errors));
Under the hood, you'll notice the main difference in loading the
channel_fields library and the call to
setup_entry_settings prior to the
It's quite convluted waht happens in
setup_entry_settings but essentually it loads all the fields for the channel_data table, I beleive it then then sets them to their existing value, or the default value, if they arn't present in the
$data array, all under the hood.
Ref : https://docs.expressionengine.com/v2/development/api/api_channel_fields.html#Api_channel_fields::setup_entry_settings
Ref : https://ellislab.com/forums/viewthread/168319/#819749
Disclaimer : I have been using this lately in the context of create_new_entry but the logic is the same I understand.
Ok, I've just gone ahead and actually read the function, it doesn't look like it does actually load the existing values however looking at
update_entry (which is called from
save_entry, it only builds the query using the columns in your data array, so as long as your entry_id is set correctly (int the
$data as well as in the
save_entry parameter) it should update properly.
But please do let me know if it doesn't (with the channel_fields part) please let me kno and I will adjust my understanding accordinly.