4

I'm using gmap module to mark job locations on a map. It now shows all locations of content type: jobs. Is there any way I can only mark the displayed jobs from my view block? I filter the jobs through exposed filters.

EDIT:

Just going to add this code here, might be useful for some. It puts the attachment in a block so you have more control over it.

<?php
//Puts gmap attachment in block so it's easier to theme

function gmap_block_block_info() {
  $blocks['gmap_attachment'] = array(
    'info' => t('Gmap Attachment'),
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}

function gmap_block_block_view($delta = '') {
  $block = array();
  if ($delta == 'gmap_attachment') {
   // $block['subject'] = t('Gmap Attachment');
    // Load the view.
    $view = views_embed_view('jobs_view_block', 'gmap_attachment');
                        //('machine_name_view', 'machine_name_display)
    if ($view) {
      $block['content'] = $view;
    }
    else {
      $block['content'] = t('The view is empty');
    }
  }
  return $block;
}

1 Answer 1

1

If you set up the map display as an attachment, you can set it to inherit the exposed filters that you've defined for your job listing. You'll get one set of exposed filters that controls both the listing and the map.

There may be some issues - see this blog post by someone solving what looks like the same problem.

1
  • Thanks, just adding it as an attachment did the trick, really simple! Commented Nov 8, 2013 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.