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.
Since the Countries module supports the Country Icons module, I am wondering how to add the country icon before the country name (within the Name column) to the the administrative table of countries at admin/config/regional/countries.
Maybe adding a new field of type Computed could be a start?
That would be a nice addition to the module. Thanks for giving hints.
Comment | File | Size | Author |
---|---|---|---|
#7 | countries_admin_views-view_code.txt | 8.7 KB | roball |
#11 | countries-admin_views-view_code.txt | 9.71 KB | roball |
#8 | Countries List (View).pdf | 180.66 KB | roball |
#3 | countries-view-system-override.txt | 6.8 KB | Alan D. |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedYou may be able to do this by overriding the system path with an admin display on that system path using View, VBO and Admin views.
Let me know how you get on!
However, trying to make things leaner, so unlikely to integrate this directly into the module.
Comment #2
roball CreditAttribution: roball commentedThanks for your suggestion.
I want to try to just add an additional field to the existing pre-defined ones (let's say the field called
field_countries_country_icon
). Is it possible to instruct the module to show that field in the table of countries?Comment #3
Alan D. CreditAttribution: Alan D. commentedNo just the core properties, see the readme for an example.
This is an example view that will override the admin listing. You will need the patch in #1225632: Integrate with VBO (allowing custom views and bulk update options) from the latest commit to provide operations to work with (view field operations needs to be edited post applying and a full cache flush), http://drupalcode.org/project/countries.git/patch/124ef0e, or the listed patch in #6 that would provide both the view and operations in one hit.
Comment #4
roball CreditAttribution: roball commentedI have applied the patch http://drupalcode.org/project/countries.git/patch/124ef0, installed Views Bulk Operations (VBO) 7.x-3.1 and flushed all caches.
After pasting the view code https://drupal.org/files/countries-view-system-override.txt into admin/structure/views/import and hitting the [ Import ] button, the following error message is displayed:
Have you been able to successfully import that view?
Comment #5
roball CreditAttribution: roball commentedCorrecting status.
Comment #6
Alan D. CreditAttribution: Alan D. commentedYou need admin views too - https://drupal.org/project/admin_views
Comment #7
roball CreditAttribution: roball commentedThanks - after installing Administration Views the import of your above attached view code worked fine.
I have improved the view to look more similar than the module's orginal countries admin page, including sortable columns and links to each country edit page. If others want to try this as well, the views code to be imported is attached here.
The only thing I could not manage is creating a "delete" link to the deletable countries, such as Bonaire, Sint Eustatius and Saba (BQ).
EDIT: At comment #11 below I have attached a further more improved view code.
Comment #8
roball CreditAttribution: roball commentedFYI, I have now managed to do this. It looks really nice. The attached screen print shows how the complete views table looks. Thanks for your help.
Comment #10
Alan D. CreditAttribution: Alan D. commentedRobert, if you are still listening to this thread, can you let me know how you went about adding the icon to the view here: #2070267: Provide Country Flag views field handler..
Personally can not see an easy way without inserting some PHP somewhere ;)
Comment #11
roball CreditAttribution: roball commentedDear Alan, sure, I'm still subscribed to this issue, and you are right, there *is* some PHP involved in displaying the icons.
The icon is displayed as a Computed Field called
field_countries_country_icon
, with the following Computed Code:and the following Display Code:
Once you have defined this field, the countries view can be imported as the attached view code.
Hope this helped.
Comment #12
Alan D. CreditAttribution: Alan D. commentedThanks. I'll keep this one closed and work on better country flags integration in the other issue. :)