È possibile utilizzare i metodi get o post di jquery per recuperare dati dinamici in un modulo di blocco aa drupal7.x. Sono un novizio di Drupal.
Ecco il mio file event_calendar.module
function event_calendar_help($path, $arg)
{
switch ($path)
{
case "admin/help#event_calendar":
return '<p>'. t("A block module that creates events and lists them in a event calendar") .'</p>';
break;
}
}
/**
* Implements hook_block_info().
*/
function event_calendar_block_info() {
$blocks['event_calendar'] = array(
'info' => t('Event calendar'),
'cache' => DRUPAL_CACHE_PER_ROLE, //Default
);
return $blocks;
}
/**
* Implements hook_block_view().
*
* Prepares the contents of the block.
*/
function event_calendar_block_view($delta = '')
{
switch($delta)
{
case 'event_calendar':
$block['subject'] = NULL;
if(user_access('access content'))
{
$items = array();
$basepath = drupal_get_path('module', 'event_calendar');
$markup = '<div id="content">
<div style="float:right;margin-bottom:5px">
<label style="float:left;padding:3px;">Week :</label>
<div id="date_picker">
<span id="startDate"></span></span> - <span id="endDate"></span>
<div class="week-picker" style="display:none;position:absolute"></div>
</div>
</div>
<hr style="clear:both;"/>
<div id="calender_content">
</div>
<div id="color_code" style="float:right">
<div class="lane1 colorbox"></div><div style="float:left">Lane 1</div>
<div class="lane2 colorbox"></div><div style="float:left">Lane 2</div>
<div class="lane3 colorbox"></div><div style="float:left">Lane 3</div>
<div class="lane4 colorbox"></div><div style="float:left">Lane 4</div>
</div>
</div>';
$block['content'] = array(
'#markup' => $markup,
'#attached' => array
(
'css' => array($basepath . '/css/event_calendar.css',$basepath . '/css/smoothness/jquery-ui-1.8.16.custom.css'),
'js' => array($basepath . '/javascript/event_calendar.js',$basepath . '/javascript//jquery-ui-1.8.16.custom.min.js'),
),
);
}
return $block;
}
}
Voglio sapere come scrivere le funzioni all'interno del file .module sopra per accedere in modo dinamico ad alcuni contenuti tramite il metodo get o post di jquery?
O dovrei usare qualcosa come 'hook_menu' diverso da block?