Exemplo n.º 1
0
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']);
}
  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;
  }
Exemplo n.º 3
0
 /**
  * {@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);
 }
Exemplo n.º 4
0
 /**
  * {@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;
 }
Exemplo n.º 5
0
 /**
  * {@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;
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
Exemplo n.º 8
0
 /**
  * {@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;
     }
 }
 /**
  * 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;
 }
Exemplo n.º 10
0
 /**
  * {@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;
 }
 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;
 }
Exemplo n.º 12
0
 /**
  * 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 '';
     }
 }
 /**
  * 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;
 }
 /**
  * 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);
 }
Exemplo n.º 15
0
 /**
  * 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;
 }
Exemplo n.º 16
0
 function clone_page($js, $input, $item, $step = NULL)
 {
     drupal_set_title($this->get_page_title('clone', $item));
     $name = $item->{$this->plugin['export']['key']};
     $form_state = array('plugin' => $this->plugin, 'object' => &$this, 'ajax' => $js, 'item' => $item, 'op' => 'add', 'form type' => 'clone', 'original name' => $name, 'rerender' => TRUE, 'no_redirect' => TRUE, 'step' => $step, 'function args' => func_get_args());
     $output = drupal_build_form('views_ui_clone_form', $form_state);
     if (!empty($form_state['executed'])) {
         $item->name = $form_state['values']['name'];
         $item->human_name = $form_state['values']['human_name'];
         $item->vid = NULL;
         views_ui_cache_set($item);
         drupal_goto(ctools_export_ui_plugin_menu_path($this->plugin, 'edit', $item->name));
     }
     return $output;
 }
Exemplo n.º 17
0
function vizz2_preprocess_user_register(&$vars)
{
    $vars['form'] = drupal_build_form('user_register_form', user_register_form(array()));
}
 /**
  * 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'])) {
         // Cleanup the stream config and stream from static caches.
         heartbeat_stream_config_reset($item);
         ctools_export_crud_delete($this->plugin['schema'], $item);
         $message = str_replace('%title', check_plain($item->{$this->plugin['export']['key']}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
         // Cleanup the blocks that might be in use.
         db_delete('block')->condition('module', 'heartbeat')->condition('delta', $item->class)->execute();
         drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
     }
     return $output;
 }
 /**
  * Highly specialized list.
  */
 function list_page($js, $input)
 {
     $this->items = ctools_export_crud_load_all($this->plugin['schema'], $js);
     // Respond to a reset command by clearing session and doing a drupal goto
     // back to the base URL.
     if (isset($input['op']) && $input['op'] == t('Reset')) {
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]);
         if (!$js) {
             drupal_goto($_GET['q']);
         }
         // clear everything but form id, form build id and form token:
         $keys = array_keys($input);
         foreach ($keys as $id) {
             if (!in_array($id, array('form_id', 'form_build_id', 'form_token'))) {
                 unset($input[$id]);
             }
         }
     }
     // If there is no input, check to see if we have stored input in the
     // session.
     if (!isset($input['form_id'])) {
         if (isset($_SESSION['ctools_export_ui'][$this->plugin['name']]) && is_array($_SESSION['ctools_export_ui'][$this->plugin['name']])) {
             $input = $_SESSION['ctools_export_ui'][$this->plugin['name']];
         }
     } else {
         $_SESSION['ctools_export_ui'][$this->plugin['name']] = $input;
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]['q']);
     }
     // This is where the form will put the output.
     $this->rows = array();
     $this->sorts = array();
     $form_state = array('plugin' => $this->plugin, 'input' => $input, 'rerender' => TRUE, 'no_redirect' => TRUE, 'object' => &$this);
     if (!isset($form_state['input']['form_id'])) {
         $form_state['input']['form_id'] = 'ctools_export_ui_list_form';
     }
     // If we do any form rendering, it's to completely replace a form on the
     // page, so don't let it force our ids to change.
     if ($js && isset($_POST['ajax_html_ids'])) {
         unset($_POST['ajax_html_ids']);
     }
     $form = drupal_build_form('custom_help_text_list_form', $form_state);
     if (!$js) {
         $this->list_css();
         return drupal_render($form);
     }
     $table = theme('custom_help_text_list_form', array('form' => $form, 'js' => $js));
     $commands = array();
     $commands[] = ajax_command_replace('#custom_help_text_table', $table);
     print ajax_render($commands);
     ajax_footer();
 }
Exemplo n.º 20
0
function umzen_dataguide_preprocess_user_register(&$variables)
{
    $variables['form'] = drupal_build_form('user_register_form', user_register_form(array()));
}
Exemplo n.º 21
0
 /**
  * Simulate action of pressing of an Add More button. This function processes
  * the form based on the specified inputs and updates the form with the new
  * values in the cache so that the form's submit button can work correctly.
  *
  * @param string $triggering_element_name
  *   Name of the Add More button or value of Op key.
  * @param array $options
  *   Options array. If key "ajax" is set to TRUE, then
  *   $triggering_element_name is assumed to be name of the Add More button
  *   otherwise it is taken to be the value of Op key.
  *
  * @return Response
  *   Response object.
  */
 public function pressButton($triggering_element_name = NULL, $options = array())
 {
     $options += array('ajax' => FALSE);
     $ajax = $options['ajax'];
     // Make sure that a button with provided name exists.
     if ($ajax && !is_null($triggering_element_name) && !$this->buttonExists($triggering_element_name)) {
         return new Response(FALSE, NULL, "Button {$triggering_element_name} does not exist.");
     }
     if (!$ajax) {
         // If this is not an AJAX request, then the supplied name is the value of
         // Op parameter.
         $response = $this->fillOpValues($triggering_element_name);
         if (!$response->getSuccess()) {
             return $response;
         }
     }
     $this->clearErrors();
     $this->makeUncheckedCheckboxesNull();
     $this->removeFileFieldWeights();
     $old_form_state_values = !empty($this->form_state['values']) ? $this->form_state['values'] : array();
     $this->form_state = form_state_defaults();
     $args = func_get_args();
     // Remove $triggering_element_name from the arguments.
     array_shift($args);
     // Remove $options from the arguments.
     array_shift($args);
     $this->form_state['build_info']['args'] = $args;
     $this->form_state['programmed_bypass_access_check'] = FALSE;
     //$this->form_state['values']['form_build_id'] = $this->form['#build_id'];
     // Add more field button sets $form_state['rebuild'] to TRUE because of
     // which submit handlers are not called. Hence we set it back to FALSE.
     $this->removeKey('input');
     $this->removeKey('triggering_element');
     $this->removeKey('validate_handlers');
     $this->removeKey('submit_handlers');
     $this->removeKey('clicked_button');
     $this->form_state['input'] = $old_form_state_values;
     $this->form_state['input']['form_build_id'] = $this->form['#build_id'];
     if (!is_null($triggering_element_name) && $ajax) {
         $this->form_state['input']['_triggering_element_name'] = $triggering_element_name;
     }
     $this->form_state['no_redirect'] = TRUE;
     $this->form_state['method'] = 'post';
     //$this->form_state['programmed'] = TRUE;
     $this->form = drupal_build_form($this->form_id, $this->form_state);
     if ($ajax && !is_null($triggering_element_name)) {
         unset($this->form_state['values'][$triggering_element_name]);
     }
     // Reset the static cache for validated forms otherwise form won't go
     // through validation function again.
     drupal_static_reset('drupal_validate_form');
     if ($errors = form_get_errors()) {
         $this->errors = $errors;
         return new Response(FALSE, NULL, implode(", ", $this->errors));
     }
     return new Response(TRUE, NULL, "");
 }
 /**
  * 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'])) {
         ctools_export_crud_delete($this->plugin['schema'], $item);
         $export_key = $this->plugin['export']['key'];
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
         // Perform a deletion of the activity for this template.
         if (!($item->export_type & EXPORT_IN_CODE)) {
             db_delete('heartbeat_activity')->condition('message_id', $item->message_id)->execute();
         }
         drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
     }
     return $output;
 }
 function page_content($js, $input, $entity, $view_mode)
 {
     $panelizer = $entity->panelizer[$view_mode];
     if (empty($panelizer)) {
         return MENU_NOT_FOUND;
     }
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $form_state = array('entity' => $entity, 'revision info' => $this->entity_allows_revisions($entity), 'display cache' => panels_edit_cache_get(implode(':', array_filter(array('panelizer', $this->entity_type, $entity_id, $view_mode, $revision_id)))), 'no_redirect' => TRUE);
     ctools_include('common', 'panelizer');
     $output = drupal_build_form('panelizer_edit_content_form', $form_state);
     if (!empty($form_state['executed'])) {
         if (!empty($form_state['clicked_button']['#save-display'])) {
             drupal_set_message(t('The settings have been updated.'));
             $entity->panelizer[$view_mode]->display = $form_state['display'];
             $entity->panelizer[$view_mode]->display_is_modified = TRUE;
             $this->entity_save($entity);
         } else {
             drupal_set_message(t('Changes have been discarded.'));
         }
         panels_edit_cache_clear($form_state['display cache']);
         drupal_goto($_GET['q']);
     }
     $output = $this->wrap_entity_panelizer_pages($entity, $view_mode, $output);
     ctools_set_no_blocks(FALSE);
     drupal_set_page_content($output);
     $page = element_info('page');
     return $page;
 }
Exemplo n.º 24
0
/**
 * Run an individual installation task.
 *
 * @param $task
 *   An array of information about the task to be run.
 * @param $install_state
 *   An array of information about the current installation state. This is
 *   passed in by reference so that it can be modified by the task.
 * @return
 *   The output of the task function, if there is any.
 */
function install_run_task($task, &$install_state)
{
    $function = $task['function'];
    if ($task['type'] == 'form') {
        require_once DRUPAL_ROOT . '/includes/form.inc';
        if ($install_state['interactive']) {
            // For interactive forms, build the form and ensure that it will not
            // redirect, since the installer handles its own redirection only after
            // marking the form submission task complete.
            $form_state = array('args' => array(&$install_state), 'no_redirect' => TRUE);
            $form = drupal_build_form($function, $form_state);
            // If a successful form submission did not occur, the form needs to be
            // rendered, which means the task is not complete yet.
            if (empty($form_state['executed'])) {
                $install_state['task_not_complete'] = TRUE;
                return drupal_render($form);
            }
            // Otherwise, return nothing so the next task will run in the same
            // request.
            return;
        } else {
            // For non-interactive forms, submit the form programmatically with the
            // values taken from the installation state. Throw an exception if any
            // errors were encountered.
            $form_state = array('values' => !empty($install_state['forms'][$function]) ? $install_state['forms'][$function] : array());
            drupal_form_submit($function, $form_state, $install_state);
            $errors = form_get_errors();
            if (!empty($errors)) {
                throw new Exception(implode("\n", $errors));
            }
        }
    } elseif ($task['type'] == 'batch') {
        // Start a new batch based on the task function, if one is not running
        // already.
        $current_batch = variable_get('install_current_batch');
        if (!$install_state['interactive'] || !$current_batch) {
            $batch = $function($install_state);
            if (empty($batch)) {
                // If the task did some processing and decided no batch was necessary,
                // there is nothing more to do here.
                return;
            }
            batch_set($batch);
            // For interactive batches, we need to store the fact that this batch
            // task is currently running. Otherwise, we need to make sure the batch
            // will complete in one page request.
            if ($install_state['interactive']) {
                variable_set('install_current_batch', $function);
            } else {
                $batch =& batch_get();
                $batch['progressive'] = FALSE;
            }
            // Process the batch. For progressive batches, this will redirect.
            // Otherwise, the batch will complete.
            batch_process(install_redirect_url($install_state), install_full_redirect_url($install_state));
        } elseif ($current_batch == $function) {
            include_once DRUPAL_ROOT . '/includes/batch.inc';
            $output = _batch_page();
            // The task is complete when we try to access the batch page and receive
            // FALSE in return, since this means we are at a URL where we are no
            // longer requesting a batch ID.
            if ($output === FALSE) {
                // Return nothing so the next task will run in the same request.
                variable_del('install_current_batch');
                return;
            } else {
                // We need to force the page request to end if the task is not
                // complete, since the batch API sometimes prints JSON output
                // rather than returning a themed page.
                $install_state['task_not_complete'] = $install_state['stop_page_request'] = TRUE;
                return $output;
            }
        }
    } else {
        // For normal tasks, just return the function result, whatever it is.
        return $function($install_state);
    }
}
Exemplo n.º 25
0
 function ajax_set_layout($layout)
 {
     ctools_include('context');
     ctools_include('display-layout', 'panels');
     $form_state = array('layout' => $layout, 'display' => $this->display, 'finish' => t('Save'), 'no_redirect' => TRUE);
     // Reset the $_POST['ajax_html_ids'] values to preserve
     // proper IDs on form elements when they are rebuilt
     // by the Panels IPE without refreshing the page
     $_POST['ajax_html_ids'] = array();
     $output = drupal_build_form('panels_change_layout', $form_state);
     $output = drupal_render($output);
     if (!empty($form_state['executed'])) {
         if (isset($form_state['back'])) {
             return $this->ajax_change_layout();
         }
         if (!empty($form_state['clicked_button']['#save-display'])) {
             // Saved. Save the cache.
             panels_edit_cache_save($this->cache);
             $this->display->skip_cache;
             // Since the layout changed, we have to update these things in the
             // renderer in order to get the right settings.
             $layout = panels_get_layout($this->display->layout);
             $this->plugins['layout'] = $layout;
             if (!isset($layout['regions'])) {
                 $this->plugins['layout']['regions'] = panels_get_regions($layout, $this->display);
             }
             $this->meta_location = 'inline';
             $this->commands[] = ajax_command_replace("#panels-ipe-display-{$this->clean_key}", panels_render_display($this->display, $this));
             $this->commands[] = ctools_modal_command_dismiss();
             return;
         }
     }
     $this->commands[] = ctools_modal_command_display(t('Change layout'), $output);
 }
Exemplo n.º 26
0
function bootstrap_its_preprocess_user_register(&$variables)
{
    $variables['form'] = drupal_build_form('user_register_form', user_register_form(array()));
}