当前位置: 首页>>代码示例>>PHP>>正文


PHP ctools_modal_command_dismiss函数代码示例

本文整理汇总了PHP中ctools_modal_command_dismiss函数的典型用法代码示例。如果您正苦于以下问题:PHP ctools_modal_command_dismiss函数的具体用法?PHP ctools_modal_command_dismiss怎么用?PHP ctools_modal_command_dismiss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ctools_modal_command_dismiss函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hook_entityform_ctools_FORM_ID_commands_alter

/**
 * Implements hook_entityform_ctools_FORM_ID_commands_alter().
 *
 * Allow you to change and add new ajax commands after form was successful
 * submitted.
 */
function hook_entityform_ctools_FORM_ID_commands_alter(&$commands, $form_state)
{
    // Close modal window after successful submission.
    if ($form_state['executed']) {
        $commands[] = ctools_modal_command_dismiss();
    }
}
开发者ID:Niklan,项目名称:entityform_ctools,代码行数:13,代码来源:entityform_ctools.api.php

示例2: ajax_set_layout

 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);
 }
开发者ID:rexxllabore,项目名称:acme,代码行数:34,代码来源:panels_renderer_ipe.class.php

示例3: ajax_access_configure_test

  /**
   * AJAX entry point for to configure vsibility rule.
   */
  function ajax_access_configure_test($pid = NULL, $id = NULL) {
    if (empty($this->display->content[$pid])) {
      ctools_modal_render(t('Error'), t('Invalid pane id.'));
    }

    $pane = &$this->display->content[$pid];
    $subtype = ctools_content_get_subtype($pane->type, $pane->subtype);

    // Set this up here because $id gets changed later.
    $url = $this->get_url('access-configure-test', $pid, $id);

    // If we're adding a new one, get the stored data from cache and
    // add it. It's stored as a cache so that if this is closed
    // we don't accidentally add an unconfigured plugin.
    if ($id == 'add') {
      $pane->access['plugins'][] = $this->cache->new_plugin;
      $id = max(array_keys($pane->access['plugins']));
    }
    else if (empty($pane->access['plugins'][$id])) {
      ctools_modal_render(t('Error'), t('Invalid test id.'));
    }

    $form_state = array(
      'display' => &$this->display,
      'pane' => &$pane,
      'ajax' => TRUE,
      'title' => t('Configure visibility rule for !subtype_title', array('!subtype_title' => $subtype['title'])),
      'test' => &$pane->access['plugins'][$id],
      'plugin' => ctools_get_access_plugin($pane->access['plugins'][$id]['name']),
      'url' => url($url, array('absolute' => TRUE)),
    );

    $output = ctools_modal_form_wrapper('panels_edit_configure_access_test_form', $form_state);
    if (empty($form_state['executed'])) {
      $this->commands = $output;
      return;
    }

    // Unset the new plugin
    if (isset($this->cache->new_plugin)) {
      unset($this->cache->new_plugin);
    }

    if (!empty($form_state['remove'])) {
      unset($pane->access['plugins'][$id]);
    }

    panels_edit_cache_set($this->cache);
    $this->command_update_pane($pid);
    $this->commands[] = ctools_modal_command_dismiss();
  }
开发者ID:north-central-college,项目名称:hrjobs,代码行数:54,代码来源:panels_renderer_editor.class.php

示例4: ajax_edit_pane

 /**
  * AJAX entry point to edit a pane.
  */
 function ajax_edit_pane($pid = NULL, $step = NULL)
 {
     if (empty($this->cache->display->content[$pid])) {
         ctools_modal_render(t('Error'), t('Invalid pane id.'));
     }
     $pane =& $this->cache->display->content[$pid];
     // Check if we should skip pane translation.
     if (_mlpanels_pane_skip($pane->type, $pane->subtype)) {
         // Pass to default renderer.
         return parent::ajax_edit_pane($pid, $step);
     }
     $content_type = ctools_get_content_type($pane->type);
     $subtype = ctools_content_get_subtype($content_type, $pane->subtype);
     $settings = _mlpanels_settings();
     if (empty($step)) {
         $messages[] = t('You can translate settings for different languages,
   but you must set %renderer as display renderer in order to see result.', array('%renderer' => t('Multilingual Standard')));
     }
     if ($settings['show_types']) {
         $messages[] = t('Pane type to disable %type', array('%type' => $pane->type . '::' . $pane->subtype));
     }
     // Get language.
     $path = explode('/', $_GET['q']);
     $tmp = explode('_', end($path));
     if ($tmp[0] == 'mlpanels') {
         $conf_lng = $tmp[1];
     }
     if (empty($conf_lng)) {
         $conf_lng = LANGUAGE_NONE;
     }
     // Prepare language dependent config.
     if (!empty($pane->configuration['mlpanels'])) {
         $ml_config = $pane->configuration['mlpanels'];
         $ml_config[LANGUAGE_NONE] = $pane->configuration;
         unset($ml_config[LANGUAGE_NONE]['mlpanels']);
     } else {
         $ml_config[LANGUAGE_NONE] = $pane->configuration;
     }
     if (!empty($ml_config[$conf_lng])) {
         $configuration = $ml_config[$conf_lng];
     } else {
         $messages[] = t('No configuration exists for this language yet, using default.');
         $configuration = $ml_config[LANGUAGE_NONE];
     }
     // Safety check.
     if (isset($configuration['mlpanels'])) {
         unset($configuration['mlpanels']);
     }
     // Change finish button text.
     $finish_text = t('Finish');
     if ($conf_lng != LANGUAGE_NONE) {
         if (_mlpanels_settings('keep_window')) {
             $finish_text = t('Save Translation and Continue');
         } else {
             $finish_text = t('Save Translation and Finish');
         }
     }
     $form_state = array('display' => &$this->cache->display, 'contexts' => $this->cache->display->context, 'pane' => &$pane, 'display cache' => &$this->cache, 'ajax' => TRUE, 'modal' => TRUE, 'modal return' => TRUE, 'commands' => array());
     $form_info = array('path' => $this->get_url('edit-pane', $pid, '%step', 'mlpanels_' . $conf_lng), 'show cancel' => TRUE, 'finish text' => $finish_text, 'next callback' => 'panels_ajax_edit_pane_next', 'finish callback' => 'panels_ajax_edit_pane_finish', 'cancel callback' => 'panels_ajax_edit_pane_cancel');
     // This is used to get our form in form alter.
     if ($conf_lng != LANGUAGE_NONE) {
         $form_info['untranslate text'] = t('Remove Translation');
         $form_info['untranslate hidden'] = empty($ml_config[$conf_lng]);
     }
     // Building form.
     $output = ctools_content_form('edit', $form_info, $form_state, $content_type, $pane->subtype, $subtype, $configuration, $step);
     // Add language links to the form.
     $languages = array(LANGUAGE_NONE => (object) array('name' => t('Default'), 'language' => LANGUAGE_NONE)) + language_list();
     foreach ($languages as $lng) {
         $class = array('ctools-use-modal');
         $class[] = $lng->language;
         if (empty($ml_config[$lng->language])) {
             $class[] = 'empty';
         }
         if ($conf_lng == $lng->language) {
             $class[] = 'current';
         }
         $links[] = l($lng->name, $this->get_url('edit-pane', $pid, $form_state['step'], 'mlpanels_' . $lng->language), array('attributes' => array('class' => $class), 'html' => TRUE));
     }
     $output['mlpanels'] = array('#markup' => theme('item_list', array('items' => $links, 'attributes' => array('class' => array('mlpanels_lnd_list')))));
     $output['mlpanels_messages'] = array('#markup' => '<div class="message-target"></div>');
     // If $rc is FALSE, there was no actual form.
     if ($output === FALSE || !empty($form_state['cancel'])) {
         // Dismiss the modal.
         $this->commands[] = ctools_modal_command_dismiss();
     } elseif (!empty($form_state['clicked_button']) && $form_state['clicked_button']['#wizard type'] == 'untranslate') {
         // Unset surrent translation.
         unset($ml_config[$conf_lng]);
         // Update pane configuration.
         $form_state['pane']->configuration = array('mlpanels' => $ml_config) + $ml_config[LANGUAGE_NONE];
         // References get blown away with AJAX caching. This will fix that.
         $this->cache->display->content[$pid] = $form_state['pane'];
         panels_edit_cache_set($this->cache);
         $this->command_update_pane($pid);
         if (_mlpanels_settings('keep_window') && $conf_lng != LANGUAGE_NONE) {
             drupal_set_message(t('Translation removed.'));
             $this->commands[] = ajax_command_remove('#modal-content .messages');
//.........这里部分代码省略.........
开发者ID:agroknow,项目名称:agreri,代码行数:101,代码来源:mlpanels_panels_renderer_editor.class.php


注:本文中的ctools_modal_command_dismiss函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。