Closed (fixed)
Project:
Flag Note
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 May 2011 at 21:46 UTC
Updated:
16 May 2011 at 08:01 UTC
_flag_note_form(&$form_state, $action, $flag_name, $content_id, $flag_note = NULL) contains this check:
if (is_numeric($content_id)) {
$form['flag_note']['submit'] = array(
'#type' => 'submit',
'#value' => $flag->get_label('flag_short', $content_id),
);
However, there is a problem with how this function is called:
ADD form:
_flag_note_form($form_state, 'flag', $name, $form['#node']->nid, $note));
EDIT form:
_flag_note_form($form_state, NULL, $flag->name, NULL, $flag_note);
With $content_id set to NULL, is_numeric will always evaluate false, and so there won't be a submit button.
Rather than adding that button back in, which places it inside the fieldset, I added a submit button next to the cancel button (outside the fieldset).
function flag_note_edit_form(&$form_state, $fnid) {
$flag_note = current(flag_note_get_notes(array('fnid' => $fnid)));
if (empty($flag_note)) {
return FALSE;
}
$flag = flag_get_flag(NULL, $flag_note['fid']);
$form = _flag_note_form($form_state, NULL, $flag->name, NULL, $flag_note);
$form['fnid'] = array('#type' => 'value', '#value' => $flag_note['fnid']);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
$form['cancel'] = array('#value' => l(t('Cancel'), $_GET['destination']));
return $form;
}
This works as expected.
Comments
Comment #1
gunzip commentedthank you, this should be fixed in latest 6.2-dev