Ist es möglich, jquery get- oder post-Methoden zu verwenden, um dynamische Daten in einem Blockmodul drupal7.x abzurufen? Ich bin ein Neuling bei Drupal.
Hier ist meine Datei 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;
}
}
Ich möchte wissen, wie man Funktionen in die obige .module-Datei schreibt, um über die Methode jquery get oder post dynamisch auf Inhalte zuzugreifen.
Oder sollte ich etwas anderes als 'hook_menu' als block verwenden?
7
hooks
blocks
javascript
Harish Anchu
quelle
quelle