Comments

bellesmanieres’s picture

StatusFileSize
new5.64 KB

Patch attached, the views_add_contextual_links() function will need a bit of rework after decorator as made it in, just keep it there as reminder.

ACF’s picture

dawehner’s picture

I'm confused does the contextual links actually work for you on a clean d8 without your patch?

damiankloip’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1758624-move_contextual_locations-2.patch, failed testing.

dawehner’s picture

Title: Move contextual_links_region out of annotations. » Move contextual_links_locations out of annotations.

Update title so people can find it

aspilicious’s picture

Title: Move contextual_links_locations out of annotations. » Move contextual_links_region out of annotations.
-    if (!isset($plugin['contextual_links_locations'])) {
-      $plugin['contextual_links_locations'] = array('view');
-    }
-    elseif ($plugin['contextual_links_locations'] = array() || $plugin['contextual_links_locations'] == array('')) {
-      $plugin['contextual_links_locations'] = array();
-    }
-    else {
-      $plugin += array('contextual_links_locations' => array('view'));
-    }

How can the last else test work?

If the first if test doesn't pass we now $plugin['contextual_links_locations'] is set. So when we enter the last else, we are trying to overwrite the 'contextual_links_locations' with 'view' what isn't going to happen. See http://stackoverflow.com/questions/2811798/php-adding-arrays-together

If we want to append view we should do: $plugin['contextual_links_locations'][] = 'view';

I'll look at this issue when this question is answered.

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new6.3 KB

This can't be reviewed properly due to a core bug. Attaching patch for now. So people can review the approach.

Status: Needs review » Needs work

The last submitted patch, contextual_links.patch, failed testing.

damiankloip’s picture

I know we can't test yet, but noticed these things....

+++ b/views.moduleundefined
@@ -910,26 +910,35 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
+    $contextual_links_locations = $plugin->contextualLinksLocations();
+
+    // If contextual_links_locations are not set, provide a sane default.
+    if (!isset($contextual_links_locations)) {
+      $contextual_links_locations = array('view');
     }

Shouldn't this set this property on the plugin?

+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -175,6 +190,24 @@ abstract class DisplayPluginBase extends PluginBase {
+  public function usesContextualLinks() {
+    return $this->usesAJAX;
+  }

Is this what you meant to return? :)

+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.phpundefined
@@ -1174,7 +1207,7 @@ abstract class DisplayPluginBase extends PluginBase {
+    if ($this->$usesContextualLinks) {

huh?

+++ b/views.moduleundefined
@@ -910,26 +910,35 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
+    if (!$plugin->usesContextualLinks())

{} ?

+++ b/views.moduleundefined
@@ -910,26 +910,35 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
+    if (!isset($plugin_data['contextual links']))

same here

aspilicious’s picture

Shouldn't this set this property on the plugin?

Thats what I did? (display plugin base)
And no it shouldn't rly set the added stuff. Happens at runtime.

Is this what you meant to return? :)

Copy paste error

huh?
{} ?

Thats the nasty part. There are 3 things:

1) 1 property that defines if this display plugin can have contextual links "usesContextualLinks"

2) 1 property that defines the locations: "contextualLinksLocation"

3) 1 system that allows modules to inject contextual links. Views UI has such an example

/**
 * Implements hook_views_plugins_alter().
 */
function views_ui_views_plugins_alter(&$plugins) {
  // @todo This currently does not work, investigate annotation alters.
  // Attach contextual links to each display plugin. The links will point to
  // paths underneath "admin/structure/views/view/{$view->name}" (i.e., paths
  // for editing and performing other contextual actions on the view).
  foreach ($plugins['display'] as &$display) {
    $display['contextual links']['views_ui'] = array(
      'parent path' => 'admin/structure/views/view',
      'argument properties' => array('name'),
    );
  }
}
xjm’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.x-dev
Component: Code » views.module
dawehner’s picture

So especially point 3) of #11 seems to make this as closed (won't fix)

aspilicious’s picture

Status: Needs work » Closed (won't fix)

I agree

tim.plunkett’s picture

Status: Closed (won't fix) » Active
StatusFileSize
new1.71 KB

I'm reopening this. views_add_contextual_links() makes no sense.

dawehner’s picture

Status: Active » Reviewed & tested by the community

You american certainly have a total different definition of the "sense" :)

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Status: Reviewed & tested by the community » Needs work

I'd like to try and fix the @todos first, I was just making a note

wim leers’s picture

views_add_contextual_links() makes no sense.

+1, I think :)

Also note that the way contextual links are rendered in general (and thus also for Views' exceptional case) is being changed at #914382: Contextual links incompatible with render cache.

tim.plunkett’s picture

Status: Needs work » Needs review

#15: vdc-1758624-15.patch queued for re-testing.

tim.plunkett’s picture

Title: Move contextual_links_region out of annotations. » Move contextual_links_region out of annotations
Assigned: tim.plunkett » Unassigned
dawehner’s picture

Status: Needs review » Needs work

This certainly needs work.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Issue summary: View changes
Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for creating this issue to improve Drupal.

We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there hasn't been a follow up going to close out, but don't worry we can always re-open!

Thanks all