/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { $drupal_wysiwyg = FALSE; $wysiwyg_options = array('' => ts('Textarea')) + CRM_Core_PseudoConstant::wysiwygEditor(); $config = CRM_Core_Config::singleton(); $extra = array(); //if not using Joomla, remove Joomla default editor option if ($config->userFramework != 'Joomla') { unset($wysiwyg_options[3]); } $drupal_wysiwyg = FALSE; if (!$config->userSystem->is_drupal || !module_exists("wysiwyg")) { unset($wysiwyg_options[4]); } else { $extra['onchange'] = 'if (this.value==4) { cj("#crm-preferences-display-form-block-wysiwyg_input_format").show(); } else { cj("#crm-preferences-display-form-block-wysiwyg_input_format").hide() }'; $formats = filter_formats(); $format_options = array(); foreach ($formats as $id => $format) { $format_options[$id] = $format->name; } $drupal_wysiwyg = TRUE; } $this->addElement('select', 'editor_id', ts('WYSIWYG Editor'), $wysiwyg_options, $extra); if ($drupal_wysiwyg) { $this->addElement('select', 'wysiwyg_input_format', ts('Input Format'), $format_options, NULL); } $editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0'); $this->assign('editOptions', $editOptions); $contactBlocks = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 1'); $this->assign('contactBlocks', $contactBlocks); $this->addElement('hidden', 'contact_edit_preferences', NULL, array('id' => 'contact_edit_preferences')); parent::buildQuickForm(); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { $wysiwyg_options = array('' => ts('Textarea')) + CRM_Core_PseudoConstant::wysiwygEditor(); $config =& CRM_Core_Config::singleton(); //if not using Joomla, remove Joomla default editor option if ($config->userFramework != 'Joomla') { unset($wysiwyg_options[3]); } $this->addElement('select', 'wysiwyg_editor', ts('WYSIWYG Editor'), $wysiwyg_options, null); $this->addElement('textarea', 'display_name_format', ts('Individual Display Name Format')); $this->addElement('textarea', 'sort_name_format', ts('Individual Sort Name Format')); require_once 'CRM/Core/OptionGroup.php'; $editOptions = CRM_Core_OptionGroup::values('contact_edit_options', false, false, false, 'AND v.filter = 0'); $this->assign('editOptions', $editOptions); $contactBlocks = CRM_Core_OptionGroup::values('contact_edit_options', false, false, false, 'AND v.filter = 1'); $this->assign('contactBlocks', $contactBlocks); $this->addElement('hidden', 'contact_edit_prefences', null, array('id' => 'contact_edit_prefences')); parent::buildQuickForm(); }
/** * Get all WYSIWYG Editors. * * The static array wysiwygEditor is returned * * @access public * @static * @return array - array reference of all wysiwygEditors */ public static function &wysiwygEditor() { if (!self::$wysiwygEditor) { require_once 'CRM/Core/OptionGroup.php'; self::$wysiwygEditor = CRM_Core_OptionGroup::values('wysiwyg_editor'); } return self::$wysiwygEditor; }
function addWysiwyg($name, $label, $attributes, $forceTextarea = false) { // 1. Get configuration option for editor (tinymce, ckeditor, pure textarea) // 2. Based on the option, initialise proper editor require_once 'CRM/Core/BAO/Preferences.php'; $editor = strtolower(CRM_Utils_Array::value(CRM_Core_BAO_Preferences::value('editor_id'), CRM_Core_PseudoConstant::wysiwygEditor())); if (!$editor || $forceTextarea) { $editor = 'textarea'; } if ($editor == 'joomla default editor') { $editor = 'joomlaeditor'; } $this->addElement($editor, $name, $label, $attributes); $this->assign('editor', $editor); }
/** * Get all WYSIWYG Editors. * * The static array wysiwygEditor is returned * * @access public * @static * * @return array - array reference of all wysiwygEditors */ public static function &wysiwygEditor() { if (!self::$wysiwygEditor) { self::$wysiwygEditor = CRM_Core_OptionGroup::values('wysiwyg_editor'); } return self::$wysiwygEditor; }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { $this->addElement('select', 'wysiwyg_editor', ts('WYSIWYG Editor'), array('' => ts('Textarea')) + CRM_Core_PseudoConstant::wysiwygEditor(), null); parent::buildQuickForm(); }
function addWysiwyg($name, $label, $attributes, $forceTextarea = FALSE) { // 1. Get configuration option for editor (tinymce, ckeditor, pure textarea) // 2. Based on the option, initialise proper editor $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'editor_id'); $editor = strtolower(CRM_Utils_Array::value($editorID, CRM_Core_PseudoConstant::wysiwygEditor())); if (!$editor || $forceTextarea) { $editor = 'textarea'; } if ($editor == 'joomla default editor') { $editor = 'joomlaeditor'; } if ($editor == 'drupal default editor') { $editor = 'drupalwysiwyg'; } //lets add the editor as a attribute $attributes['editor'] = $editor; $this->addElement($editor, $name, $label, $attributes); $this->assign('editor', $editor); // include wysiwyg editor js files $includeWysiwygEditor = FALSE; $includeWysiwygEditor = $this->get('includeWysiwygEditor'); if (!$includeWysiwygEditor) { $includeWysiwygEditor = TRUE; $this->set('includeWysiwygEditor', $includeWysiwygEditor); } $this->assign('includeWysiwygEditor', $includeWysiwygEditor); }