/** * Modify publish form. Add the extra fields */ public function action_form_publish($form, $post, $context) { $props = explode(',', Options::get( 'postprops__extrafields' )); if (count($props) == 0) { return; /* no fields to make */ } $props = array_map('trim', $props); $props = array_map('ucwords', $props); $propsNoSpace = array_map(create_function('$text', 'return preg_replace("/\s+/", "", $text);'), $props); $form->insert('tags', 'checkboxes', 'postprops', 'null:null', _t('Content Properties'), 'formcontrol_checkboxes'); $form->postprops->options = array_combine($propsNoSpace, $props); $form->postprops->value = $post->info->cssalts; } /** * Save our data to the database */ public function action_publish_post( $post, $form ) { $post->info->postprops = $form->postprops->value; }