$output .= theme('pager'); // тут строка
drupal_get_form('my_form'); // тут массив
return что то... тут собственно нужно вернуть результат, по одиночке все работает, а вот вместе - нет
Вот все что есть:
/**
* return mixed
* Implementation hook_menu()
*/
function product_menu() {
$item['products'] = array(
'title' => t('Products'),
'page callback' => 'get_products',
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
// 'file' => 'product.admin.inc',
);
$item['products/add'] = array(
'title' => t('Products'),
'page callback' => 'products_add',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$item['products/edit/%'] = array(
'title' => t('Products edit'),
'page callback' => 'product_edit',
'page arguments' => array(3),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$item['products/list'] = array(
'title' => t('Products list'),
'page callback' => 'product_list',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $item;
}
function get_products() {
$header = array(
array('data' => 'ID', 'field' => 'id'),
array('data' => 'Name', 'field' => 'name'),
array('data' => 'Category', 'field' => 'category'),
array('data' => 'Shelf life', 'field' => 'shelf_life'),
array('data' => 'Email', 'field' => 'email'),
array('data' => 'Phone', 'field' => 'phone'),
array('data' => 'Action', 'field' => 'action'),
);
$nodes = db_select('products', 'p')
->fields('p', array('id', 'name', 'category', 'shelf_life', 'email', 'phone'))
->extend('PagerDefault')
->limit(10)
->extend('TableSort')
->orderByHeader($header)
->execute();
$row = array();
foreach ($nodes as $node) {
$row[] = array(
check_plain($node->title),
format_date($node->created),
$node->type,
);
}
$output = theme('table', array('header' => $header, 'row' => $row));
$e = array();
$e['one'] = $output .= theme('pager');
$e['two'] = drupal_get_form('my_form');
return $e;
}
function my_form() {
$form['name'] = array(
'#title' => t('Your Name'),
'#type' => 'fieldset',
'#description' => t('What people call you.')
);
$form['name']['user_name'] = array(
'#title' => t('Your Name'),
'#type' => 'textfield',
'#description' => t('Please enter your name.')
);
$form['color'] = array(
// '#prefix' => '
',
'#title' => t('Color'),
'#type' => 'fieldset',
'#description' => t('This fieldset contains the Color field'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['color_options'] = array(
'#type' => 'value',
'#value' => array(t('red'), t('green'), t('blue'))
);
$form['color']['favorite_color'] = array(
'#title' => t('Favorite Color'),
'#type' => 'select',
'#description' => t('Please select your favorite color.'),
'#options' => $form['color_options']['#value']
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit')
);
return $form;
}
Комментарии
render(drupal_get_form('my_form')) - строка
или я не так понял?
$render_form = render(drupal_get_form('my_form'));
return $render_form . $pager;
ой спасибо! только чуть подкорректировал, вот так:
$output .= theme('pager');
$get_form = drupal_get_form('my_form');
$render_form = render($get_form);
return $output . $render_form;