*/
class CRM_Wci_Form_CreateWidget extends CRM_Core_Form {
+ /**
+ * the widget id saved to the session for an update
+ *
+ * @var int
+ * @access protected
+ */
+ protected $_id;
+
function preProcess() {
parent::preProcess();
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive',
+ $this, FALSE, NULL, 'REQUEST'
+ );
+
$this->_colorFields = array('color_title' => array(ts('Title Text Color'),
'text',
FALSE,
);
}
+ function setDefaultValues() {
+ $defaults = array();
+
+ $defaults['size_variant'] = 'normal';
+ foreach ($this->_colorFields as $name => $val) {
+ $defaults[$name] = $val[3];
+ }
+
+ return $defaults;
+ }
+
function buildQuickForm() {
// add form elements
$this->add('select', 'button_link_to', ts('Contribution button'), $this->getContributionPageOptions());
$this->add('text', 'button_title', ts('Contribution button title'));
$this->add('select', 'progress_bar', ts('Progress bar'), array('' => '- select -'));
- $this->add('textarea', 'description', ts('Description'));
+ $this->addWysiwyg('description', ts('Description'), '');
$this->add('select', 'email_signup_group_id', ts('Newsletter signup'), $this->getGroupOptions());
$this->add('select', 'size_variant', ts('Size variant'), $this->getSizeOptions());
foreach ($this->_colorFields as $name => $val) {
}
$this->add('textarea', 'style_rules', ts('Additional Style Rules'));
$this->add('checkbox', 'override', ts('Override default template'));
- $this->add('textarea', 'custom_template', ts('Custom template'));
+ $this->addWysiwyg('custom_template', ts('Custom template'), '');
$this->addButtons(array(
array(
'type' => 'submit',
'' => ts('- select -'),
);
- $result = civicrm_api3('contribution_page', 'get');
+ $result = civicrm_api3('contribution_page', 'get');
foreach ($result['values'] as $contribution_page) {
$options[$contribution_page['id']] = $contribution_page['title'];
}
function getSizeOptions() {
$options = array(
- '' => ts('- select -'),
'thin' => ts('Thin'),
'normal' => ts('Normal'),
'wide' => ts('Wide'),
<?xml version="1.0"?>
<menu>
<item>
- <path>civicrm/wci</path>
- <page_callback>CRM_Wci_Page_WCIDashboard</page_callback>
- <title>WCIDashboard</title>
- <access_arguments>access CiviCRM</access_arguments>
- </item>
- <item>
- <path>civicrm/wci/create-widget</path>
+ <path>civicrm/wci/widget/add</path>
<page_callback>CRM_Wci_Form_CreateWidget</page_callback>
- <title>CreateWidget</title>
+ <title>Create Widget</title>
<access_arguments>access CiviCRM</access_arguments>
</item>
</menu>