Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently, you can pass a country as an argument to a view, but you can't validate it. I'm actually not that concerned with "validation", but the nice thing about validating is that you can also set the view title to be the name of the country, rather than something more arcane like the iso2 code.
This patch provides that basic validator.
Comment | File | Size | Author |
---|---|---|---|
#5 | countries-2188171-3.patch | 2.07 KB | webflo |
#2 | countries-2188171-2.patch | 2.76 KB | Dane Powell |
countries-validator.patch | 2.31 KB | Dane Powell | |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedAny reason for this? i.e. parent::init() would be called without this anyways.
And this can be a tiny bit less verbose, and for i18n, country_property() is probably better (Defaults to the sanitized name property).
Comment #2
Dane Powell CreditAttribution: Dane Powell commentedThanks for the tips. I'd never created a validator or integrated with Countries before, hence the "verbose" code :)
Here's an update.
Comment #3
Alan D. CreditAttribution: Alan D. commentedLooks rtbtc to me, I just need to find the time to actually test the code. Hopefully I'll get back in and clean up the queues again in the next month and so, where this should make it's way into the module!
Comment #4
webflo CreditAttribution: webflo commentedThe validation plugin should only valide. The conversion from iso2 code to name (or other properties) is done in
views_handler_argument_countries_country
.Comment #5
webflo CreditAttribution: webflo commented