localgovdrupal / localgov_services

Provides the pages and navigation for presenting the Services provided by Local Government. A part of the LocalGovDrupal distribution.
GNU General Public License v2.0
3 stars 4 forks source link

Need a views filter to get all pages linked to a service landing page (add additionally sub landing page) #145

Closed andybroomfield closed 2 years ago

andybroomfield commented 2 years ago

See localgovdrupal/localgov_services#146

Whilst the issue I think belongs to localgov_workflows, it feels like the filter itself would be better provided by the localgov_services module.

BHCC has a custom filter provided by the custom bhcc_admin module.

  /**
   * {@inheritdoc}
   */
  public function query() {
    $this->ensureMyTable();
    $this->query->addField('node__field_service', 'field_service_target_id');
    if ($this->value[0] == -1) {
      $this->query->addWhere(0, 'node__field_service.field_service_target_id', NULL, 'IS NULL');
    } else {
      $this->query->addWhere(0, 'node__field_service.field_service_target_id', $this->value, 'IN');
    }
  }

This worked becuase all pages needed to have a service hub stored on them. But now service pages just store the parent, so now we need to adapt this to find all the sub landing pages and add those to this query.

finnlewis commented 2 years ago

Touched on this in Merge Monday call.

@ekes pointed out last week that the parent service is stored in the path alias of a service page and service sub-landing page, so we could created a views filter the allowed us to filter on the service, which is just the first part of the path alias.

This could keep it relatively simple for now.