3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Form helper class for an IM object.
21 class CRM_Contact_Form_Edit_IM
{
24 * Build the form object elements for an IM object.
26 * @param CRM_Core_Form $form
27 * Reference to the form object.
28 * @param int $blockCount
29 * Block number to build.
30 * @param bool $blockEdit
33 public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
35 $blockId = ($form->get('IM_Block_Count')) ?
$form->get('IM_Block_Count') : 1;
38 $blockId = $blockCount;
40 $form->applyFilter('__ALL__', 'trim');
43 $form->addField("im[$blockId][provider_id]", ['entity' => 'im', 'class' => 'eight', 'placeholder' => NULL]);
45 $form->addField("im[$blockId][location_type_id]", ['entity' => 'im', 'class' => 'eight', 'placeholder' => NULL, 'option_url' => NULL]);
48 $form->addField("im[$blockId][name]", ['entity' => 'im', 'aria-label' => ts('Instant Messenger %1', [1 => $blockId])]);
50 $js = ['id' => 'IM_' . $blockId . '_IsPrimary', 'aria-label' => ts('Instant Messenger %1 is primary?', [1 => $blockId])];
52 $js['onClick'] = 'singleSelect( this.id );';
55 $form->addElement('radio', "im[$blockId][is_primary]", '', '', '1', $js);