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


PHP drupal_get_destination函数代码示例

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


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

示例1: render

 /**
  * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::render().
  *
  * Renders the contextual fields.
  *
  * @param \Drupal\views\ResultRow $values
  *   The values retrieved from a single row of a view's query result.
  *
  * @see contextual_preprocess()
  * @see contextual_contextual_links_view_alter()
  */
 public function render(ResultRow $values)
 {
     $links = array();
     foreach ($this->options['fields'] as $field) {
         $rendered_field = $this->view->style_plugin->getField($this->view->row_index, $field);
         if (empty($rendered_field)) {
             continue;
         }
         $title = $this->view->field[$field]->last_render_text;
         $path = '';
         if (!empty($this->view->field[$field]->options['alter']['path'])) {
             $path = $this->view->field[$field]->options['alter']['path'];
         }
         if (!empty($title) && !empty($path)) {
             // Make sure that tokens are replaced for this paths as well.
             $tokens = $this->getRenderTokens(array());
             $path = strip_tags(decode_entities(strtr($path, $tokens)));
             $links[$field] = array('href' => $path, 'title' => $title);
             if (!empty($this->options['destination'])) {
                 $links[$field]['query'] = drupal_get_destination();
             }
         }
     }
     // Renders a contextual links placeholder.
     if (!empty($links)) {
         $contextual_links = array('contextual' => array('', array(), array('contextual-views-field-links' => UrlHelper::encodePath(Json::encode($links)))));
         $element = array('#type' => 'contextual_links_placeholder', '#id' => _contextual_links_to_id($contextual_links));
         return drupal_render($element);
     } else {
         return '';
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:43,代码来源:ContextualLinks.php

示例2: hook_admin_menu_output_alter

/**
 * Alter content in Administration menu bar before it is rendered.
 *
 * @param $content
 *   A structured array suitable for drupal_render(), at the very least
 *   containing the keys 'menu' and 'links'.  Most implementations likely want
 *   to alter or add to 'links'.
 *
 * $content['menu'] contains the HTML representation of the 'admin_menu' menu
 * tree.
 * @see admin_menu_menu_alter()
 *
 * $content['links'] contains additional top-level links in the Administration
 * menu, such as the icon menu or the logout link. You can add more items here
 * or play with the #weight attribute to customize them.
 * @see theme_admin_menu_links()
 * @see admin_menu_links_icon()
 * @see admin_menu_links_user()
 */
function hook_admin_menu_output_alter(&$content)
{
    // Add new top-level item.
    $content['menu']['myitem'] = array('#title' => t('My item'), '#attributes' => array('class' => array('mymodule-myitem')), '#href' => 'mymodule/path', '#options' => array('query' => drupal_get_destination()), '#weight' => 50);
    // Add link to manually run cron.
    $content['menu']['myitem']['cron'] = array('#title' => t('Run cron'), '#access' => user_access('administer site configuration'), '#href' => 'admin/reports/status/run-cron');
}
开发者ID:nagwani,项目名称:debugging_example,代码行数:26,代码来源:admin_menu.api.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, $entity = NULL, $bundle = NULL)
 {
     $this->entity_type = $entity;
     $this->bundle_type = $bundle;
     $config = $this->config('xmlsitemap.settings');
     $request = $this->getRequest();
     if (!$request->isXmlHttpRequest() && ($admin_path = xmlsitemap_get_bundle_path($entity, $bundle))) {
         // If this is a non-ajax form, redirect to the bundle administration page.
         $destination = drupal_get_destination();
         $request->query->remove('destination');
         $url = Url::fromUri($admin_path, array('query' => array($destination)));
         return new RedirectResponse($url);
     } else {
         $form['#title'] = $this->t('@bundle XML sitemap settings', array('@bundle' => $bundle));
     }
     xmlsitemap_add_link_bundle_settings($form, $form_state, $entity, $bundle);
     $form['xmlsitemap']['#type'] = 'markup';
     $form['xmlsitemap']['#value'] = '';
     $form['xmlsitemap']['#access'] = TRUE;
     $form['xmlsitemap']['#show_message'] = TRUE;
     $destination = $request->get('destination');
     $form['actions']['cancel'] = array('#type' => 'link', '#title' => $this->t('Cancel'), '#href' => isset($destination) ? $destination : 'admin/config/search/xmlsitemap/settings', '#weight' => 10);
     $form = parent::buildForm($form, $form_state);
     return $form;
 }
开发者ID:jeroenos,项目名称:jeroenos_d8.mypressonline.com,代码行数:28,代码来源:XmlSitemapLinkBundleSettingsForm.php

示例4: getOperations

 /**
  * {@inheritdoc}
  */
 public function getOperations(EntityInterface $entity)
 {
     $operations = parent::getOperations($entity);
     $destination = drupal_get_destination();
     $default = $entity->isDefault();
     $id = $entity->id();
     // Get CSRF token service.
     $token_generator = \Drupal::csrfToken();
     // @TODO: permission checks.
     if ($entity->status() && !$default) {
         $operations['disable'] = array('title' => $this->t('Disable'), 'url' => Url::fromRoute('domain.inline_action', array('op' => 'disable', 'domain' => $id)), 'weight' => 50);
     } elseif (!$default) {
         $operations['enable'] = array('title' => $this->t('Enable'), 'url' => Url::fromRoute('domain.inline_action', array('op' => 'enable', 'domain' => $id)), 'weight' => 40);
     }
     if (!$default) {
         $operations['default'] = array('title' => $this->t('Make default'), 'url' => Url::fromRoute('domain.inline_action', array('op' => 'default', 'domain' => $id)), 'weight' => 30);
         $operations['delete'] = array('title' => $this->t('Delete'), 'url' => Url::fromRoute('entity.domain.delete_form', array('domain' => $id)), 'weight' => 20);
     }
     // @TODO: inject this service?
     $operations += \Drupal::moduleHandler()->invokeAll('domain_operations', array($entity));
     foreach ($operations as $key => $value) {
         if (isset($value['query']['token'])) {
             $operations[$key]['query'] += $destination;
         }
     }
     $default = \Drupal::service('domain.loader')->loadDefaultDomain();
     // Deleting the site default domain is not allowed.
     if ($id == $default->id()) {
         unset($operations['delete']);
     }
     return $operations;
 }
开发者ID:dropdog,项目名称:play,代码行数:35,代码来源:DomainListBuilder.php

示例5: getLinks

 /**
  * Gets the list of links used by this field.
  *
  * @return array
  *   The links which are used by the render function.
  */
 protected function getLinks()
 {
     $links = array();
     foreach ($this->options['fields'] as $field) {
         if (empty($this->view->field[$field]->last_render_text)) {
             continue;
         }
         $title = $this->view->field[$field]->last_render_text;
         $path = '';
         $url = NULL;
         if (!empty($this->view->field[$field]->options['alter']['path'])) {
             $path = $this->view->field[$field]->options['alter']['path'];
         } elseif (!empty($this->view->field[$field]->options['alter']['url']) && $this->view->field[$field]->options['alter']['url'] instanceof UrlObject) {
             $url = $this->view->field[$field]->options['alter']['url'];
         }
         // Make sure that tokens are replaced for this paths as well.
         $tokens = $this->getRenderTokens(array());
         $path = strip_tags(String::decodeEntities($this->viewsTokenReplace($path, $tokens)));
         $links[$field] = array('url' => $path ? UrlObject::fromUri('internal:/' . $path) : $url, 'title' => $title);
         if (!empty($this->options['destination'])) {
             $links[$field]['query'] = drupal_get_destination();
         }
     }
     return $links;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:31,代码来源:Links.php

示例6: add_meta

 function add_meta()
 {
     ctools_include('display-edit', 'panels');
     ctools_include('content');
     if (empty($this->display->cache_key)) {
         $this->cache = panels_edit_cache_get_default($this->display);
     }
     // @todo we may need an else to load the cache, but I am not sure we
     // actually need to load it if we already have our cache key, and doing
     // so is a waste of resources.
     ctools_include('cleanstring');
     $this->clean_key = ctools_cleanstring($this->display->cache_key);
     $button = array('#type' => 'link', '#title' => t('Customize this page'), '#href' => $this->get_url('save_form'), '#options' => array('query' => drupal_get_destination()), '#id' => 'panels-ipe-customize-page', '#attributes' => array('class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
     panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
     // @todo this actually should be an IPE setting instead.
     if (user_access('change layouts in place editing')) {
         $button = array('#type' => 'link', '#title' => t('Change layout'), '#href' => $this->get_url('change_layout'), '#options' => array('query' => drupal_get_destination()), '#attributes' => array('class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
         panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
     }
     ctools_include('ajax');
     ctools_include('modal');
     ctools_modal_add_js();
     ctools_add_css('panels_dnd', 'panels');
     ctools_add_css('panels_admin', 'panels');
     ctools_add_js('panels-base', 'panels');
     ctools_add_js('panels_ipe', 'panels_ipe');
     ctools_add_css('panels_ipe', 'panels_ipe');
     drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting');
     drupal_add_library('system', 'ui.draggable');
     drupal_add_library('system', 'ui.droppable');
     drupal_add_library('system', 'ui.sortable');
     parent::add_meta();
 }
开发者ID:casivaagustin,项目名称:drupal-services,代码行数:33,代码来源:panels_renderer_ipe.class.php

示例7: view

 /**
  * {@inheritdoc}
  */
 public function view(OrderInterface $order, array $form, FormStateInterface $form_state)
 {
     $user = \Drupal::currentUser();
     $cart_config = \Drupal::config('uc_cart.settings');
     if ($user->isAuthenticated()) {
         $email = $user->getEmail();
         $contents['#description'] = $this->t('Order information will be sent to your account e-mail listed below.');
         $contents['primary_email'] = array('#type' => 'hidden', '#value' => $email);
         $contents['email_text'] = array('#markup' => '<div>' . $this->t('<b>E-mail address:</b> @email (<a href=":url">edit</a>)', ['@email' => $email, ':url' => Url::fromRoute('entity.user.edit_form', ['user' => $user->id()], ['query' => drupal_get_destination()])->toString()]) . '</div>');
     } else {
         $email = $order->getEmail();
         $contents['#description'] = $this->t('Enter a valid email address for this order or <a href=":url">click here</a> to login with an existing account and return to checkout.', [':url' => Url::fromRoute('user.login', [], ['query' => drupal_get_destination()])->toString()]);
         $contents['primary_email'] = array('#type' => 'email', '#title' => $this->t('E-mail address'), '#default_value' => $email, '#required' => TRUE);
         if ($cart_config->get('email_validation')) {
             $contents['primary_email_confirm'] = array('#type' => 'email', '#title' => $this->t('Confirm e-mail address'), '#default_value' => $email, '#required' => TRUE);
         }
         $contents['new_account'] = array();
         if ($cart_config->get('new_account_name')) {
             $contents['new_account']['name'] = array('#type' => 'textfield', '#title' => $this->t('Username'), '#default_value' => isset($order->data->new_user_name) ? $order->data->new_user_name : '', '#maxlength' => 60, '#size' => 32);
         }
         if ($cart_config->get('new_account_password')) {
             $contents['new_account']['pass'] = array('#type' => 'password', '#title' => $this->t('Password'), '#maxlength' => 32, '#size' => 32);
             $contents['new_account']['pass_confirm'] = array('#type' => 'password', '#title' => $this->t('Confirm password'), '#description' => $this->t('Passwords must match to proceed.'), '#maxlength' => 32, '#size' => 32);
         }
         if (!empty($contents['new_account'])) {
             $contents['new_account'] += array('#type' => 'details', '#title' => $this->t('New account details'), '#description' => $this->t('<b>Optional.</b> New customers may supply custom account details.<br />We will create these for you if no values are entered.'), '#open' => TRUE);
         }
     }
     return $contents;
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:33,代码来源:CustomerInfoPane.php

示例8: render

 /**
  * Renders a list with all custom links.
  *
  * @return array
  *   The list to be rendered.
  */
 public function render()
 {
     $build['xmlsitemap_add_custom'] = array('#type' => 'link', '#title' => t('Add custom link'), '#href' => 'admin/config/search/xmlsitemap/custom/add');
     $header = array('loc' => array('data' => t('Location'), 'field' => 'loc', 'sort' => 'asc'), 'priority' => array('data' => t('Priority'), 'field' => 'priority'), 'changefreq' => array('data' => t('Change frequency'), 'field' => 'changefreq'), 'language' => array('data' => t('Language'), 'field' => 'language'), 'operations' => array('data' => t('Operations')));
     $rows = array();
     $destination = drupal_get_destination();
     $query = db_select('xmlsitemap');
     $query->fields('xmlsitemap');
     $query->condition('type', 'custom');
     $query->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')->limit(50);
     $query->extend('Drupal\\Core\\Database\\Query\\TableSortExtender')->orderByHeader($header);
     $result = $query->execute();
     foreach ($result as $link) {
         $language = $this->languageManager->getLanguage($link->language);
         $row = array();
         $row['loc'] = $this->l($link->loc, Url::fromUri($link->loc));
         $row['priority'] = number_format($link->priority, 1);
         $row['changefreq'] = $link->changefreq ? drupal_ucfirst(xmlsitemap_get_changefreq($link->changefreq)) : t('None');
         if (isset($header['language'])) {
             $row['language'] = t($language->name);
         }
         $operations['edit'] = array('title' => t('Edit'), 'route_name' => 'xmlsitemap_custom.edit', 'route_parameters' => array('link' => $link->id));
         $operations['delete'] = array('title' => t('Delete'), 'route_name' => 'xmlsitemap_custom.delete', 'route_parameters' => array('link' => $link->id));
         $row['operations'] = array('data' => array('#type' => 'operations', '#theme' => 'links', '#links' => $operations, '#attributes' => array('class' => array('links', 'inline'))));
         $rows[] = $row;
     }
     // @todo Convert to tableselect
     $build['xmlsitemap_custom_table'] = array('#type' => 'tableselect', '#theme' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => $this->t('No custom links available. <a href="@custom_link">Add custom link</a>', array('@custom_link' => Url::fromRoute('xmlsitemap_custom.add', [], array('query' => $destination)))));
     $build['xmlsitemap_custom_pager'] = array('#theme' => 'pager');
     return $build;
 }
开发者ID:jeroenos,项目名称:jeroenos_d8.mypressonline.com,代码行数:37,代码来源:XmlSitemapCustomListController.php

示例9: horizontal_login_block

function horizontal_login_block($form)
{
    $form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
    $form['#id'] = 'horizontal-login-block';
    $form['#validate'] = user_login_default_validators();
    $form['#submit'][] = 'user_login_submit';
    $form['#prefix'] = '
	';
    $form['#suffix'] = '
	';
    $form['name'] = array('#type' => 'textfield', '#prefix' => '<div class="usericon">', '#suffix' => '</div>', '#maxlength' => USERNAME_MAX_LENGTH, '#size' => 15, '#required' => TRUE, '#default_value' => 'Username', '#attributes' => array('onblur' => "if (this.value == '') {this.value = 'Username';}", 'onfocus' => "if (this.value == 'Username') {this.value = '';}"));
    $form['pass'] = array('#type' => 'password', '#maxlength' => 60, '#size' => 15, '#required' => TRUE, '#prefix' => '<div class="passicon">', '#suffix' => '</div>');
    $form['actions'] = array('#type' => 'actions');
    $form['actions']['submit'] = array('#type' => 'submit', '#value' => '');
    /* 
    * We comment this because I don´t know how to render the links in a new line, so 
    * I do it from the login_bar function 
    * 
    * 
    	$attributes = array('class' => 'cboxElement');
    	$form['links'][] = array(
     	  '#type' => 'markup',
       	//'#markup' => l(t('Register'), 'user/register'));
       	'#markup' => l("<br/>".t('Register | '), 'colorbox/form/user_register_form',
    		array('attributes' => $attributes,
    		'query' => array('width' => '300', 'height' => 'auto'))));
    	$form['links'][] = array(
     	  	'#type' => 'markup',
    		'#markup' => l(t('Forgot Password'), 'colorbox/form/user_pass',
    			array('attributes' => $attributes,
    			'query' => array('width' => '300', 'height' => '150'))));
    */
    return $form;
}
开发者ID:raulcano,项目名称:mentiras,代码行数:34,代码来源:template.php

示例10: deleteSubmit

 /**
  * Submits the delete form.
  */
 public function deleteSubmit(array &$form, array &$form_state)
 {
     $form_state['redirect_route'] = new Url('path.delete', array('pid' => $form_state['values']['pid']));
     if ($this->getRequest()->query->has('destination')) {
         $form_state['redirect_route']->setOption('query', drupal_get_destination());
         $this->getRequest()->query->remove('destination');
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:11,代码来源:EditForm.php

示例11: _scratchy_forum_display

function _scratchy_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page)
{
    global $user;
    // forum list, topics list, topic browser and 'add new topic' link
    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
    $title = $vocabulary->name;
    // Breadcrumb navigation:
    $breadcrumb = array();
    if ($tid) {
        $breadcrumb[] = array('path' => 'forum', 'title' => $title);
    }
    if ($parents) {
        $parents = array_reverse($parents);
        foreach ($parents as $p) {
            if ($p->tid == $tid) {
                $title = $p->name;
            } else {
                $breadcrumb[] = array('path' => 'forum/' . $p->tid, 'title' => $p->name);
            }
        }
    }
    drupal_set_title(check_plain($title));
    $breadcrumb[] = array('path' => $_GET['q']);
    menu_set_location($breadcrumb);
    if (count($forums) || count($parents)) {
        $output = '<div class="node">
  <div class="boxtop"><div class="bc ctr"></div><div class="bc ctl"></div></div>
  <div class="boxcontent">
    <div class="subboxcontent"><div class="content"><div id="forum"><ul style="margin-top:0">';
        if (user_access('create forum topics')) {
            $output .= '<li>' . l(t('Post new forum topic.'), "node/add/forum/{$tid}") . '</li>';
        } else {
            if ($user->uid) {
                $output .= '<li>' . t('You are not allowed to post a new forum topic.') . '</li>';
            } else {
                $output .= '<li>' . t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) . '</li>';
            }
        }
        $output .= '</ul>';
        $output .= theme('forum_list', $forums, $parents, $tid);
        if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
            $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
            drupal_add_feed(url('taxonomy/term/' . $tid . '/0/feed'), 'RSS - ' . $title);
        }
        $output .= '</div></div></div>
  </div>
  <div class="boxbtm">
    <div class="bc cbr"></div>
    <div class="bc cbl"></div>
  </div>
</div>';
    } else {
        drupal_set_title(t('No forums defined'));
        $output = '';
    }
    return $output;
}
开发者ID:edchacon,项目名称:scratchpads,代码行数:57,代码来源:scratchy-forum.inc.php

示例12: storePublication

 /**
  * Private method to store the required publication info to get it back later
  * when returning from Facebook authorization
  *
  * @param $publication
  *   The publication array
  * @param $destination
  *   The URI the user will be redirected after the publication
  */
 public function storePublication($publication, $destination = NULL)
 {
     $_SESSION['fb_autopost_authorization_required'] = array('publication' => $publication, 'target' => 'me');
     if ($destination) {
         $_SESSION['fb_autopost_authorization_required']['destination'] = $destination;
     } else {
         $_SESSION['fb_autopost_authorization_required'] += drupal_get_destination();
     }
 }
开发者ID:AlexandrTerekhin,项目名称:mysite,代码行数:18,代码来源:FBSession.php

示例13: renderLink

 /**
  * Prepares the link for deleting the comment.
  *
  * @param \Drupal\Core\Entity\EntityInterface $data
  *   The comment entity.
  * @param \Drupal\views\ResultRow $values
  *   The values retrieved from a single row of a view's query result.
  *
  * @return string
  *   Returns a string for the link text.
  */
 protected function renderLink($data, ResultRow $values)
 {
     $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete');
     $comment = $this->getEntity($values);
     $this->options['alter']['make_link'] = TRUE;
     $this->options['alter']['url'] = $comment->urlInfo('delete-form');
     $this->options['alter']['query'] = drupal_get_destination();
     return $text;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:20,代码来源:LinkDelete.php

示例14: deleteSubmit

 /**
  * Submits the delete form.
  */
 public function deleteSubmit(array &$form, FormStateInterface $form_state)
 {
     $url = new Url('path.delete', array('pid' => $form_state['values']['pid']));
     if ($this->getRequest()->query->has('destination')) {
         $url->setOption('query', drupal_get_destination());
         $this->getRequest()->query->remove('destination');
     }
     $form_state->setRedirectUrl($url);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:EditForm.php

示例15: renderLink

 /**
  * {@inheritdoc}
  */
 protected function renderLink(EntityInterface $entity, ResultRow $values)
 {
     if ($entity && $entity->access('update')) {
         $this->options['alter']['make_link'] = TRUE;
         $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit');
         $this->options['alter']['url'] = $entity->urlInfo('edit-form', ['query' => ['destination' => drupal_get_destination()]]);
         return $text;
     }
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:12,代码来源:LinkEdit.php


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