The API doc isn't formatted correctly for core, refers to advanced help, and hasn't been updated at all for the D8 API changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

I started by simply making it core-compatible. Next removing hooks that don't exist anymore, along with all references to them elsewhere.

[lorentz:views | Wed 11:41:43] $ grep -r "_views_plugins(" *
lib/Drupal/views/Plugin/views/access/AccessPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/argument_default/ArgumentDefaultPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/argument_validator/ArgumentValidatorPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/cache/CachePluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/pager/PagerPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/row/RowPluginBase.php: * @see hook_views_plugins()
lib/Drupal/views/Plugin/views/style/StylePluginBase.php: * @see hook_views_plugins()
views.api.php: * Plugins are registered by implementing hook_views_plugins() in your
views.api.php: * For examples please look at views_views_plugins() in
views.api.php:function hook_views_plugins() {
views.api.php: * @see hook_views_plugins()
views.module: * 'contextual_links_locations' properties in hook_views_plugins() and
views.module: *   also need to use hook_views_plugins() or hook_views_plugins_alter() to
views.module: * @see hook_views_plugins()
xjm’s picture

Status: Active » Needs review
FileSize
19.6 KB

Removing references to hook_views_plugins() also means updating the the generic plugin documentation. I'm mostly punting on that for now. Followup tasks:

  • Include more detailed documentation on what goes in annotations.
  • Potentially @ingroup views_plugin to all our goddamn plugin classes. :)
  • Move information about plugin options to the appropriate base classes.
  • Additional examples.

I'd like a review on this before I commit it since it involves several actual docs changes. The lines about the plugin options were just cut from the hook_views_plugins() docblock and moved up to the defgroup; I haven't proofread them. We can do that later when we move them to the right place.

xjm’s picture

Removing the old plugin options stuff as well; @timplunkett suggested that we should just rewrite it from scratch, so we can do that when we improve the plugin docs later.

xjm’s picture

Alright, #3 is committed.

xjm’s picture

Status: Needs review » Needs work

Working on the rest.

dawehner’s picture

Issue tags: +VDC

.

xjm’s picture

Status: Needs work » Needs review

I pushed updates to the the handler and plugin defgroups; I'd appreciate it if someone could review them.

I think there's still several more hook docblocks I need to check.

xjm’s picture

dawehner’s picture

+ * - Argument default
+ *   (extends Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase):

So what will happen if we have more then 80 signs for namespace + classname :)

From my perspective the hardest problem people have with writing views plugins is that they don't know
how to find existing examples, they google for it, but they don't stumble upon the one in views itself. I think
this should be made clear in the documentation here.

+ *   values for contextual filters (previously 'arguments'). This is useful

I guess it is safe in d8 to remove the previously reference?

I'm wondering whether it is useful to refer to possible contrib examples (like views xml backend) for a core api file.

xjm’s picture

Well, there's an @todo to add examples eventually, but maybe an explicit "Look in the lib/Drupal/views/Plugin/Views" folder would help?

Re: 80 characters, when the line contains only something that can't be broken onto multiple lines, it's the only time it's okay to go over 80 characters.

I'll remove the stale references.

xjm’s picture

Started pulling on the spaghetti that is hook_views_data() this morning. hook_views_data() and hook_views_data_alter()

  • are ONLY invoked from funky little helper _views_fetch_data_build() in cache.inc
  • which is ONLY called from _views_fetch_data()
  • which is wrapped by views_fetch_data()
  • which is a procedural function, but is called in ViewExecutable::initQuery() and any number of base plugins and handlers, as well as used for the admin UI.
xjm’s picture

Status: Needs review » Fixed

Alright, views.api.php is all cleaned up now. It still eventually needs more documentation for plugins and on the hook execution order, but as far as I know everything is now correct for D8.

Edit: hook_views_data() might also need some work, but I will file followup issues.

xjm’s picture

Title: Start cleaning up views.api.php » Clean up views.api.php and update for D8

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