<?php
// $Id$
function ahah_goods_filter_help($path, $arg)
{
}
function ahah_goods_filter_perm()
{
return array('access ahah_goods_filter content');
}
function ahah_goods_filter_menu()
{
$items['filter/%'] = array(
'title' => t('My page'),
'callback' => 'ahah_goods_filter_processor',
'access arguments' => array('access filter content'),
'type' => MENU_CALLBACK
);
return $items;
}
function ahah_goods_filter_processor()
{
return drupal_json(array('status' => TRUE, 'data' => "Hello Drupal World"));
}
function ahah_goods_filter_form()
{
// Тут будет строится форма фильтра с учётом языка и тд.
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#size' => 30,
'#maxlength' => 64,
'#description' => t('Enter the name for this group of settings'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#weight' => 1,
'#submit' => array('my_form_submit'),//none JS version
'#ahah' => array(
'event' => 'click',
'path' => 'filter/',
'wrapper' => 'myform-wrapper',
'method' => 'replace',
'effect' => 'fade',
'progress' => array(
'type' => 'bar',
'message' => t('Loading...')
)
)
);
return $form;
}
// Собственно - блок фильтра. В нём будет форма
function ahah_goods_filter_block($op='list', $delta=0)
{
if ($op == "list")
{
$block[0]["info"] = t('Romsat goods filter');
return $block;
}
elseif($op == 'view')
{