diff --git a/core/modules/comment/config/schema/comment.views.schema.yml b/core/modules/comment/config/schema/comment.views.schema.yml index f8783b1..be3816e1 100644 --- a/core/modules/comment/config/schema/comment.views.schema.yml +++ b/core/modules/comment/config/schema/comment.views.schema.yml @@ -8,37 +8,10 @@ views.field.comment_depth: type: views_field label: 'Comment depth' -views.field.comment_entity_link: - type: views_field - label: 'Comment link' - mapping: - teaser: - type: boolean - label: 'Show teaser-style link' - views.field.comment_last_timestamp: type: views.field.date label: 'Last comment date' -views.field.comment_link: - type: views_field - label: 'Comment link' - mapping: - text: - type: views_field - label: 'Text to display' - link_to_entity: - type: views_field - label: 'Link field to the entity if there is no comment' - -views.field.comment_link_approve: - type: views.field.comment_link - label: 'Comment approve link' - -views.field.comment_link_reply: - type: views.field.comment_link - label: 'Comment reply link' - views.field.node_new_comments: type: views.field.numeric label: 'Number of new comments' diff --git a/core/modules/comment/src/CommentViewsData.php b/core/modules/comment/src/CommentViewsData.php index c70f77f..3f134c8 100644 --- a/core/modules/comment/src/CommentViewsData.php +++ b/core/modules/comment/src/CommentViewsData.php @@ -102,22 +102,6 @@ public function getViewsData() { $data['comment_field_data']['status']['filter']['label'] = t('Approved comment status'); $data['comment_field_data']['status']['filter']['type'] = 'yes-no'; - $data['comment']['approve_comment'] = array( - 'field' => array( - 'title' => t('Link to approve comment'), - 'help' => t('Provide a simple link to approve the comment.'), - 'id' => 'comment_link_approve', - ), - ); - - $data['comment']['replyto_comment'] = array( - 'field' => array( - 'title' => t('Link to reply-to comment'), - 'help' => t('Provide a simple link to reply to the comment.'), - 'id' => 'comment_link_reply', - ), - ); - $data['comment_field_data']['thread']['field'] = array( 'title' => t('Depth'), 'help' => t('Display the depth of the comment if it is threaded.'), diff --git a/core/modules/comment/src/Plugin/views/field/Link.php b/core/modules/comment/src/Plugin/views/field/Link.php deleted file mode 100644 index c2fc23d..0000000 --- a/core/modules/comment/src/Plugin/views/field/Link.php +++ /dev/null @@ -1,139 +0,0 @@ -get('entity.manager') - ); - } - - /** - * Constructs a Link field plugin. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager service. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->entityManager = $entity_manager; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - $options['text'] = array('default' => ''); - $options['link_to_entity'] = array('default' => FALSE); - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - $form['text'] = array( - '#type' => 'textfield', - '#title' => t('Text to display'), - '#default_value' => $this->options['text'], - ); - $form['link_to_entity'] = array( - '#title' => $this->t('Link field to the entity if there is no comment'), - '#type' => 'checkbox', - '#default_value' => $this->options['link_to_entity'], - ); - parent::buildOptionsForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function query() {} - - /** - * {@inheritdoc} - */ - public function render(ResultRow $values) { - $comment = $this->getEntity($values); - return $this->renderLink($comment, $values); - } - - /** - * Prepares the link pointing to the comment or its node. - * - * @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('View'); - /** @var \Drupal\comment\CommentInterface $comment */ - $comment = $data; - $cid = $comment->id(); - - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['html'] = TRUE; - - if (!empty($cid)) { - $this->options['alter']['url'] = Url::fromRoute('entity.comment.canonical', ['comment' => $cid]); - $this->options['alter']['fragment'] = "comment-" . $cid; - } - // If there is no comment link to the node. - elseif ($this->options['link_to_node']) { - $entity = $comment->getCommentedEntity(); - $this->options['alter']['url'] = $entity->urlInfo(); - } - - return $text; - } - -} diff --git a/core/modules/comment/src/Plugin/views/field/LinkApprove.php b/core/modules/comment/src/Plugin/views/field/LinkApprove.php index 11e7812..f4dd931 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkApprove.php +++ b/core/modules/comment/src/Plugin/views/field/LinkApprove.php @@ -10,6 +10,7 @@ use Drupal\comment\CommentInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\views\Plugin\views\field\EntityLink; use Drupal\views\ResultRow; /** @@ -19,7 +20,7 @@ * * @ViewsField("comment_link_approve") */ -class LinkApprove extends Link { +class LinkApprove extends EntityLink { /** * {@inheritdoc} diff --git a/core/modules/comment/src/Plugin/views/field/LinkReply.php b/core/modules/comment/src/Plugin/views/field/LinkReply.php index 65c7545..d842678 100644 --- a/core/modules/comment/src/Plugin/views/field/LinkReply.php +++ b/core/modules/comment/src/Plugin/views/field/LinkReply.php @@ -9,6 +9,7 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\views\Plugin\views\field\EntityLink; use Drupal\views\ResultRow; /** @@ -18,7 +19,7 @@ * * @ViewsField("comment_link_reply") */ -class LinkReply extends Link { +class LinkReply extends EntityLink { /** * {@inheritdoc} diff --git a/core/modules/node/src/Plugin/views/field/Link.php b/core/modules/node/src/Plugin/views/field/Link.php deleted file mode 100644 index a0d7ba7..0000000 --- a/core/modules/node/src/Plugin/views/field/Link.php +++ /dev/null @@ -1,94 +0,0 @@ - ''); - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - $form['text'] = array( - '#type' => 'textfield', - '#title' => $this->t('Text to display'), - '#default_value' => $this->options['text'], - ); - parent::buildOptionsForm($form, $form_state); - - // The path is set by renderLink function so don't allow to set it. - $form['alter']['path'] = array('#access' => FALSE); - $form['alter']['external'] = array('#access' => FALSE); - } - - /** - * {@inheritdoc} - */ - public function query() { - $this->addAdditionalFields(); - } - - /** - * {@inheritdoc} - */ - public function render(ResultRow $values) { - if ($entity = $this->getEntity($values)) { - return $this->renderLink($entity, $values); - } - } - - /** - * Prepares the link to the node. - * - * @param \Drupal\Core\Entity\EntityInterface $node - * The node entity this field belongs to. - * @param ResultRow $values - * The values retrieved from the view's result set. - * - * @return string - * Returns a string for the link text. - */ - protected function renderLink($node, ResultRow $values) { - if ($node->access('view')) { - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['url'] = $node->urlInfo(); - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); - return $text; - } - } - -} diff --git a/core/modules/node/src/Plugin/views/field/LinkDelete.php b/core/modules/node/src/Plugin/views/field/LinkDelete.php deleted file mode 100644 index 6dad5e0..0000000 --- a/core/modules/node/src/Plugin/views/field/LinkDelete.php +++ /dev/null @@ -1,47 +0,0 @@ -access('delete')) { - return; - } - - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['url'] = $node->urlInfo('delete-form'); - $this->options['alter']['query'] = $this->getDestinationArray(); - - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Delete'); - return $text; - } - -} diff --git a/core/modules/node/src/Plugin/views/field/LinkEdit.php b/core/modules/node/src/Plugin/views/field/LinkEdit.php deleted file mode 100644 index 6d46642..0000000 --- a/core/modules/node/src/Plugin/views/field/LinkEdit.php +++ /dev/null @@ -1,48 +0,0 @@ -access('update')) { - return; - } - - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['url'] = $node->urlInfo('edit-form'); - $this->options['alter']['query'] = $this->getDestinationArray(); - - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); - return $text; - } - -} diff --git a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml index 40b226a..a4b6320 100644 --- a/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml +++ b/core/modules/taxonomy/config/schema/taxonomy.views.schema.yml @@ -83,14 +83,6 @@ views.argument_default.taxonomy_tid: type: string label: 'Multiple-value handling' -views.field.term_link_edit: - type: views_field - label: 'Taxonomy language' - mapping: - text: - type: label - label: 'Text to display' - views.field.term_name: type: views.field.field mapping: diff --git a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php b/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php deleted file mode 100644 index 10f0337..0000000 --- a/core/modules/taxonomy/src/Plugin/views/field/LinkEdit.php +++ /dev/null @@ -1,89 +0,0 @@ -additional_fields['tid'] = 'tid'; - $this->additional_fields['vid'] = 'vid'; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - - $options['text'] = array('default' => ''); - - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - $form['text'] = array( - '#type' => 'textfield', - '#title' => $this->t('Text to display'), - '#default_value' => $this->options['text'], - ); - parent::buildOptionsForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function query() { - $this->ensureMyTable(); - $this->addAdditionalFields(); - } - - /** - * {@inheritdoc} - */ - public function render(ResultRow $values) { - // Check there is an actual value, as on a relationship there may not be. - if ($tid = $this->getValue($values, 'tid')) { - // Mock a term object for taxonomy_term_access(). Use machine name and - // vid to ensure compatibility with vid based and machine name based - // access checks. See http://drupal.org/node/995156 - $term = entity_create('taxonomy_term', array( - 'vid' => $values->{$this->aliases['vid']}, - )); - if ($term->access('update')) { - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Edit'); - return \Drupal::l($text, new Url('entity.taxonomy.edit_form', ['taxonomy_term' => $tid], array('query' => $this->getDestinationArray()))); - } - } - } - -} diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php index aa1d0c0..104a33b 100644 --- a/core/modules/taxonomy/src/TermViewsData.php +++ b/core/modules/taxonomy/src/TermViewsData.php @@ -75,15 +75,6 @@ public function getViewsData() { unset($data['taxonomy_term_field_data']['vid']['argument']); unset($data['taxonomy_term_field_data']['vid']['sort']); - $data['taxonomy_term_data']['edit_term'] = array( - 'field' => array( - 'title' => t('Term edit link'), - 'help' => t('Provide a simple link to edit the term.'), - 'id' => 'term_link_edit', - 'click sortable' => FALSE, - ), - ); - $data['taxonomy_term_field_data']['name']['field']['id'] = 'term_name'; $data['taxonomy_term_field_data']['name']['argument']['many to one'] = TRUE; $data['taxonomy_term_field_data']['name']['argument']['empty field name'] = t('Uncategorized'); diff --git a/core/modules/user/config/schema/user.views.schema.yml b/core/modules/user/config/schema/user.views.schema.yml index 215bd41..7366f9c 100644 --- a/core/modules/user/config/schema/user.views.schema.yml +++ b/core/modules/user/config/schema/user.views.schema.yml @@ -75,14 +75,6 @@ views.field.user_link: type: text label: 'Text to display' -views.field.user_link_cancel: - type: views.field.user_link - label: 'User cancel link' - -views.field.user_link_edit: - type: views.field.user_link - label: 'User edit link' - views.field.user_permissions: type: views.field.prerender_list label: 'List of permission' diff --git a/core/modules/user/src/Plugin/views/field/Link.php b/core/modules/user/src/Plugin/views/field/Link.php deleted file mode 100644 index 78057cc..0000000 --- a/core/modules/user/src/Plugin/views/field/Link.php +++ /dev/null @@ -1,110 +0,0 @@ -additional_fields['uid'] = 'uid'; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - $options['text'] = array('default' => ''); - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - $form['text'] = array( - '#type' => 'textfield', - '#title' => $this->t('Text to display'), - '#default_value' => $this->options['text'], - ); - parent::buildOptionsForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function access(AccountInterface $account) { - return $account->hasPermission('administer users') || $account->hasPermission('access user profiles'); - } - - /** - * {@inheritdoc} - */ - public function query() { - $this->ensureMyTable(); - $this->addAdditionalFields(); - } - - /** - * {@inheritdoc} - */ - public function render(ResultRow $values) { - if ($entity = $this->getEntity($values)) { - return $this->renderLink($entity, $values); - } - } - - /** - * Alters the field to render a link. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * @param \Drupal\views\ResultRow $values - * The current row of the views result. - * - * @return string - * The actual rendered text (without the link) of this field. - */ - protected function renderLink(EntityInterface $entity, ResultRow $values) { - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('View'); - - $this->options['alter']['make_link'] = TRUE; - $this->options['alter']['url'] = $entity->urlInfo(); - - return $text; - } - -} diff --git a/core/modules/user/src/Plugin/views/field/LinkCancel.php b/core/modules/user/src/Plugin/views/field/LinkCancel.php deleted file mode 100644 index b29c426..0000000 --- a/core/modules/user/src/Plugin/views/field/LinkCancel.php +++ /dev/null @@ -1,38 +0,0 @@ -access('delete')) { - $this->options['alter']['make_link'] = TRUE; - - $text = !empty($this->options['text']) ? $this->options['text'] : $this->t('Cancel account'); - - $this->options['alter']['url'] = $entity->urlInfo('cancel-form'); - $this->options['alter']['query'] = $this->getDestinationArray(); - - return $text; - } - } - -} diff --git a/core/modules/user/src/UserViewsData.php b/core/modules/user/src/UserViewsData.php index a018e78..cc24f2e 100644 --- a/core/modules/user/src/UserViewsData.php +++ b/core/modules/user/src/UserViewsData.php @@ -94,15 +94,6 @@ public function getViewsData() { $data['users_field_data']['preferred_admin_langcode']['title'] = t('Preferred admin language'); $data['users_field_data']['preferred_admin_langcode']['help'] = t('Preferred administrative language of the user'); - $data['users']['view_user'] = array( - 'field' => array( - 'title' => t('Link to user'), - 'help' => t('Provide a simple link to the user.'), - 'id' => 'user_link', - 'click sortable' => FALSE, - ), - ); - $data['users_field_data']['created_fulldate'] = array( 'title' => t('Created date'), 'help' => t('Date in the form of CCYYMMDD.'), @@ -216,15 +207,6 @@ public function getViewsData() { ), ); - $data['users']['cancel_node'] = array( - 'field' => array( - 'title' => t('Link to cancel user'), - 'help' => t('Provide a simple link to cancel the user.'), - 'id' => 'user_link_cancel', - 'click sortable' => FALSE, - ), - ); - $data['users']['data'] = array( 'title' => t('Data'), 'help' => t('Provides access to the user data service.'),