1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace Drupal\dr8_zth;
- use Drupal\views\EntityViewsData;
- /**
- * Provides the views data for the blog entity type.
- */
- class BlogViewsData extends EntityViewsData {
- /**
- * {@inheritdoc}
- */
- public function getViewsData() {
- $data = parent::getViewsData();
- $data['blog_field_data']['table']['base']['help'] = $this->t('Blog items.');
- $data['blog_field_data']['table']['base']['access query tag'] = 'blog_access';
- $data['blog_field_data']['uid']['argument']['id'] = 'user_uid';
- $data['blog_field_data']['uid']['argument'] += [
- 'name table' => 'blog_field_data',
- 'name field' => 'name',
- 'empty field name' => \Drupal::config('user.settings')->get('anonymous'),
- ];
- $data['blog_field_data']['uid']['filter']['id'] = 'user_name';
- $data['blog_field_data']['uid']['filter']['title'] = $this->t('Author name (autocomplete)');
- $data['blog_field_data']['uid']['filter']['help'] = $this->t('The name of the blog author name. Uses an autocomplete widget to find a user name, the actual filter uses the resulting user ID.');
- $data['blog_field_data']['blog_id_raw'] = array(
- 'help' => $this->t('The raw numeric blog ID.'),
- 'real field' => 'blog_id',
- 'filter' => array(
- 'title' => $this->t('The blog ID'),
- 'id' => 'numeric',
- ),
- );
- $data['users']['uid_current'] = array(
- 'real field' => 'uid',
- 'title' => $this->t('Current'),
- 'help' => $this->t('Filter the view to the currently logged in user.'),
- 'filter' => array(
- 'id' => 'user_current',
- 'type' => 'yes-no',
- ),
- );
- $data['blog_field_data']['langcode']['help'] = $this->t('Original language of the blog entity');
- $data['blog_field_data']['langcode']['help'] = $this->t('Language of the translation of the blog entity');
- return $data;
- }
- }
|