Is the dev-team working on a port for D7?
Grtz.

CommentFileSizeAuthor
#16 taxonomy_icon.tar_.gz1.73 KBNiklas Fiekas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wjaspers’s picture

Shouldn't be necessary now that D7 includes CCK in core, which uses entity API.
As long as you have filefield or imagefield modules enabled, you should be able to easily add images to taxonomy terms.

NancyDru’s picture

That's what they say, but I suspect an easier UI is still desireable.

wjaspers’s picture

Please extrapolate...

NancyDru’s picture

Title: Port to D7 » Taxonomy Image for D7

There are a lot of people who don't want to go to several different pages to figure out how to do this. Nor is there currently any upgrade path from D6 (this module) to D7. People with hundreds of images are not going to be happy re-uploading them all.

joachim’s picture

You might want to consider going a similar route to what we're (planning on) doing with Image module: migrate to a FieldAPI imagefield, but still provide extras around that improve the initial setup or add features.

I wrote this for the image data migration http://drupal.org/project/field_convert -- should be able to handle taxonomy image migration too.

drupal a11y’s picture

subscribe

Subbo’s picture

subscribe

xmacinfo’s picture

Interesting discussion!

Upgrading to D7 should be as easy as installing D7.

There have been a lot of work to make D7 easy to install and use. The same type of care should be made to create nice and easy to use upgrade paths.

Using any migrate script or modules is not always easy and is error prone. I do understand that migration is often a better route from D5 to D7, but from D6 to D7 we should make everything easy.

Let's see what will come out of this. ;-)

That being said, I support NancyDru in her effort to create a D7 version of the Taxonomy Image module. An easy UI is desirable as well as an easy install/upgrade function or script from D6 to D7.

NancyDru’s picture

Thanks for your support.

Yes, upgrading from one version to another should be easy - for you, the adopter of the module. However, for me, the developer, it's a nightmare unraveling all the changes to core. In this case, Taxonomy no longer exists as it did in the past; one could now argue if it exists at all. Taxonomy is now just one more field (think CCK) in an endless list of fields. And there is a whole new API to learn, along with new jargon to describe it. And just to make it a bit more difficult, they've also switched code repositories.

xmacinfo’s picture

I am trying to emulate this module using D7 taxonomy and a an image field added to the terms.

Looks like the new fields (here an image field) are displaying only on the main taxonomy page (the list of all noded using the term).

I have not found a way to display the new field (here the image), inside a node, either in the body or in the teaser. The only thing that shows up is the regular taxonomy term.

So even using only D7 tools, I cannot emulate this module.

I guess we still need a scaled down version of this module to force the display of any (or selected) fields of a taxonomy term in the body or the teaser.

Is Taxonomy Module a good start or do we need to look for a new module that would essentially do the same?

wjaspers’s picture

@xmac, You need to change the formatter of the Taxonmy: Term Reference field on your node type, and you "should" be able to access the image. Otherwise, use views to pull it up.

xmacinfo’s picture

@wjaspers: It shows correctly on the formatter for the taxonomy page view.

But on a node there is no display formatter for a term.

I am looking for way to use print render() to print the taxonomy field (the image) directly on the node template. But I did not find out yet how.

vito_swat’s picture

Actually for taxonomy image main module it's only required to provide upgrade path to D7 image fields. What really need to be ported is the submodules. Showing images in block should be easy using views but for the Taxonomy Image Link Alter and Taxonomy Image Node Displayit is needed to provide some custom formatters for taxonomy and/or body fields.

carole’s picture

I added an image field to my taxonomy, it shows fine on the terms page, but like @xmacinfo, I can't display the image on the node, but more importantly, views. Any tips for a "rewrite results" override? I could do this (cumbersomely) by adding one boolean field each for the terms.

xmacinfo’s picture

@carole: I was able to output the raw field content on a node, in node.tpl.php, using this:

print render($node->taxonomy_vocabulary_1['und'][0]['taxonomy_term']->field_img_type_terme['und'][0]['filename']);

But I did not find any clean way to output the field on a node with the right format.

Niklas Fiekas’s picture

FileSize
1.73 KB

There is a sandbox project I created for a client. Code at drupalcode and github.

With it the workflow is:

(1) After enabling the module go to the "manage display" page of a content type that has a taxonomy term reference field.
(2) Select Icon as the format for that field.
(3) If not already there, an image field will be added to the vocabulary. You can go configure it.
(4) When adding or editing taxonomy terms, use that field to upload icons for the terms.

Then, when viewing the node and if an icon for the term exists, the icon will be shown instead of the name. I realize there might be some usability issues, but I like the fielded approach on a technical level. Maybe taxonomy_image for Drupal 7 could take a similar approach.

xmacinfo’s picture

@Niklas Fiekas: This is clever, although I did not try it yet. I hope that some of this can be used for Taxonomy Image for D7 as well.

carole’s picture

@Niklas Fiekas: Thanks, it worked!

Is there any concern about running this in production? When should it become a full project?

BTW I had a field "Icon" in the taxonomy, and your module created another field (taxonomy_icon).

Niklas Fiekas’s picture

@carole:
Very good, thanks for testing. I think it should be fine for production - only functionality is limited. I am using it for a site that will go live soon.

BTW I had a field "Icon" in the taxonomy, and your module created another field (taxonomy_icon).

Yes, that is intentional - but one could argue about that or make it configurable.

When should it become a full project?

Depends. If this module (Taxonomy Image) will go the "fielded direction" with it's port, I think Taxonomy Icon is not needed any longer. Better collaborate on this existing project. Thats the only problem with using it in production: it might be replaced.
Otherwise: ASAP. In this case I'd be happy to have a co-maintainer.

NancyDru’s picture

Niklas, I'd love to have a 7.x version of TI, which would have to be field-oriented. To do that we need an upgrade path and the sub-modules converted. It sounds like you are pretty close on the core module with yours. I'd be happy to have you collaborate on TI.

Niklas Fiekas’s picture

Yes, Taxonomy Icon almost only adds a UI to things core is able to do. The only real functionality is a new "Icon" formatter for taxonomy term references.

Since I have only superficial knowledge about the Taxonomy Image internals at this time, I'll go through it and note what I think.

taxonomy_image.install

hook_requirements()
Checks support for GD. Core does that now - and is able to use other toolkits than gd.

taxonomy_image_schema()
Defines tables. Core will now handle storage of fields.

taxonomy_image_update_N()
Upgrade path will go here.

taxonomy_image_install()
Maybe create a field here?

taxonomy_image_uninstall()
Undo what install does.

taxonomy_image.views.inc

views_handler_field_taxonomy_image.inc

Fields work out of the box with views.

taxonomy_image.module

taxonomy_image_display()
Would work different, but of course a display handler must be there.

taxonomy_image_resize()
Image fields have there own rezising.

taxonomy_image_parse_tags()
taxonomy_image_tt()
taxonomy_image_get_url()
taxonomy_image_get_object()

taxonomy_image_perm()

  • access taxonomy images: why not keep this
  • administer taxonomy images: I didn't see all the things that the admin can configure, yet. But at least disabling/enabling taxonomy image for specific vocabularies is now administer content types or so. I don't know how that affects upgrading.
  • can disable taxonomy images: keep it

taxonomy_image_help()
Rewrite.

taxonomy_image_menu()

  • admin/content/taxonomy/taxonomy_image: Might be dropped
  • admin/settings/taxonomy_image: I don't know all the settings yet. Might or might not be dropped.
  • admin/settings/taxonomy_image/general: Same as admin/settings/taxonomy_image

taxonomy_image_user()
Keep it to allow users with the can disable taxonomy images permission to do so.

_taxonomy_image_presets()
Not needed anymore.

taxonomy_image_file_download()
Image fields will provide this functionality.

taxonomy_image_admin()
taxonomy_image_get_term()
taxonomy_image_form_alter()
_taxonomy_image_validate_external()
taxonomy_image_taxonomy()
taxonomy_image_add()
taxonomy_image_delete()
_taxonomy_image_exists()
taxonomy_image_flush_caches()

taxonomy_image_views_api()
taxonomy_image_views_handlers()
Might be dropped.

taxonomy_image.admin.inc

taxonomy_image_admin_form()

  • $form['general']['taxonomy_image_path']: Image module will deal with this
  • $form['general']['taxonomy_image_disable']: Would stay
  • $form['general']['taxonomy_image_link_title']: You can configure alt and title of image fields
  • $form['general']['taxonomy_image_default']: Image fields allow you to configure this
  • $form['general']['taxonomy_image_verbose_delete']: Likely to be dropped
  • $form['resizing']: Image fields will handle this
  • $form['advanced']: Not sure.

taxonomy_image_overview()

contributed/taxonomy_image_link_alter

Not sure if this is needed any longer.

contributed/taxonomy_image_node_display

Not needed any longer.

contributed/taxonomy_image_blocks

Might be ported, but there are other modules that can display taxonomy in blocks.

contributed/taxonomy_image_attach

There are no image nodes anymore.

 

Ok - done with what's partially comments, partially just notes to myself while going through the module. I think I'll contribute some patches. Once I am more into Taxonomy Image internals I might also apply for co-maintainership.
Maybe create a 7.x-1.x branch.

Niklas Fiekas’s picture

Now that I spent some time with the module, I think that the core maintainers are basically right: What Taxonomy Image does in D6 is as easy as adding an "Image Field" to a vocabulary in D7.
A Drupal 7 version of Taxonomy Image would, above all, have the upgrade path to image fields.

Then - that there'd be no functionality for the D7 core of Taxonomy Image, I would then move the D6 Contrib modules into core for the D7 version (maybe not the taxonomy_image_blocks module). I'd like to see what others think about that.

NancyDru, I might be wrong. What features could the core of D7 Taxonomy Image have?

NancyDru’s picture

I would like it to at least do the job of adding the image fields for those who just don't know how. Apparently you know how to do that in your version. Other than that, perhaps the other modules remain as only additional features if one wants them.

When I started working on this module there were lots of people who had to go and change mostly theme code to get various things working. I really hate seeing people have to do things like that, so that's how the sub-modules were born. I'd rather see those use cases handled by a few admin clicks than theme mods. So anything that still has to be done through other modifications is a candidate for a feature sub-module.

I really appreciate all you've done on this, Niklas. There's real promise of an even better solution than there has been in the past.

Niklas Fiekas’s picture

Thanks. I just noticed you granted me GIT access. I created an experimental 7.x-1.x branch, where development of the D7 version could go.

NancyDru’s picture

Priority: Major » Normal

Great. Thanks.

Niklas Fiekas’s picture

Status: Active » Needs review

I started working on this a little and pushed some commits: http://drupalcode.org/project/taxonomy_image.git?a=search&h=refs%2Fheads...
Always appreciate reviews, if someone has time. Note that it is work in progress.

(Be warned that migration from 6.x to HEAD will currently drop the data. It's far from beeing complete - dev only.)

joachim’s picture

For the upgrade path, I suggest using http://drupal.org/project/field_convert -- it takes care of migrating data from custom tables to FieldAPI fields.

NancyDru’s picture

Thanks for the suggestion. Is Field_Convert largely a one-time use and then disable it type module?

joachim’s picture

> Is Field_Convert largely a one-time use and then disable it type module?

Yup.
The way it works is you write a conversion plan that lives in your module, defined by a hook and kept in a .inc file that only gets included by field_convert.

There's an example in the D7 branch of http://drupal.org/project/image to convert D6 image nodes to nodes with an image field. The conversion adds the image field to the image node type and then migrates the table from custom table to the field for each node.

Scyther’s picture

I think most of the functionality of Taxonomy Image can be found in core in D7. Thinks like node display, can be achieve with help by other modules, Views for example.

The big problem as I see it, is how to achieve a upgrade from D6 to D7. But Field_Convert looks like a good module to use for that.

Niklas Fiekas’s picture

Status: Needs review » Active
WilliamV’s picture

Is there an ETA for the D7-port?
Thx!

Niklas Fiekas’s picture

@WilliamV: Not really, I guess. First we must agree what's the target.

@Scyther: That's right. Only, I think, there should be a more lightweight way than Views.

My current oppinion is:

  • Remove most of the functionality of Taxonomy Image Core and use fields instead. Only improve the user interface a bit.
  • Field convert looks good, thank you joachim. This should be the upgrade path for Taxonomy Image Core.
  • taxonomy_image_node_display has the wrong name now. View modes aren't limited to nodes in Drupal 7. As there is almost nothing in D7 Taxonomy Image Core yet, move the D7 equivalent of taxonomy_image_node_display there. It's lightweight anyway.
  • Not sure about taxonomy_image_attach, taxonomy_image_blocks and taxonomy_image_link_alter. Either port them or provide an upgrade path to something else, preferably Drupal core.

I have some time to move this a bit forward, the next days. Edit: However the direction should be clear ;)

tjharman’s picture

Subscribing.

I'm that dumb end user that has a lot of images on my blog and don't want to jump through too many hoops I won't understand :-)

That said, I appreciate this appears to be a bigger issue than changing a few lines of code, so thank you for any solution that might be made available.

Many thanks,

Tim

delta458’s picture

How?

Niklas Fiekas’s picture

Sorry, what do you mean "how"?

delta458’s picture

"Posted by wjaspers on February 23, 2011 at 12:00am
Shouldn't be necessary now that D7 includes CCK in core, which uses entity API.
As long as you have filefield or imagefield modules enabled, you should be able to easily add images to taxonomy terms."

and my question was how to do that?

Scyther’s picture

@Delta458

I made a quick doc for how to Achieve Taxonomy Image function in Drupal 7 with Imagefield http://drupal.org/node/1224916

NancyDru’s picture

Thanks.

delta458’s picture

@Scyther: yes, it worked.. but still I need taxonomy icon module to display only the icon in the content type :)

so I have 3 questions now:
1) Will the taxonomy icon module be integrated in the taxonomy image module? or what are the plans now?
2) I still get an warning where it says that only variables should be used in taxonomy_icon_view() when using the taxonomy icon module...

"Strict warning: Only variables should be passed by reference in taxonomy_icon_field_formatter_view() (line 48 of C:\xampp\htdocs\sites\all\modules\taxonomy_icon\taxonomy_icon.module)."

3) The Icon has link to the term.. how can I disable the link to the term?

Scyther’s picture

@Delta458
This is not a support thread for taxonomy_icon module that you are talking about. So please stop writing about this here.

xmacinfo’s picture

@Scyther: Please be considerate. http://drupal.org/dcoc

Niklas Fiekas’s picture

The issue #1225820: Strict warning in Taxonomy Icon has been fixed. This is good because Taxonomy Icon is a testing sandbox of what Taxonomy Image Node Display could be in D7.

maxdx7’s picture

Upgrading to D7 should be as easy as installing D7

Niklas Fiekas’s picture

@maxdx7: Yes, this would be the best case. When considering usage of http://drupal.org/project/field_convert, this would be a contra argument.

toxiclung’s picture

+1

xmacinfo’s picture

@toxiclung: +1 are now to be banned. Please use the new Follow button shown above! Cheers!

drupal a11y’s picture

Check out this tutorial "Achieve Taxonomy Image function in Drupal 7 with Imagefield": http://drupal.org/node/1224916

drupal a11y’s picture

Hi Niklas, your module works great.

But in my case I need the icon without the a-tags.
Could a formatter in "Field format" be added under "admin/structure/formatters"?
Or could a Formatter "Unlinked Icon" be added ?

Unfortunately I am just a designer and no programmer.

Niklas Fiekas’s picture

Yes, someone requested that a while ago, but I kept it in a feature branch: https://github.com/niklasf/taxonomy_icon/tree/1226180-linked-option (if you're not comfortable with Git you can download it as a ZIP there).

Now let's keep this on topic for Taxonomy Image. Discussion, bugs, feature requests for Taxonomy Icon in it's issue queue.

jsheffers’s picture

What if I need an image for each term in a vocabulary? Is that something that could be included in the D7 version? Having an image field per Vocabulary is helpful, but I don't want to create 5 different vocabularies since my target terms are all related to one vocabulary.

wjaspers’s picture

@jsheffers, for reference: http://drupal.org/sandbox/brajendrasingh/1386558 Is a sandbox module someone is working on for Vocabulary images.

klonos’s picture

...not "someone". Brajendra's name is in the path ;)

baltusf’s picture

How can I show the icon of #16 in a view instead of the text of taxonomie?

wjaspers’s picture

@baltusf, add the "field" which your image is stored in to the display for your view.

baltusf’s picture

Thanks, but then the look & feel is not nice. Do you know which code i must use to make a view which shows pretty. Is the code the same as in D6?.
I have it now like: http://rootsd.fred-baltus.nl/verhalen
but want is this way: http://genealogie.hcc.nl/drupal/nieuws

I have added a field called field_taxonomie and on my views screen i have the field "(term from field_taxonomie) Taxonomie term: Icon "

baltusf’s picture

HI,

I have found... with
foreach ($fields as $id => $field):
echo $id;
endforeach;
I can see the fieldnames which are displayed. Then it is a little step to make a customized view

Niklas Fiekas’s picture

Version: master » 7.x-1.x-dev
Status: Active » Fixed

Something is better than nothing, so I created a dev-release for what we have by now. It has less features than the Drupal 6 version, but it fills the gap a little and provides a basic upgrade path. (Note that the upgrade path is not yet tested. So be even more careful!)

Let's make everything else seperate issues.

klonos’s picture

Thanx Niklas!

Status: Fixed » Closed (fixed)

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

klonos’s picture

Status: Closed (fixed) » Needs work

Hey Niklas, could you please list the 7.x dev in the project's page. Thanx in advance.

zilla’s picture

could this be extended to support an Icon/Image for an entire "Content Type" (e.g. person, place, thing - one main icon as a visual cue across site for instances of such content, then further refined by taxonomy images when viewing the node (just an example)

klonos’s picture

You could have a special vocabulary dedicated to tagging content types. That vocabulary would have as many terms as your site has content types. Then use Taxonomy image to set one image for each term. Then assign a default value (term) for each content type. Then use Field Permissions (or any other module that does the job) to allow everyone to view that field (and thus the associated image) but only admin/you to be able to edit it. This way when normal (non-admin) users create or edit nodes of a content type, they won't be able to change the default tag and image you would have pre-set as default value ;)

NancyDru’s picture

@zilla, this should be a separate issue. This can be done entirely with CSS as the HTML will contain class="node-type-xxxx..."

klonos’s picture

Yeah, Nancy is right. You can do this with css at your theme level. In my comment above I went and over-complicated things. Follow my method only if you want to manage node types and images/tags associated with them through the Drupal admin UI.

I would like to bring Content Type Image to your attention. It doesn't have a 7.x version yet (#1477390: D7 Port of the Content Type Image module?), so I'm afraid that it might take long to have a solution if you're using D7. I went on and filed an issue for you there that requests what you're asking: #1477394: Provide a way to display the image assigned to the content type on node view (node display settings).

klonos’s picture

Nancy is also right about this being off-topic. Here's the correct issue: #1098460: Anyone know of a content type images similiar to taxonomy images, but for associating content to a specified content image?

...I've copy-pasted my comment there too.

zilla’s picture

actually, i kind of like your solution because then i've got one module managing all of the associated icons and one integrated place to go for views, etc....yes, it's a few extra steps to implement but it solves the problem in a very logical way.

apratt’s picture

To go back to the idea of field convert - is there any work being done to develop an upgarde using it?

tngvndrm’s picture

I'm loogin for the other way arround, I need to add Taxonomy to Image.
I know i can create a Content Type 'Image' and add a tax-field in that newly created Content Type.

What i would like is to "extend" the existing image specs,

In croncretum: I want to add multiple images to an Event (content type with date+cal information) and i want to be able to assing the "Flyer" tag to a specific image.

Obvously, if i can add an image to a set, and this set to a node, that would fix it as well.

I hope this is not to off-topic.

wjaspers’s picture

@tanguyvd: You'll need the file_entity module to attach a term reference as a field to an image file.

tngvndrm’s picture

Hi wjaspers,
thanks for that, installed, working on it and will figure it out.

EvanDonovan’s picture

Just wanted to let you all know that I updated the directions on how to achieve this functionality in Drupal 7 without the Taxonomy Image module: http://drupal.org/node/1224916. I added a sample taxonomy-term.tpl.php if you are using a custom view mode to render the referenced taxonomy term.

This is only a stopgap of course until the module is available in a stable release, but I thought it might be helpful to some.

klonos’s picture

@Niklas Fiekas, @NancyDru: Can we please list the 7.x dev to the project's download section, close this issue here and file separate issues against that version for any remaining tasks?

Niklas Fiekas’s picture

Status: Needs work » Fixed

Ok :)

Status: Fixed » Closed (fixed)

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

Bernsch’s picture

@Niklas: When can we expect with a recommended D7 release? At least one alpha release?