Mercurial > hg > isophonics-drupal-site
comparison core/modules/views/src/Plugin/Block/ViewsBlockBase.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\views\Plugin\Block; | 3 namespace Drupal\views\Plugin\Block; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\Core\Access\AccessResult; | 6 use Drupal\Core\Access\AccessResult; |
6 use Drupal\Core\Block\BlockBase; | 7 use Drupal\Core\Block\BlockBase; |
7 use Drupal\Core\Form\FormStateInterface; | 8 use Drupal\Core\Form\FormStateInterface; |
8 use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | 9 use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
9 use Drupal\views\ViewExecutableFactory; | 10 use Drupal\views\ViewExecutableFactory; |
107 | 108 |
108 /** | 109 /** |
109 * {@inheritdoc} | 110 * {@inheritdoc} |
110 */ | 111 */ |
111 public function getPreviewFallbackString() { | 112 public function getPreviewFallbackString() { |
112 return $this->t('Placeholder for the "@view" views block', ['@view' => $this->view->storage->label()]); | 113 return $this->t('"@view" views block', ['@view' => $this->view->storage->label()]); |
113 } | 114 } |
114 | 115 |
115 /** | 116 /** |
116 * {@inheritdoc} | 117 * {@inheritdoc} |
117 */ | 118 */ |
159 ], | 160 ], |
160 '#fieldset' => 'views_label_fieldset', | 161 '#fieldset' => 'views_label_fieldset', |
161 ]; | 162 ]; |
162 | 163 |
163 if ($this->view->storage->access('edit') && \Drupal::moduleHandler()->moduleExists('views_ui')) { | 164 if ($this->view->storage->access('edit') && \Drupal::moduleHandler()->moduleExists('views_ui')) { |
164 $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>.)', [':url' => \Drupal::url('entity.view.edit_display_form', ['view' => $this->view->storage->id(), 'display_id' => $this->displayID]), '@name' => $this->view->storage->label()]); | 165 $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>.)', [':url' => Url::fromRoute('entity.view.edit_display_form', ['view' => $this->view->storage->id(), 'display_id' => $this->displayID])->toString(), '@name' => $this->view->storage->label()]); |
165 } | 166 } |
166 else { | 167 else { |
167 $form['views_label']['#description'] = $this->t('Changing the title here means it cannot be dynamically altered anymore.'); | 168 $form['views_label']['#description'] = $this->t('Changing the title here means it cannot be dynamically altered anymore.'); |
168 } | 169 } |
169 | 170 |
211 $output['#view_display_plugin_id'] = $this->view->display_handler->getPluginId(); | 212 $output['#view_display_plugin_id'] = $this->view->display_handler->getPluginId(); |
212 views_add_contextual_links($output, $block_type, $this->displayID); | 213 views_add_contextual_links($output, $block_type, $this->displayID); |
213 } | 214 } |
214 } | 215 } |
215 | 216 |
217 /** | |
218 * Gets the view executable. | |
219 * | |
220 * @return \Drupal\views\ViewExecutable | |
221 * The view executable. | |
222 * | |
223 * @todo revisit after https://www.drupal.org/node/3027653. This method was | |
224 * added in https://www.drupal.org/node/3002608, but should not be | |
225 * necessary once block plugins can determine if they are being previewed. | |
226 */ | |
227 public function getViewExecutable() { | |
228 return $this->view; | |
229 } | |
230 | |
216 } | 231 } |