0

I want to use field variable in the below array structure.

var field = $(this).attr('field');
alert(Drupal.settings.taxonomy_fancybox.{field});

Drupal.settings.taxonomy_fancybox shows the following in the console

field_fancybox
:
{vocabulary: "category", node_type: "page", field_name: "field-fancybox"}
field_fancybox_2
:
{vocabulary: "tags", node_type: "page", field_name: "field-fancybox-2"}
harshal
  • 10,252
  • 3
  • 18
  • 23
  • 1
    `alert(Drupal.settings.taxonomy_fancybox[field]);` I would assume – mplungjan Jun 06 '18 at 14:37
  • ok let me try that and get back to you @mplungjan – harshal Jun 06 '18 at 14:38
  • You may have to adjust that somewhat; it's impossible to tell from the console output you've quoted, which is incomplete. But that's fundamentally going to be it. What's inside the `[]` can be any expression, see the linked question's answers for details. – T.J. Crowder Jun 06 '18 at 14:39

0 Answers0