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


PHP ViewExecutable::getTitle方法代码示例

本文整理汇总了PHP中Drupal\views\ViewExecutable::getTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewExecutable::getTitle方法的具体用法?PHP ViewExecutable::getTitle怎么用?PHP ViewExecutable::getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\views\ViewExecutable的用法示例。


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

示例1: buildConfigurationForm

 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildConfigurationForm($form, $form_state);
     // Set the default label to '' so the views internal title is used.
     $form['label']['#default_value'] = '';
     $form['label']['#access'] = FALSE;
     // Unset the machine_name provided by BlockForm.
     unset($form['id']['#machine_name']['source']);
     // Prevent users from changing the auto-generated block machine_name.
     $form['id']['#access'] = FALSE;
     $form['#pre_render'][] = '\\Drupal\\views\\Plugin\\views\\PluginBase::preRenderAddFieldsetMarkup';
     // Allow to override the label on the actual page.
     $form['views_label_checkbox'] = array('#type' => 'checkbox', '#title' => $this->t('Override title'), '#default_value' => !empty($this->configuration['views_label']));
     $form['views_label_fieldset'] = array('#type' => 'fieldset', '#states' => array('visible' => array(array(':input[name="settings[views_label_checkbox]"]' => array('checked' => TRUE)))));
     $form['views_label'] = array('#title' => $this->t('Title'), '#type' => 'textfield', '#default_value' => $this->configuration['views_label'] ?: $this->view->getTitle(), '#states' => array('visible' => array(array(':input[name="settings[views_label_checkbox]"]' => array('checked' => TRUE)))), '#fieldset' => 'views_label_fieldset');
     if ($this->view->storage->access('edit') && \Drupal::moduleHandler()->moduleExists('views_ui')) {
         $form['views_label']['#description'] = $this->t('Changing the title here means it cannot be dynamically altered anymore. (Try changing it directly in <a href="@url">@name</a>.)', array('@url' => \Drupal::url('entity.view.edit_display_form', array('view' => $this->view->storage->id(), 'display_id' => $this->displayID)), '@name' => $this->view->storage->label()));
     } else {
         $form['views_label']['#description'] = $this->t('Changing the title here means it cannot be dynamically altered anymore.');
     }
     return $form;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:25,代码来源:ViewsBlockBase.php

示例2: attachTo

 /**
  * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::attachTo().
  */
 public function attachTo(ViewExecutable $clone, $display_id)
 {
     $displays = $this->getOption('displays');
     if (empty($displays[$display_id])) {
         return;
     }
     // Defer to the feed style; it may put in meta information, and/or
     // attach a feed icon.
     $clone->setDisplay($this->display['id']);
     $clone->buildTitle();
     if ($plugin = $clone->display_handler->getPlugin('style')) {
         $plugin->attachTo($display_id, $this->getPath(), $clone->getTitle());
     }
     // Clean up.
     $clone->destroy();
     unset($clone);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:20,代码来源:Feed.php

示例3: renderPreview


//.........这里部分代码省略.........
         if ($show_additional_queries) {
             $this->startQueryCapture();
         }
         // Execute/get the view preview.
         $preview = $this->executable->preview($display_id, $args);
         $preview = drupal_render($preview);
         if ($show_additional_queries) {
             $this->endQueryCapture();
         }
         $this->render_time = Timer::stop('entity.view.preview_form');
         views_ui_contextual_links_suppress_pop();
         // Reset variables.
         unset($this->override_path);
         _current_path($original_path);
         // Prepare the query information and statistics to show either above or
         // below the view preview.
         if ($show_info || $show_query || $show_stats) {
             // Get information from the preview for display.
             if (!empty($this->executable->build_info['query'])) {
                 if ($show_query) {
                     $query_string = $this->executable->build_info['query'];
                     // Only the sql default class has a method getArguments.
                     $quoted = array();
                     if ($this->executable->query instanceof Sql) {
                         $quoted = $query_string->getArguments();
                         $connection = Database::getConnection();
                         foreach ($quoted as $key => $val) {
                             if (is_array($val)) {
                                 $quoted[$key] = implode(', ', array_map(array($connection, 'quote'), $val));
                             } else {
                                 $quoted[$key] = $connection->quote($val);
                             }
                         }
                     }
                     $rows['query'][] = array(array('data' => array('#type' => 'inline_template', '#template' => "<strong>{% trans 'Query' %}</strong>")), array('data' => array('#type' => 'inline_template', '#template' => '<pre>{{ query }}</pre>', '#context' => array('query' => strtr($query_string, $quoted)))));
                     if (!empty($this->additionalQueries)) {
                         $queries = '<strong>' . t('These queries were run during view rendering:') . '</strong>';
                         foreach ($this->additionalQueries as $query) {
                             if ($queries) {
                                 $queries .= "\n";
                             }
                             $query_string = strtr($query['query'], $query['args']);
                             $queries .= t('[@time ms] @query', array('@time' => round($query['time'] * 100000, 1) / 100000.0, '@query' => $query_string));
                         }
                         $rows['query'][] = array(array('data' => array('#type' => 'inline_template', '#template' => "<strong>{% trans 'Other queries' %}</strong>")), SafeMarkup::set('<pre>' . $queries . '</pre>'));
                     }
                 }
                 if ($show_info) {
                     $rows['query'][] = array(array('data' => array('#type' => 'inline_template', '#template' => "<strong>{% trans 'Title' %}</strong>")), Xss::filterAdmin($this->executable->getTitle()));
                     if (isset($path)) {
                         $path = _l($path, $path);
                     } else {
                         $path = t('This display has no path.');
                     }
                     $rows['query'][] = array(SafeMarkup::set('<strong>' . t('Path') . '</strong>'), $path);
                 }
                 if ($show_stats) {
                     $rows['statistics'][] = array('<strong>' . t('Query build time') . '</strong>', t('@time ms', array('@time' => intval($this->executable->build_time * 100000) / 100)));
                     $rows['statistics'][] = array('<strong>' . t('Query execute time') . '</strong>', t('@time ms', array('@time' => intval($this->executable->execute_time * 100000) / 100)));
                     $rows['statistics'][] = array('<strong>' . t('View render time') . '</strong>', t('@time ms', array('@time' => intval($this->executable->render_time * 100000) / 100)));
                 }
                 \Drupal::moduleHandler()->alter('views_preview_info', $rows, $this->executable);
             } else {
                 // No query was run. Display that information in place of either the
                 // query or the performance statistics, whichever comes first.
                 if ($combined || $show_location === 'above') {
                     $rows['query'] = array(array(SafeMarkup::set('<strong>' . t('Query') . '</strong>'), t('No query was run')));
                 } else {
                     $rows['statistics'] = array(array(SafeMarkup::set('<strong>' . t('Query') . '</strong>'), t('No query was run')));
                 }
             }
         }
     } else {
         foreach ($errors as $display_errors) {
             foreach ($display_errors as $error) {
                 drupal_set_message($error, 'error');
             }
         }
         $preview = t('Unable to preview due to validation errors.');
     }
     // Assemble the preview, the query info, and the query statistics in the
     // requested order.
     $table = array('#type' => 'table', '#prefix' => '<div class="views-query-info">', '#suffix' => '</div>');
     if ($show_location === 'above' || $show_location === 'below') {
         if ($combined) {
             $table['#rows'] = array_merge($rows['query'], $rows['statistics']);
         } else {
             $table['#rows'] = $rows['query'];
         }
     } elseif ($show_stats === 'above' || $show_stats === 'below') {
         $table['#rows'] = $rows['statistics'];
     }
     if ($show_location === 'above' || $show_stats === 'above') {
         $output .= drupal_render($table) . $preview;
     } elseif ($show_location === 'below' || $show_stats === 'below') {
         $output .= $preview . drupal_render($table);
     }
     _current_path($old_q);
     return $output;
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:101,代码来源:ViewUI.php

示例4: attachTo

 /**
  * {@inheritdoc}
  */
 public function attachTo(ViewExecutable $clone, $display_id, array &$build)
 {
     $displays = $this->getOption('displays');
     if (empty($displays[$display_id])) {
         return;
     }
     // Defer to the feed style; it may put in meta information, and/or
     // attach a feed icon.
     $clone->setArguments($this->view->args);
     $clone->setDisplay($this->display['id']);
     $clone->buildTitle();
     if ($plugin = $clone->display_handler->getPlugin('style')) {
         $plugin->attachTo($build, $display_id, $clone->getUrl(), $clone->getTitle());
         foreach ($clone->feedIcons as $feed_icon) {
             $this->view->feedIcons[] = $feed_icon;
         }
     }
     // Clean up.
     $clone->destroy();
     unset($clone);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:24,代码来源:Feed.php


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