本文整理汇总了PHP中panels_edit_cache_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP panels_edit_cache_clear函数的具体用法?PHP panels_edit_cache_clear怎么用?PHP panels_edit_cache_clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了panels_edit_cache_clear函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page_content
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;
}
示例2: ajax_save_form
/**
* AJAX entry point to create the controller form for an IPE.
*/
function ajax_save_form($break = NULL)
{
if ($this->ipe_test_lock('save-form', $break)) {
return;
}
// 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();
$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.
$this->cache->ipe_locked = TRUE;
panels_edit_cache_set($this->cache);
$this->commands[] = array('command' => 'initIPE', 'key' => $this->clean_key, 'data' => drupal_render($output), 'lockPath' => $this->get_url('unlock_ipe'));
return;
}
// Check to see if we have a lock that was broken. If so we need to
// inform the user and abort.
if (empty($this->cache->ipe_locked)) {
$this->commands[] = ajax_command_alert(t('A lock you had has been externally broken, and all your changes have been reverted.'));
$this->commands[] = array('command' => 'cancelIPE', 'key' => $this->clean_key);
return;
}
// Otherwise it was submitted.
if (!empty($form_state['clicked_button']['#save-display'])) {
// Saved. Save the cache.
panels_edit_cache_save($this->cache);
// A rerender should fix IDs on added panes as well as ensure style changes are
// rendered.
$this->meta_location = 'inline';
$this->commands[] = ajax_command_replace("#panels-ipe-display-{$this->clean_key}", panels_render_display($this->display, $this));
} else {
// Cancelled. Clear the cache.
panels_edit_cache_clear($this->cache);
}
$this->commands[] = array('command' => 'endIPE', 'key' => $this->clean_key);
}
示例3: ajax_save_form
/**
* AJAX entry point to create the controller form for an IPE.
*/
function ajax_save_form($break = NULL)
{
ctools_include('form');
if (!empty($this->cache->locked)) {
if ($break != 'break') {
$account = user_load($this->cache->locked->uid);
$name = theme('username', $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 = ctools_build_form('panels_ipe_edit_control_form', $form_state);
if ($output) {
// 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' => $output);
return;
}
// no output == submit
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);
}