I create an ajax link with an image inside this, here my code
function fbf_block_view($delta = ''){
drupal_add_library('system', 'drupal.ajax');
$block = array();
switch ($delta){
case 'FbF':
$nodes = entity_load('node', FALSE, array('type' => '4x4'));
$cont = 0;
$html = "<div id = 'four'>";
foreach ($nodes as $node){
$dir = file_create_url($node->field_image_4x4['und'][0]['uri']);
$html .= "<div id ='div$node->nid'>".l('<img src="'. render($dir).'"/>','fbf/'/*.$node->nid.'/nojs'*/,array(
'attributes' => array(
'id' => "img".$node->nid,
'class' => array('use-ajax')
),
'html' =>TRUE
)).'</div>';
}
$html .= '</div>';
$block['content'] = $html;
}
return $block;
}
and this is the menu registration
function fbf_menu(){
$items['fbf'] = array(
'#page callback' => 'fbf_callback',
'#access callback' => array('user_access'),
'#access arguments' => 'access content',
'#type' => MENU_CALLBACK
);
return $items;
}
function fbf_callback($type = 'ajax'){
if($type == 'ajax'){
$output = '
algo
';