0

I'm trying to develop an expressionengine extension which uses "publish_form_entry_data" hook to change some default features such as customized datepicker , etc. problem is it works perfectly in the publish new entry form , but when I tried to edit my existing entries it redirect me to the publish new entry page , and won't get me to edit entry page with the entry values for editing! is there any other hooks for this purpose? or should I pass some info for editing existing entries?

here is the code for activating the extension :

function activate_extension() {
    $hooks = array(
        'publish_form_entry_data'   =>  'main',
        'update_multi_entries_start' =>  'main',
        'entry_submission_start'    =>  'dataProcess'
    );
    foreach($hooks as $hook => $method){
        $data = array(
            'class'    => __CLASS__,
            'method'   => $method,
            'hook'     => $hook,
            'priority' => 10,
            'version'  => $this->version,
            'enabled'  => 'y'
        );
        $this->EE->db->insert('extensions', $data);
    }

}

and here is the method for the publish_form_entry_data hook :

function main(){
    $this->persianDatePicker();
}
1
  • Can you post the code you're using in your extension? Are you returning the data? According to the docs, this hook only fires when editing existing entries. Commented Aug 11, 2014 at 18:26

1 Answer 1

0

Thanks a lot my friend "Derek Hogue" , I got the result by returning the data like this :

if(!empty($entry_id)){
            //$result = $this->EE->db->get_where('exp_channel_titles',array('entry_id' => $entry_id));
            $this->EE->db->select('*');
            $this->EE->db->from('exp_channel_titles');
            $this->EE->db->where('exp_channel_titles.entry_id',$entry_id);
            $this->EE->db->join('exp_channel_data','exp_channel_titles.entry_id = exp_channel_data.entry_id');
            $result = $this->EE->db->get();
            $result_array = $result->result_array();
            $data = array();
            foreach($result_array[0] as $key => $value){
                $data[$key] = $value;
            }
}
return $data;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.