It'd be nice to completely hide the version filter and field on per-project issue views for projects that don't have any releases. For example:

http://drupal.org/project/issues/infrastructure

I think I found a way to do this via the version filter itself at run time. Just trying to get merlinofchaos's blessings that I'm not doing something horrible. ;)

Comments

dww’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

This seems to work just fine. Any objections?

merlinofchaos’s picture

Looks good to me!

dww’s picture

Whoops, except:

A) $this->get_value_options() always returns NULL. ;) I have to call that and then test $this->value_options itself.

B) This assumes the field key is 'version'. Probably safer to check for a field using the DB column "version" with {project_release_nodes} as the table.

dww’s picture

Status: Needs review » Fixed

Also added a test to make sure the field and filter are from the same relationship. Committed to HEAD. About to deploy on d.o. It's pretty cool how relatively easy this was to accomplish. Go views! ;)

dww’s picture

FYI: This needed a followup patch to fix a few problems:
http://drupal.org/cvs?commit=174206

#379626 by dww: Followup fixes to the version filter's new magic of
hiding itself and the version field for projects without releases:
- We can't actually test that the relationships match, since the
  filter does *not* use a relationship, but operates directly on
  {project_issues}.rid, while the version field uses the rid
  relationship to get to {project_release_nodes}.version.
- We can only iterate over the fields to try to disable the version
  while being rendered as an exposed filter.  Otherwise, you get
  errors while trying to configure the version filter.

Status: Fixed » Closed (fixed)

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