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.
Meta task list:
- #2659342: Convert .info into .info.yml file Assigned to: manasiv
- #2659354: Port permissions to Drupal 8 Assigned to: neha.gangwar
- #2659360: Add ip2_country context subscriber
- #2673832: Add country_check condition plugin
Comments
Comment #2
ashishdalviComment #3
ashishdalviComment #4
joshi.rohit100It seems like that in the enthusiasm of porting module, we are going in wrong directions. I haven't used this module but as per module page (and code), what i have understood is that it is used to show the block to those users which belongs to particular country and this country is determined by the users (request's) IP address. right ?
To determine the country by IP address, we are using another module (ip2country) so we don't need to worry about that. right ? Means by ip2country module, we will get the IP's country.
Now all we have to do is to show a block based on that country ?
Please correct me If I understood something wrong.
Comment #5
ashishdalviYes. @joshi.rohit100,
Your understanding about module functionality is correct. We have to display blocks country specific.
What will be the better approach to Migrate this module to D8? I am pretty new to D8 development. So Any help will be appreciated.
Thanks,
Ashish
Comment #6
joshi.rohit100Instead of migrating the whole D7 functionality as it is in D8, just create one simple condition plugin and that will do all the stuff.
Comment #7
joshi.rohit100i will try write the patch for same as I get the time.
Comment #8
joshi.rohit100Created issue for same #2673832: Add country_check condition plugin . Just override evaluate as per your need and add dependency for ip2country module. it Will do the rest.
Comment #9
naveenvalecha#4,
Well nice! #2673832: Add country_check condition plugin good start, have a concern regarding it.
The module also alters the admin/structure/block list by ip address,
For this do we need a new BlockCountryContext which would extend BlockConditionContextSubscriberBase for adding the context countryip to filter the result by country ?
or you have something else cool for it ?
Comment #10
joshi.rohit100Actually we don't need to do anything for that because in D7 altering (modifying) block list page means whether block will render or not. In D7, module simply sets the settings in form alter but that setting is not doing anything by itself. To make that settings work, block list is being altered and in D8 we don't need this. condition plugin does that for us.
Comment #11
naveenvalechacool! Well should we rely on the ipcountry module for the ip context or just provide/add our own context for the country based on ip ?
Comment #12
joshi.rohit100Anyhow, we have to rely on third party library to get country by IP. Now whether we use ip2country or other. I don't see the use to create own library for this.
Comment #13
naveenvalechacool! for the context provider it will be taken care into this https://www.drupal.org/node/2659360
Comment #14
naveenvalechaComment #15
naveenvalechaComment #16
naveenvalechaComment #17
MustangGB CreditAttribution: MustangGB commented