當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_Form::addWysiwyg方法代碼示例

本文整理匯總了PHP中CRM_Core_Form::addWysiwyg方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_Form::addWysiwyg方法的具體用法?PHP CRM_Core_Form::addWysiwyg怎麽用?PHP CRM_Core_Form::addWysiwyg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_Form的用法示例。


在下文中一共展示了CRM_Core_Form::addWysiwyg方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildThankYouBlock

 /**
  * @param CRM_Core_Form $form
  */
 public function buildThankYouBlock(&$form)
 {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
     $attributes['thankyou_text']['click_wysiwyg'] = TRUE;
     $form->add('text', 'thankyou_title', ts('Title'), $attributes['thankyou_title']);
     $form->addWysiwyg('thankyou_text', ts('Introductory Text'), $attributes['thankyou_text']);
     // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing
     // explicit height and width.
     $footerAttribs = array('rows' => 2, 'cols' => 40, 'click_wysiwyg' => TRUE);
     $form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), $footerAttribs);
 }
開發者ID:JSProffitt,項目名稱:civicrm-website-org,代碼行數:14,代碼來源:Registration.php

示例2: addQuickFormElement


//.........這裏部分代碼省略.........
                 $qf->addGroup($operators, $elementName . '_operator');
                 $qf->setDefaults(array($elementName . '_operator' => 'or'));
             }
             break;
         case 'AdvMulti-Select':
             $include =& $qf->addElement('advmultiselect', $elementName, $label, $options, array('size' => 5, 'style' => '', 'class' => 'advmultiselect', 'data-crm-custom' => $dataCrmCustomVal));
             $include->setButtonAttributes('add', array('value' => ts('Add >>')));
             $include->setButtonAttributes('remove', array('value' => ts('<< Remove')));
             if ($useRequired && !$search) {
                 $qf->addRule($elementName, ts('%1 is a required field.', array(1 => $label)), 'required');
             }
             break;
         case 'CheckBox':
             $check = array();
             foreach ($options as $v => $l) {
                 $check[] =& $qf->addElement('advcheckbox', $v, NULL, $l, array('data-crm-custom' => $dataCrmCustomVal));
             }
             $qf->addGroup($check, $elementName, $label);
             if ($useRequired && !$search) {
                 $qf->addRule($elementName, ts('%1 is a required field.', array(1 => $label)), 'required');
             }
             break;
         case 'File':
             // we should not build upload file in search mode
             if ($search) {
                 return;
             }
             $qf->add(strtolower($field->html_type), $elementName, $label, $field->attributes, $useRequired && !$search);
             $qf->addUploadElement($elementName);
             break;
         case 'RichTextEditor':
             $attributes = array('rows' => $field->note_rows, 'cols' => $field->note_columns, 'data-crm-custom' => $dataCrmCustomVal);
             if ($field->text_length) {
                 $attributes['maxlength'] = $field->text_length;
             }
             $qf->addWysiwyg($elementName, $label, $attributes, $search);
             break;
         case 'Autocomplete-Select':
             static $customUrls = array();
             // Fixme: why is this a string in the first place??
             $attributes = array();
             if ($field->attributes) {
                 foreach (explode(' ', $field->attributes) as $at) {
                     if (strpos($at, '=')) {
                         list($k, $v) = explode('=', $at);
                         $attributes[$k] = trim($v, ' "');
                     }
                 }
             }
             if ($field->data_type == 'ContactReference') {
                 $attributes['class'] = (isset($attributes['class']) ? $attributes['class'] . ' ' : '') . 'crm-form-contact-reference huge';
                 $attributes['data-api-entity'] = 'contact';
                 $qf->add('text', $elementName, $label, $attributes, $useRequired && !$search);
                 $urlParams = "context=customfield&id={$field->id}";
                 $customUrls[$elementName] = CRM_Utils_System::url('civicrm/ajax/contactref', $urlParams, FALSE, NULL, FALSE);
             } else {
                 // FIXME: This won't work with customFieldOptions hook
                 $attributes += array('entity' => 'option_value', 'placeholder' => $placeholder, 'multiple' => $search, 'api' => array('params' => array('option_group_id' => $field->option_group_id)));
                 $qf->addEntityRef($elementName, $label, $attributes, $useRequired && !$search);
             }
             $qf->assign('customUrls', $customUrls);
             break;
     }
     switch ($field->data_type) {
         case 'Int':
             // integers will have numeric rule applied to them.
             if ($field->is_search_range && $search) {
                 $qf->addRule($elementName . '_from', ts('%1 From must be an integer (whole number).', array(1 => $label)), 'integer');
                 $qf->addRule($elementName . '_to', ts('%1 To must be an integer (whole number).', array(1 => $label)), 'integer');
             } elseif ($widget == 'Text') {
                 $qf->addRule($elementName, ts('%1 must be an integer (whole number).', array(1 => $label)), 'integer');
             }
             break;
         case 'Float':
             if ($field->is_search_range && $search) {
                 $qf->addRule($elementName . '_from', ts('%1 From must be a number (with or without decimal point).', array(1 => $label)), 'numeric');
                 $qf->addRule($elementName . '_to', ts('%1 To must be a number (with or without decimal point).', array(1 => $label)), 'numeric');
             } elseif ($widget == 'Text') {
                 $qf->addRule($elementName, ts('%1 must be a number (with or without decimal point).', array(1 => $label)), 'numeric');
             }
             break;
         case 'Money':
             if ($field->is_search_range && $search) {
                 $qf->addRule($elementName . '_from', ts('%1 From must in proper money format. (decimal point/comma/space is allowed).', array(1 => $label)), 'money');
                 $qf->addRule($elementName . '_to', ts('%1 To must in proper money format. (decimal point/comma/space is allowed).', array(1 => $label)), 'money');
             } elseif ($widget == 'Text') {
                 $qf->addRule($elementName, ts('%1 must be in proper money format. (decimal point/comma/space is allowed).', array(1 => $label)), 'money');
             }
             break;
         case 'Link':
             $element->setAttribute('onfocus', "if (!this.value) {this.value='http://';}");
             $element->setAttribute('onblur', "if (this.value == 'http://') {this.value='';}");
             $element->setAttribute('class', "url");
             $qf->addRule($elementName, ts('Enter a valid Website.'), 'wikiURL');
             break;
     }
     if ($field->is_view && !$search) {
         $qf->freeze($elementName);
     }
 }
開發者ID:Hack4Eugene,項目名稱:Hack4Cause2016,代碼行數:101,代碼來源:CustomField.php

示例3: buildFriendForm

 /**
  * Build the form object.
  *
  * @param CRM_Core_Form $form
  *   Form object.
  *
  * @return void
  */
 public static function buildFriendForm($form)
 {
     $form->addElement('checkbox', 'tf_is_active', ts('Tell a Friend enabled?'), NULL, array('onclick' => "friendBlock(this)"));
     // name
     $form->add('text', 'tf_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'title'), TRUE);
     // intro-text and thank-you text
     $form->addWysiwyg('intro', ts('Introduction'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'intro'), TRUE);
     $form->add('textarea', 'suggested_message', ts('Suggested Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message'), FALSE);
     $form->add('text', 'general_link', ts('Info Page Link'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'general_link'));
     $form->add('text', 'tf_thankyou_title', ts('Thank-you Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_title'), TRUE);
     $form->addWysiwyg('tf_thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_text'), TRUE);
     if ($form->_friendId) {
         // CRM-14200 the i18n dialogs need this for translation
         $form->assign('friendId', $form->_friendId);
     }
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:24,代碼來源:Friend.php


注:本文中的CRM_Core_Form::addWysiwyg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。