Skip to main content
Discovered how
Source Link
randomblink
  • 299
  • 5
  • 17

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

UPDATE: After a bit more digging around I got this to dpr and output what I expected.

$variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]

So... now the tough part is figuring out how to generate an image path from a URI... of which, I am fairly clueless, but I will start searching.

UPDATE: After tweaking the function listed above I get this to work.

$faction_icon_url = file_create_url($variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]['uri']);
$output = "<img class='faction_thumb' src='". $faction_icon_url . "' />";
return $output;

Now I have to figure out how to make this image link back to the taxonomy_term like the original output of text did.

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

UPDATE: After a bit more digging around I got this to dpr and output what I expected.

$variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]

So... now the tough part is figuring out how to generate an image path from a URI... of which, I am fairly clueless, but I will start searching.

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

UPDATE: After a bit more digging around I got this to dpr and output what I expected.

$variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]

So... now the tough part is figuring out how to generate an image path from a URI... of which, I am fairly clueless, but I will start searching.

UPDATE: After tweaking the function listed above I get this to work.

$faction_icon_url = file_create_url($variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]['uri']);
$output = "<img class='faction_thumb' src='". $faction_icon_url . "' />";
return $output;

Now I have to figure out how to make this image link back to the taxonomy_term like the original output of text did.

Another Update. Found the link.
Source Link
randomblink
  • 299
  • 5
  • 17

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

UPDATE: After a bit more digging around I got this to dpr and output what I expected.

$variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]

So... now the tough part is figuring out how to generate an image path from a URI... of which, I am fairly clueless, but I will start searching.

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

UPDATE: After a bit more digging around I got this to dpr and output what I expected.

$variables['element']['#object']->field_faction_affiliation['und'][0]['taxonomy_term']->field_faction_icon['und'][0]

So... now the tough part is figuring out how to generate an image path from a URI... of which, I am fairly clueless, but I will start searching.

Update with new information
Source Link
randomblink
  • 299
  • 5
  • 17

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

I have a node with taxonomy term reference fields. The taxonomy term has an image field. Without installing extra modules (I already have WAY more than I should have) is there a way to display a specific field for the taxonomy instead of the textual? And do it from a Childtheme?

I have the DEVEL module installed and after selecting the specific field I still get no ideas. I have dug around inside the field, looking through the various attributes of that field without any ideas.

Array > 'element' > '#field_name'
Array > 'element' > '#field_type' = 'taxonomy_term_reference'
Array > 'element' > '#items' > 'tid' = 4
Array > 'element' > '#items' > 'taxonomy_term' > Object = Recursion

It feels like I am 'right there' and should be able to grab something like ['element'][0]['field_taxonomy_term_image'] and render, but I can't find anything. I realize, after searching stackexchange, and google, that I could install Views and tweak around with it to get the desired output, but I know I've seen somewhere that you can (without coding) get the output of a taxonomy term to be another field than 'title' but I don't remember where I saw it.

UPDATE: I have found the path, but can't figure out how to output it. I did a DPR versus a KPR and just dug through the text. Here is what I see. Inside of template.php inside of a drupal-based custom function THEMENAME_field__content_type($variables) I dpr'd $variables['element'] and found this object/array/path.

[#object] => stdClass Object
    [field_faction_affiliation] => Array
        [und] => Array
            [0] => Array
                [taxonomy_term] => stdClass Object
                    [field_faction_icon'] => Array
                        ...
                        [uri] => public://Faction - Jinteki.pnp
                        [filemime] => image/png
                        ...

So I feel like... I could theoretically, create a new $variables['faction_icon'] to pass on to my tpl.php using the pieces above to generate an img tag. Any ideas?

Source Link
randomblink
  • 299
  • 5
  • 17
Loading