本文整理汇总了PHP中drupal_build_form函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_build_form函数的具体用法?PHP drupal_build_form怎么用?PHP drupal_build_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_build_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mortgagespeak_preprocess_user_register_form
function mortgagespeak_preprocess_user_register_form(&$vars)
{
$args = func_get_args();
array_shift($args);
$form_state['build_info']['args'] = $args;
$vars['form'] = drupal_build_form('user_register_form', $form_state['build_info']['args']);
}
示例2: edit
function edit() {
$form_state = array(
'display' => &$this->display,
'renderer' => &$this,
'content_types' => $this->cache->content_types,
'no_redirect' => TRUE,
'display_title' => !empty($this->cache->display_title),
'cache key' => $this->display->cache_key,
);
$output = drupal_build_form('panels_edit_display_form', $form_state);
if (empty($form_state['executed']) || !empty($form_state['clicked_button']['preview'])) {
return $output;
}
if (!empty($form_state['clicked_button']['#save-display'])) {
drupal_set_message(t('Panel content has been updated.'));
panels_save_display($this->display);
}
else {
drupal_set_message(t('Your changes have been discarded.'));
}
panels_cache_clear('display', $this->display->did);
return $this->display;
}
示例3: getForm
/**
* {@inheritdoc}
*/
public function getForm($formClass)
{
$args = func_get_args();
array_shift($args);
if (!class_exists($formClass)) {
$this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not exists", ['@class' => $formClass]);
return [];
}
if (!method_exists($formClass, 'create')) {
$this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not implements ::create()", ['@class' => $formClass]);
return [];
}
// God, I do hate Drupal 8...
$form = call_user_func([$formClass, 'create'], $this->container);
if (!$form instanceof FormInterface) {
$this->logger->log(LogLevel::CRITICAL, "Form class '@class' does not implement \\Drupal\\Core\\Form\\FormInterface", ['@class' => $formClass]);
return [];
}
$formId = $form->getFormId();
$data = [];
$data['build_info']['args'] = $args;
$formState = new FormState($data);
$formState->setFormObject($form);
$this->formMap[$formId] = [$form, $formState];
return drupal_build_form($formId, $data);
}
示例4: build
/**
* {@inheritdoc}
*/
public function build()
{
$form_state = array();
$form_state['build_info']['args'] = array();
$form_state['build_info']['callback'] = array($this, 'buildForm');
$form = drupal_build_form('devel_node_access_by_user_form', $form_state);
return $form;
}
示例5: build
/**
* {@inheritdoc}
*/
public function build()
{
$form_state = array();
$form_state->addBuildInfo('args', array());
$form_state->addBuildInfo('callback', array($this, 'buildForm'));
$form = drupal_build_form('devel_node_access_form', $form_state);
return $form;
}
示例6: edit_execute_form_standard
/**
* Execute the standard form for editing.
*
* By default, export UI will provide a single form for editing an object.
*/
function edit_execute_form_standard(&$form_state)
{
$output = drupal_build_form('ctools_export_ui_edit_item_form', $form_state);
if (!empty($form_state['executed'])) {
$this->edit_save_form($form_state);
// Flush all drupal caches.
drupal_flush_all_caches();
}
return $output;
}
示例7: add_entity_page
/**
* Add entity page.
*/
function add_entity_page($js, $input, $item, $step = NULL)
{
drupal_set_title($this->get_page_title('add_entity', $item));
$form_state = array('entity' => fieldable_panels_panes_create(array('bundle' => $item->name)), 'add submit' => TRUE, 'plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => 'add_entity', 'no_redirect' => TRUE, 'rerender' => TRUE, 'step' => $step, 'function args' => func_get_args());
// Default these to reusable.
$form_state['entity']->reusable = TRUE;
$output = drupal_build_form('fieldable_panels_panes_entity_edit_form', $form_state);
if (!empty($form_state['executed'])) {
$this->redirect($form_state['op'], $form_state['item']);
}
return $output;
}
示例8: build
/**
* {@inheritdoc}
*/
public function build()
{
$links = $this->switchUserList();
if (!empty($links)) {
$build = array('devel_links' => array('#theme' => 'links', '#links' => $links), '#attached' => array('css' => array(drupal_get_path('module', 'devel') . '/css/devel.css')));
if ($this->configuration['show_form']) {
$form_state = array();
$form_state['build_info']['args'] = array();
$form_state['build_info']['callback'] = array($this, 'switchForm');
$build['devel_form'] = drupal_build_form('devel_switch_user_form', $form_state);
}
return $build;
}
}
示例9: edit_execute_form_standard
/**
* Make certain that setting form_state['rebuild'] = TRUE in a submit function
* will correctly rebuild the exportables item edit form for the user. This
* function is needed until the patch at http://drupal.org/node/1524598 is
* committed.
*/
function edit_execute_form_standard(&$form_state)
{
$output = drupal_build_form('ctools_export_ui_edit_item_form', $form_state);
if (!empty($form_state['executed']) && !$form_state['rebuild']) {
// Interstitial slots are not displayed as a block.
if (!empty($form_state['values']['settings']['out_of_page'])) {
$form_state['item']->block = '0';
}
$this->edit_save_form($form_state);
} else {
unset($form_state['executed']);
}
return $output;
}
示例10: getJS
/**
* {@inheritdoc}
*/
public function getJS()
{
$js = parent::getJS();
// Ensure we've a sane url.
if (!empty($js['opt']['url'])) {
$js['opt']['url'] = url($js['opt']['url']);
} else {
// Remove the option as it is even used if empty.
unset($js['opt']['url']);
}
// @TODO Find a way how to do this just once per map / collection.
if ($this->getOption('devMode')) {
include 'forms.inc';
$form_state = array();
$form_state['build_info']['args'] = array($this);
$form = drupal_build_form('openlayers_dev_dialog_form', $form_state);
unset($form['options']['devMode']);
$js['opt']['devDialog'] = filter_xss(drupal_render($form), array('label', 'form', 'input', 'select', 'textarea', 'div', 'ul', 'ol', 'li', 'dl', 'dt', 'dd'));
}
return $js;
}
示例11: delete_page
function delete_page($js, $input, $item)
{
$clone = clone $item;
// Change the name into the title so the form shows the right value.
// @todo file a bug against CTools to use admin title if available.
$clone->name = $clone->title;
$form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $clone, 'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete', 'rerender' => TRUE, 'no_redirect' => TRUE);
$output = drupal_build_form('ctools_export_ui_delete_confirm_form', $form_state);
if (!empty($form_state['executed'])) {
ctools_export_crud_delete($this->plugin['schema'], $item);
$export_key = $this->plugin['export']['key'];
drupal_set_message(t($this->plugin['strings']['confirmation'][$form_state['op']]['success'], array('%title' => $item->title)));
drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
}
return $output;
}
示例12: get_control_login
/**
* Outputs a login form. Not displayed if already logged in.
* @param array $auth
* @param array $args
* @param string $tabalias
* @param array $options Options array passed in the configuration to the [login] control.
* Possible values include instruct - the instruction to display above the login form.
* @return string
*/
protected static function get_control_login($auth, $args, $tabalias, $options)
{
global $user;
$options = array_merge(array('instruct' => 'Please log in or <a href="user/register">register</a> to see more details of this record.'), $options);
if ($user->uid === 0) {
$form_state = array('noredirect' => TRUE);
$form = drupal_build_form('user_login', $form_state);
return '<div class="detail-panel" id="detail-panel-login">' . '<h3>' . lang::get('Login') . '</h3>' . '<p>' . lang::get($options['instruct']) . '</p>' . drupal_render($form) . '</div>';
} else {
return '';
}
}
示例13: delete_page
/**
* Page callback to delete an exportable item.
*/
function delete_page($js, $input, $item)
{
$form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => $item->export_type & EXPORT_IN_CODE ? 'revert' : 'delete', 'rerender' => TRUE, 'no_redirect' => TRUE);
$output = drupal_build_form('ctools_export_ui_delete_confirm_form', $form_state);
if (!empty($form_state['executed'])) {
$this->delete_form_submit($form_state);
$this->redirect($form_state['op'], $item);
}
return $output;
}
示例14: ajax_save_form
/**
* AJAX entry point to create the controller form for an IPE.
*/
function ajax_save_form($break = NULL)
{
if (!empty($this->cache->locked)) {
if ($break != 'break') {
$account = user_load($this->cache->locked->uid);
$name = theme('username', array('account' => $account));
$lock_age = format_interval(time() - $this->cache->locked->updated);
$message = t("This panel is being edited by user !user, and is therefore locked from editing by others. This lock is !age old.\n\nClick OK to break this lock and discard any changes made by !user.", array('!user' => $name, '!age' => $lock_age));
$this->commands[] = array('command' => 'unlockIPE', 'message' => $message, 'break_path' => url($this->get_url('save-form', 'break')));
return;
}
// Break the lock.
panels_edit_cache_break_lock($this->cache);
}
$form_state = array('display' => &$this->display, 'content_types' => $this->cache->content_types, 'rerender' => FALSE, 'no_redirect' => TRUE, 'layout' => $this->plugins['layout']);
$output = drupal_build_form('panels_ipe_edit_control_form', $form_state);
if (empty($form_state['executed'])) {
// At this point, we want to save the cache to ensure that we have a lock.
panels_edit_cache_set($this->cache);
$this->commands[] = array('command' => 'initIPE', 'key' => $this->clean_key, 'data' => drupal_render($output));
return;
}
// Otherwise it was submitted.
if (!empty($form_state['clicked_button']['#save-display'])) {
// Saved. Save the cache.
panels_edit_cache_save($this->cache);
} else {
// Cancelled. Clear the cache.
panels_edit_cache_clear($this->cache);
}
$this->commands[] = array('command' => 'endIPE', 'key' => $this->clean_key, 'data' => $output);
}
示例15: deploy_page
/**
* Renders the deployment plan page.
*/
function deploy_page($js, $input, $plan)
{
$form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'plan' => $plan, 'rerender' => TRUE, 'no_redirect' => TRUE);
$output = drupal_build_form('deploy_ui_plan_confirm_form', $form_state);
if (!empty($form_state['executed'])) {
try {
$plan->deploy();
} catch (Exception $e) {
drupal_set_message(t('Something went wrong during the deployment. Check your logs or the status of the deployment for more information.'), 'error');
}
drupal_goto('admin/structure/deploy');
}
return $output;
}