fullcalendar d'ont display data with contains datetime - fullcalendar

Hi friends i'am using maddhatter fullcalendar in my project laravel 5.6,when i fetch my data in calendar its work by data contains format y-m-d but when i change my format to datetime my camlendar does not display anything this my code:
$events = Agenda::where('code_commercial', $code)->get();
$event_list = [];
foreach ($events as $event) {
$event_list[] = Calendar::event(
$event->description,
true,
date_format(date_create($event->date_debut), "Y-m-d H:i:s"),
date_format(date_create($event->date_fin), "Y-m-d H:i:s")
// new \DateTime($event->date_debut),
// new \DateTime($event->date_fin),
// Carbon::createFromFormat('Y-m-d H:i:s', $event->date_debut)->toDateTimeString(),
// Carbon::createFromFormat('Y-m-d H:i:s', $event->date_fin)->toDateTimeString()
);
}
and this is my configuration for fullcalendar :
$calendar_details = Calendar::addEvents($event_list, [ //set custom color
fo this event
'color' => '#800',
])->setOptions([ //set fullcalendar options
'firstDay' => 1,
'selectable' => true,
'defaultView' => 'agendaWeek',
'allDay' => false,
'slotLabelFormat' => 'HH:mm:ss',
'editable' => true,
'eventLimit' => true,
// 'minTime' => '07:00:00',
// 'maxTime' => '22:00:00',
// 'slotDuration' => '01:30:00',
])
please any help thanks for you

Related

How to find Organic search data using google analytics 4 data API?

I'm using the google analytics 4 API to retrieve the analytics data. While I'm having an issue to retrieve the Organic search data.
Working code for other metrics.
$response = $this->data_client->runReport([
'property' => $propertyId,
'dateRanges' => [new DateRange(['start_date' => '7daysAgo', 'end_date' => '1daysAgo'])],
'metrics' => [
new Metric(['name' => 'totalUsers']),
new Metric(['name' => 'newUsers']),
new Metric(['name' => 'sessions']),
new Metric(['name' => 'screenPageViews']),
new Metric(['name' => 'engagedSessions']),
new Metric(['name' => 'activeUsers']),
],
// 'dimensions' => [
// new Dimension(['name' => 'streamName']),
// ]
]);
foreach ($response->getRows() as $row) {
foreach ($row->getDimensionValues() as $dimensionValue) {
print 'Dimension Value: ' . $dimensionValue->getValue() . PHP_EOL;
}
foreach ($row->getMetricValues() as $metricValue) {
print 'Metric Value: ' . $metricValue->getValue() . PHP_EOL;
}
}
I'm trying to use the defaultChannelGrouping to retrieve the organic search but not getting any useful documents how to do.
Sample code which is not working.
$response = $this->data_client->runReport([
'property' => $propertyId,
'dateRanges' => [new DateRange(['start_date' => '7daysAgo', 'end_date' => '1daysAgo'])],
'dimensions' => [
new Dimension(['name' => 'defaultChannelGrouping']),
]
]);
foreach ($response->getRows() as $row) {
foreach ($row->getDimensionValues() as $dimensionValue) {
print 'Dimension Value: ' . $dimensionValue->getValue() . "<br/>";
}
}
Try using sessionDefaultChannelGrouping rather than defaultChannelGrouping.
In the migration guides, GA4 recommends using sessionDefaultChannelGrouping in GA4 where you might have used ga:channelGrouping in Universal Analytics.
defaultChannelGrouping is an attribution dimension. If your GA4 property's event attribution model is Data-driven, defaultChannelGrouping will return no rows if your GA4 property has not had a conversion in the date range.

i m using a custom post type and using meta box in custom post type

add_action( 'init', 'create_services_box' );
function create_services_box() {
register_post_type( 'Services',
array(
'labels' => array(
'name' => 'Services',
'singular_name' => 'Service',
),
'public' => true,
'menu_position' => 15,
'supports' => array('comments', 'thumbnail', ),
'taxonomies' => array( '' ),
'has_archive' => true
)
);
}
add_filter( 'rwmb_meta_boxes', 'services_meta_boxes' );
function services_meta_boxes( $meta_boxes2 ) {
$meta_boxes2[] = array(
'title' => __( 'Service Metabox ', 'textdomain' ),
'post_types' => array('Services'),
'fields' => array(
array(
'id' => 'Service_box_title',
'name' => __( 'Title :-', 'textdomain' ),
'type' => 'text',
),
array(
'name' => __( 'Image Advanced Upload', 'textdomain' ),
'id' => "service_img",
'type' => 'image_advanced',
'max_file_uploads' => 1,
),
),
);
return $meta_boxes2;
}
i had created custom post type ->Services and use META BOX plugin but i m not getting proper output,image uploader is not showing and even my data is not getting save after Update, please tell me what is the error
Can you please replcae below code? after check it
add_action( 'init', 'create_services_box' );
function create_services_box() {
register_post_type( 'Services',
array(
'labels' => array(
'name' => 'Services',
'singular_name' => 'Service',
),
'public' => true,
'menu_position' => 15,
'supports' => array('comments', 'thumbnail', ),
'taxonomies' => array( '' ),
'has_archive' => true
)
);
}
//Add Metabox
add_action('add_meta_boxes', 'add_upload_file_metaboxes');
function add_upload_file_metaboxes() {
add_meta_box('swp_file_upload', 'File Upload', 'swp_file_upload', 'Services', 'normal', 'default');
}
function swp_file_upload() {
global $post;
// Noncename needed to verify where the data originated
echo '<input type="hidden" name="service_noncename" id="service_noncename" value="'.
wp_create_nonce(plugin_basename(__FILE__)).
'" />';
global $wpdb;
$strFile = get_post_meta($post -> ID, $key = 'service_file', true);
$media_file = get_post_meta($post -> ID, $key = '_wp_attached_file', true);
if (!empty($media_file)) {
$strFile = $media_file;
} ?>
<script type = "text/javascript">
// Uploading files
var file_frame;
jQuery('#upload_image_button').live('click', function(service) {
service.preventDefault();
// If the media frame already exists, reopen it.
if (file_frame) {
file_frame.open();
return;
}
// Create the media frame.
file_frame = wp.media.frames.file_frame = wp.media({
title: jQuery(this).data('uploader_title'),
button: {
text: jQuery(this).data('uploader_button_text'),
},
multiple: false // Set to true to allow multiple files to be selected
});
// When a file is selected, run a callback.
file_frame.on('select', function(){
// We set multiple to false so only get one image from the uploader
attachment = file_frame.state().get('selection').first().toJSON();
// here are some of the variables you could use for the attachment;
//var all = JSON.stringify( attachment );
//var id = attachment.id;
//var title = attachment.title;
//var filename = attachment.filename;
var url = attachment.url;
//var link = attachment.link;
//var alt = attachment.alt;
//var author = attachment.author;
//var description = attachment.description;
//var caption = attachment.caption;
//var name = attachment.name;
//var status = attachment.status;
//var uploadedTo = attachment.uploadedTo;
//var date = attachment.date;
//var modified = attachment.modified;
//var type = attachment.type;
//var subtype = attachment.subtype;
//var icon = attachment.icon;
//var dateFormatted = attachment.dateFormatted;
//var editLink = attachment.editLink;
//var fileLength = attachment.fileLength;
var field = document.getElementById("service_file");
field.value = url; //set which variable you want the field to have
});
// Finally, open the modal
file_frame.open();
});
</script>
<div>
<table>
<tr valign = "top">
<td>
<input type = "text"
name = "service_file"
id = "service_file"
size = "70"
value = "<?php echo $strFile; ?>" />
<input id = "upload_image_button"
type = "button"
value = "Upload">
</td> </tr> </table> <input type = "hidden"
name = "img_txt_id"
id = "img_txt_id"
value = "" />
</div> <?php
function admin_scripts() {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
function admin_styles() {
wp_enqueue_style('thickbox');
}
add_action('admin_print_scripts', 'admin_scripts');
add_action('admin_print_styles', 'admin_styles');
}
//Saving the file
function save_service_meta($post_id, $post) {
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if (!wp_verify_nonce($_POST['service_noncename'], plugin_basename(__FILE__))) {
return $post -> ID;
}
// Is the user allowed to edit the post?
if (!current_user_can('edit_post', $post -> ID))
return $post -> ID;
// We need to find and save the data
// We'll put it into an array to make it easier to loop though.
$service_meta['service_file'] = $_POST['service_file'];
// Add values of $service_meta as custom fields
foreach($service_meta as $key => $value) {
if ($post -> post_type == 'revision') return;
$value = implode(',', (array) $value);
if (get_post_meta($post -> ID, $key, FALSE)) { // If the custom field already has a value it will update
update_post_meta($post -> ID, $key, $value);
} else { // If the custom field doesn't have a value it will add
add_post_meta($post -> ID, $key, $value);
}
if (!$value) delete_post_meta($post -> ID, $key); // Delete if blank value
}
}
add_action('save_post', 'save_service_meta', 1, 2); // save the custom fields

Why content appears misplaced?

I am building a custom module which should display a calendar created by a third-part library. So far, so good. The only problem is, the calendar appears on top of page, even above header. It does not seems to be css-related.
This is the way it looks:
This is my module file:
require_once 'includes/apphp-calendar/calendar.class.php';
function calendario_menu(){
$items = array();
$items['eventos/calendario'] = array(
'title' => 'Calendario',
'description' => 'Calendario de Eventos.',
'page callback' => '_page_calendario',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
function _page_calendario() {
$objCalendar = new Calendar();
$calendar = $objCalendar->Show();
return array(
'#markup' => $calendar
);
}
Seems to me like the Show function of the calendar class outputs rather than returning a string.
try this:
function _page_calendario() {
$objCalendar = new Calendar();
ob_start();
$objCalendar->Show();
$calendar = ob_get_contents();
ob_end_clean();
return array(
'#markup' => $calendar
);
}

Drupal autocomplete, callback with multiple parameters

I am adding some autocomplete on a form alter. The problem is that in the callback, only the string in the textfield The autocomplete is on, is available. I also want to access a value from another textfield in the callback. How is this possible ?
/**
* Implements hook_form_alter().
*/
function webform_conversion_jquery_form_webform_client_form_1_alter(&$form, &$form_state, $form_id) {
//Load some extra function to process data
module_load_include('inc', 'webform_conversion_jquery', '/includes/dataqueries');
//Add extra js files
drupal_add_js(drupal_get_path('module', 'webform_conversion_jquery') . '/js/conversionform.js');
$form['submitted']['correspondentadress']['cor_street']['#autocomplete_path'] = 'conversionform/conversion_street';
}
}
/**
* Implements hook_menu().
*/
function webform_conversion_jquery_menu() {
$items = array();
$items['conversionform/conversion_street'] = array(
'title' => 'Conversion street autocomplete',
'page callback' => 'conversion_street_autocomplete',
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Retrieve a JSON object containing autocomplete suggestions for streets depending on the zipcode.
*/
function conversion_street_autocomplete($street = '') {
$street = "%" . $street . "%";
$matches = array();
$result = db_select('conversion_adresslist')
->fields('conversion_adresslist', array('street'))
->condition('street', $street, 'like')
->execute();
foreach ($result as $street) {
$matches[$street->street] = $street->street;
}
drupal_json_output($matches);
}
I just want to be able to post extra information in the function:
conversion_street_autocomplete($street = '', $extraparameter)
I had the same problem and have figured out a way, which is not too strenuous. It involves overriding the textfield theme and then passing your parameter to the theme function.
First create declare your theme function:
function mymodule_theme() {
$theme_hooks = array(
'my_module_autocomplete' => array(
'render element' => 'element',
),
);
return $theme_hooks;
}
Next we need to add the theme and the variable to our form element. In my case, the form element is part of a field widget:
function my_module_field_widget_form($form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
if($instance['widget']['type'] == 'my_module_field_type') {
$element['my_module_field'] = array(
'#type' => 'textfield',
'#autocomplete_path' => 'my-module/autocomplete',
// THIS IS THE IMPORTANT PART - ADD THE THEME AND THE VARIABLE.
'#theme' => 'my_module_autocomplete',
'#my_module_variable' => $field['field_name'],
);
}
return $element;
}
Then implement the theme function. This is a copy of theme_textfield from includes/form.inc with one important difference - we append the variable to the autocomplete path:
function theme_my_module_autocomplet($variables) {
$element = $variables['element'];
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
_form_set_class($element, array('form-text'));
$extra = '';
if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
drupal_add_library('system', 'drupal.autocomplete');
$element['#attributes']['class'][] = 'form-autocomplete';
$attributes = array();
$attributes['type'] = 'hidden';
$attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
// THIS IS THE IMPORTANT PART. APPEND YOUR VARIABLE TO THE AUTOCOMPLETE PATH.
$attributes['value'] = url($element['#autocomplete_path'] . '/' . $element['#my_module_variable'], array('absolute' => TRUE));
$attributes['disabled'] = 'disabled';
$attributes['class'][] = 'autocomplete';
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
return $output . $extra;
}
Now the variable will be available as the first parameter on the autocomplete callback function:
function _my_module_autocomplete($my_module_variable, $search_string) {
// Happy days, we now have access to our parameter.
}
Just in case anyone is still having trouble with this I found a great solution while trying to figure out how to do this. I had a year select list and that dictated what data was displayed in the autocomplete field. The solution basically has an ajax callback function for the select list that can then update the autocomplete field with an extra parameter in the url. Anyways, it is really well explained in the following article.
http://complexdan.com/passing-custom-arguments-drupal-7-autocomplete/
*A note of caution, I was going crazy trying to figure out why it did not work and it turns out you can't have the same form on the page twice (I needed to because I was displaying it differently for mobile devices) because you are using an id for the ajax callback. I added an extra argument to accomplish that. It is called uniqueid in the below example.
function report_cards_comparison_form($form, &$form_state, $uniqueid) {
$curryear = t('2012');
$form['year_select'] = array(
'#title' => t('School Year'),
'#type' => 'select',
'#options' => array(
'2012' => t('2012'),
'2013' => t('2013'),
'2014' => t('2014'),
'2015' => t('2015'),
),
'#default_value' => $curryear,
'#ajax' => array(
'callback' => 'report_cards_comparison_form_callback',
'wrapper' => $uniqueid,
'progress' => array(
'message' => 'Updating Schools...',
'type' => 'throbber'
),
),
);
$form['choice'] = array(
//'#title' => t('Search By: School Name'),
'#type' => 'textfield',
'#attributes' => array(
'class' => array('school-choice'),
'placeholder' => t('Start Typing School Name...'),
),
'#required' => TRUE,
'#autocomplete_path' => 'reportcards/autocomplete/' . $curryear,
'#prefix' => '<div id="' . $uniqueid . '">',
'#suffix' => '</div>',
);
$form['submit'] = array(
'#type' => 'submit',
'#prefix' => '<div class="submit-btn-wrap">',
'#suffix' => '</div>',
'#value' => t('Search'),
'#attributes' => array('id' => 'add-school-submit'),
);
return $form;
}
/**
* Ajax Callback that updates the autocomplete ajax when there is a change in the Year Select List
*/
function report_cards_comparison_form_callback($form, &$form_state) {
unset($form_state['input']['choice'], $form_state['values']['choice']);
$curryear = $form_state['values']['year_select'];
$form_state['input']['choice'] = '';
$form['choice']['#value'] = '';
$form['choice']['#autocomplete_path'] = 'reportcards/autocomplete/' . $curryear;
return form_builder($form['#id'], $form['choice'], $form_state);
}
and I can call the form by doing this...
print render(drupal_get_form('report_cards_comparison_form', 'desktop-schoolmatches'));
You can do it by overriding methods from autocomplete.js in your own js. Here is example:
(function($) {
Drupal.behaviors.someModuleOverrideAC = {
attach: function(context, settings) {
// Next is copied and adjusted method from autocomplete.js
Drupal.jsAC.prototype.populatePopup = function() {
var $input = $(this.input);
var position = $input.position();
// Show popup.
if (this.popup) {
$(this.popup).remove();
}
this.selected = false;
this.popup = $('<div id="autocomplete"></div>')[0];
this.popup.owner = this;
$(this.popup).css({
top: parseInt(position.top + this.input.offsetHeight, 10) + 'px',
left: parseInt(position.left, 10) + 'px',
width: $input.innerWidth() + 'px',
display: 'none'
});
$input.before(this.popup);
// Do search.
this.db.owner = this;
if ($input.attr('name') === 'field_appartment_complex') {
// Overriden search
// Build custom search string for apartments autocomplete
var $wrapper = $('div.apartments-autocomplete');
var $elements = $('input, select', $wrapper);
var searchElements = {string: this.input.value};
$elements.each(function() {
searchElements[$(this).data('address-part')] = $(this).val();
});
var string = encodeURIComponent(JSON.stringify(searchElements));
this.db.search(string);
}
else {
// Default search
this.db.search(this.input.value);
}
};
}
};
}(jQuery));
In your server callback:
function some_module_autocomplete_ajax($string) {
// Decode custom string obtained using overriden autocomplete js.
$components = drupal_json_decode(rawurldecode($string));
// Do you search here using multiple params from $components
}
Ok, for as far as I can see it is not possible. maybe you can roll your own with the ajax functionality in fapi http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/7#ajax
For now I solved it by implementing jquery.ui.autocomplete which is included in drupal 7

Drupal Ctools Form Wizard in a Block

I created a custom module that has a Ctools multi step form. It's basically a copy of http://www.nicklewis.org/using-chaos-tools-form-wizard-build-multistep-forms-drupal-6.
The form works. I can see it if I got to the url i made for it.
For the life of me I can't get the multistep form to show up in a block.
Any clues?
/**
* Implementation of hook_block()
* */
function mycrazymodule_block($op='list', $delta=0, $edit=array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('SFT Getting Started');
$blocks[1]['info'] = t('SFT Contact US');
$blocks[2]['info'] = t('SFT News Letter');
return $blocks;
case 'view':
switch ($delta){
case '0':
$block['subject'] = t('SFT Getting Started Subject');
$block['content'] = mycrazymodule_wizard();
break;
case '1':
$block['subject'] = t('SFT Contact US Subject');
$block['content'] = t('SFT Contact US content');
break;
case '2':
$block['subject'] = t('SFT News Letter Subject');
$block['content'] = t('SFT News Letter cONTENT');
break;
}
return $block;
}
}
/**
* Implementation of hook_menu().
*/
function mycrazymodule_menu() {
$items['hellocowboy'] = array(
'title' => 'Two Step Form',
'page callback' => 'mycrazymodule_wizard',
'access arguments' => array('access content')
);
return $items;
}
/**
* menu callback for the multistep form
* step is whatever arg one is -- and will refer to the keys listed in
* $form_info['order'], and $form_info['forms'] arrays
*/
function mycrazymodule_wizard() {
$step = arg(1);
// required includes for wizard
$form_state = array();
ctools_include('wizard');
ctools_include('object-cache');
// The array that will hold the two forms and their options
$form_info = array(
'id' => 'getting_started',
'path' => "hellocowboy/%step",
'show trail' => FALSE,
'show back' => FALSE,
'show cancel' => false,
'show return' =>false,
'next text' => 'Submit',
'next callback' => 'getting_started_add_subtask_next',
'finish callback' => 'getting_started_add_subtask_finish',
'return callback' => 'getting_started_add_subtask_finish',
'order' => array(
'basic' => t('Step 1: Basic Info'),
'lecture' => t('Step 2: Choose Lecture'),
),
'forms' => array(
'basic' => array(
'form id' => 'basic_info_form'
),
'lecture' => array(
'form id' => 'choose_lecture_form'
),
),
);
$form_state = array(
'cache name' => NULL,
);
// no matter the step, you will load your values from the callback page
$getstart = getting_started_get_page_cache(NULL);
if (!$getstart) {
// set form to first step -- we have no data
$step = current(array_keys($form_info['order']));
$getstart = new stdClass();
//create cache
ctools_object_cache_set('getting_started', $form_state['cache name'], $getstart);
//print_r($getstart);
}
//THIS IS WHERE WILL STORE ALL FORM DATA
$form_state['getting_started_obj'] = $getstart;
// and this is the witchcraft that makes it work
$output = ctools_wizard_multistep_form($form_info, $step, $form_state);
return $output;
}
function basic_info_form(&$form, &$form_state){
$getstart = &$form_state['getting_started_obj'];
$form['firstname'] = array(
'#weight' => '0',
'#type' => 'textfield',
'#title' => t('firstname'),
'#size' => 60,
'#maxlength' => 255,
'#required' => TRUE,
);
$form['lastname'] = array(
'#weight' => '1',
'#type' => 'textfield',
'#title' => t('lastname'),
'#required' => TRUE,
'#size' => 60,
'#maxlength' => 255,
);
$form['phone'] = array(
'#weight' => '2',
'#type' => 'textfield',
'#title' => t('phone'),
'#required' => TRUE,
'#size' => 60,
'#maxlength' => 255,
);
$form['email'] = array(
'#weight' => '3',
'#type' => 'textfield',
'#title' => t('email'),
'#required' => TRUE,
'#size' => 60,
'#maxlength' => 255,
);
$form['newsletter'] = array(
'#weight' => '4',
'#type' => 'checkbox',
'#title' => t('I would like to receive the newsletter'),
'#required' => TRUE,
'#return_value' => 1,
'#default_value' => 1,
);
$form_state['no buttons'] = TRUE;
}
function basic_info_form_validate(&$form, &$form_state){
$email = $form_state['values']['email'];
$phone = $form_state['values']['phone'];
if(valid_email_address($email) != TRUE){
form_set_error('Dude you have an error', t('Where is your email?'));
}
//if (strlen($phone) > 0 && !ereg('^[0-9]{1,3}-[0-9]{3}-[0-9]{3,4}-[0-9]{3,4}$',
$phone)) {
//form_set_error('Dude the phone', t('Phone number must be in format xxx-xxx-
nnnn-nnnn.'));
//}
}
function basic_info_form_submit(&$form, &$form_state){
//Grab the variables
$firstname =check_plain ($form_state['values']['firstname']);
$lastname = check_plain ($form_state['values']['lastname']);
$email = check_plain ($form_state['values']['email']);
$phone = check_plain ($form_state['values']['phone']);
$newsletter = $form_state['values']['newsletter'];
//Send the form and Grab the lead id
$leadid = send_first_form($lastname, $firstname, $email,$phone, $newsletter);
//Put into form
$form_state['getting_started_obj']->firstname = $firstname;
$form_state['getting_started_obj']->lastname = $lastname;
$form_state['getting_started_obj']->email = $email;
$form_state['getting_started_obj']->phone = $phone;
$form_state['getting_started_obj']->newsletter = $newsletter;
$form_state['getting_started_obj']->leadid = $leadid;
}
function choose_lecture_form(&$form, &$form_state){
$one = 'event 1'
$two = 'event 2'
$three = 'event 3'
$getstart = &$form_state['getting_started_obj'];
$form['lecture'] = array(
'#weight' => '5',
'#default_value' => 'two',
'#options' => array(
'one' => $one,
'two' => $two,
'three' => $three,
),
'#type' => 'radios',
'#title' => t('Select Workshop'),
'#required' => TRUE,
);
$form['attendees'] = array(
'#weight' => '6',
'#default_value' => 'one',
'#options' => array(
'one' => t('I will be arriving alone'),
'two' =>t('I will be arriving with a guest'),
),
'#type' => 'radios',
'#title' => t('Attendees'),
'#required' => TRUE,
);
$form_state['no buttons'] = TRUE;
}
/**
* Same idea as previous steps submit
*
*/
function choose_lecture_form_submit(&$form, &$form_state) {
$workshop = $form_state['values']['lecture'];
$leadid = $form_state['getting_started_obj']->leadid;
$attendees = $form_state['values']['attendees'];
$form_state['getting_started_obj']->lecture = $workshop;
$form_state['getting_started_obj']->attendees = $attendees;
send_second_form($workshop, $attendees, $leadid);
}
//----PART 3 CTOOLS CALLBACKS -- these usually don't have to be very unique
/**
* Callback generated when the add page process is finished.
* this is where you'd normally save.
*/
function getting_started_add_subtask_finish(&$form_state) {
dpm($form_state);
$getstart = &$form_state['getting_started_obj'];
drupal_set_message('mycrazymodule '.$getstart->name.' successfully deployed' );
//Get id
// Clear the cache
ctools_object_cache_clear('getting_started', $form_state['cache name']);
$form_state['redirect'] = 'hellocowboy';
}
/**
* Callback for the proceed step
*
*/
function getting_started_add_subtask_next(&$form_state) {
dpm($form_state);
$getstart = &$form_state['getting_started_obj'];
$cache = ctools_object_cache_set('getting_started', $form_state['cache name'],
$getstart);
}
//PART 4 CTOOLS FORM STORAGE HANDLERS -- these usually don't have to be very unique
/**
* Remove an item from the object cache.
*/
function getting_started_clear_page_cache($name) {
ctools_object_cache_clear('getting_started', $name);
}
/**
* Get the cached changes to a given task handler.
*/
function getting_started_get_page_cache($name) {
$cache = ctools_object_cache_get('getting_started', $name);
return $cache;
}
//Salesforce Functions
function send_first_form($lastname, $firstname,$email,$phone, $newsletter){
$send = array("LastName" => $lastname , "FirstName" => $firstname, "Email" => $email
,"Phone" => $phone , "Newsletter__c" =>$newsletter );
$sf = salesforce_api_connect();
$response = $sf->client->create(array($send), 'Lead');
dpm($response);
return $response->id;
}
function send_second_form($workshop, $attendees, $leadid){
$send = array("Id" => $leadid , "Number_Of_Pepole__c" => "2" );
$sf = salesforce_api_connect();
$response = $sf->client->update(array($send), 'Lead');
dpm($response, 'the final response');
return $response->id;
}
Am assuming you have enabled the block from admin. To do a quick check that the block is indeed getting rendered on the page you are looking at, try returning a test string along with your rendered form, from your block callback.
If that doesn't work, try clearing your cache from admin/settings/performance and try again. If I am not wrong, blocks are cached by default. Let us see if it shows up then.

Resources