Problem/Motivation

Views in Drupal 7 had a very fancy way to load it's files, which contained hooks, so people expect to be able to implement
hooks like hook_views_data, hook_views_data_alter in .views.inc files.

A non complete list of issues, which had problems: #1833296: Unable to alter views data, #1828410: Provide a bulk_form element for actions

Proposed resolution

Add the different hooks.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new960 bytes

Additional to hook_views_data_alter the field module integration also has hook_field_views_data.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1834184-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#1: drupal-1834184-1.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, drupal-1834184-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#1: drupal-1834184-1.patch queued for re-testing.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense and patch is simple enough. RTBC.

berdir’s picture

Status: Reviewed & tested by the community » Needs review

Hm. Setting back to needs review.

Looks like we have implementations for all three hooks in core, Do they all work because they implement a defined hook in their .views.inc that is loaded? Sounds like we need some sort of test coverage here.

Also, the naming of hook_field_views_data_alter() and the *callback* {$field_module}_field_views_data_views_data_alter() executed within an implementation of the alter hook by field.module itself is *really* weird. Is there an issue to come up with something better? Do we actually need this? What exactly is the advantage of doing that as opposed to implement a normal alter hook combined with a helper function or so? Also not sure how it's related to this problem, would we also need to make sure that we load the views.inc file here?

dawehner’s picture

Looks like we have implementations for all three hooks in core, Do they all work because they implement a defined hook in their .views.inc that is loaded? Sounds like we need some sort of test coverage here.

As told in IRC they all currently sometimes work just because most implementations actually implements hook_views_data, which
forces the .views.inc to load.

Created a follow-up for the other point mentioned: #1843490: Consider to document/remove {$field_module}_field_views_data_views_data_alter()"

yesct’s picture

Status: Needs review » Reviewed & tested by the community

#1833296: Unable to alter views data is postponed and waiting on this issue.

perhaps since @dawehner opened the follow-up, this is back to rtbc now.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs tests

Actually I think we still need that test coverage.

tim.plunkett’s picture

Priority: Normal » Major
Issue tags: +Novice

This is blocking a major, so it is also major.

dawehner’s picture

StatusFileSize
new4.9 KB

What about a test like that?

berdir’s picture

Looks good to me, can we have a test-only patch? :)

Status: Needs review » Needs work
Issue tags: -Needs tests, -Novice, -VDC

The last submitted patch, drupal-1834184-12.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +Needs tests, +Novice, +VDC

#12: drupal-1834184-12.patch queued for re-testing.

dawehner’s picture

StatusFileSize
new1.64 KB

Sure!

Status: Needs review » Needs work
Issue tags: -Needs tests, -Novice, -VDC

The last submitted patch, drupal-1834184-15-tests.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review

#12: drupal-1834184-12.patch queued for re-testing.

dawehner’s picture

Issue tags: +Needs tests, +Novice, +VDC

#12: drupal-1834184-12.patch queued for re-testing.

berdir’s picture

Status: Needs review » Needs work

#12 does not apply anymore.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new4.94 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, drupal-1834184-21.patch, failed testing.

dawehner’s picture

StatusFileSize
new938 bytes
new4.68 KB

Fix the tests.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

.

Status: Needs review » Needs work

The last submitted patch, drupal-1834184-23.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new4.65 KB

urgs.

dawehner’s picture

StatusFileSize
new1.4 KB

and the missing interdiff.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

This looks good and has tests.

catch’s picture

Status: Reviewed & tested by the community » Fixed

The output of these two is cached so makes sense to put in an include. Committed/pushed to 8.x.

Automatically closed -- issue fixed for 2 weeks with no activity.