From e108902effafaf254bb3bc6a4cda385f231c97df Mon Sep 17 00:00:00 2001 From: Sandor Takacs Date: Tue, 14 Jun 2016 11:03:35 +0200 Subject: [PATCH] Add $field_blocks to contact_form hook Add $field_blocks to contact_form hook, so plugins can change the order of the fields: https://github.com/roundcube/roundcubemail/pull/5281 --- program/steps/addressbook/func.inc | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 5b85705b6..36be89968 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -516,15 +516,26 @@ function rcmail_contact_form($form, $record, $attrib = null) { global $RCMAIL; + // group fields + $field_blocks = array( + 'names' => array('prefix','firstname','middlename','surname','suffix'), + 'displayname' => array('name'), + 'nickname' => array('nickname'), + 'organization' => array('organization'), + 'department' => array('department'), + 'jobtitle' => array('jobtitle'), + ); + // Allow plugins to modify contact form content $plugin = $RCMAIL->plugins->exec_hook('contact_form', array( - 'form' => $form, 'record' => $record)); + 'form' => $form, 'record' => $record, 'field_blocks' => $field_blocks)); - $form = $plugin['form']; - $record = $plugin['record']; - $edit_mode = $RCMAIL->action != 'show' && $RCMAIL->action != 'print'; - $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => $RCMAIL->gettext('delete'))) : $RCMAIL->gettext('delete'); - $out = ''; + $form = $plugin['form']; + $record = $plugin['record']; + $field_blocks = $plugin['field_blocks'] + $edit_mode = $RCMAIL->action != 'show' && $RCMAIL->action != 'print'; + $del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => $RCMAIL->gettext('delete'))) : $RCMAIL->gettext('delete'); + $out = ''; unset($attrib['deleteicon']); @@ -563,16 +574,6 @@ function rcmail_contact_form($form, $record, $attrib = null) unset($record['name']); } - // group fields - $field_blocks = array( - 'names' => array('prefix','firstname','middlename','surname','suffix'), - 'displayname' => array('name'), - 'nickname' => array('nickname'), - 'organization' => array('organization'), - 'department' => array('department'), - 'jobtitle' => array('jobtitle'), - ); - foreach ($field_blocks as $blockname => $colnames) { $fields = ''; foreach ($colnames as $col) {