1

Recently we started a proyect where we need to implement a webpage that should be able to manage google maps markers and locations, with aditional info on them. However the requirement was to do it as a Drupal module in order for the client to embed it on his existing web page powered by Drupal.

I have a strong background developing web pages using java technologies like JSF, and I have had some previous experience using PHP MVC frameworks like cake php, but that's the reason why I think I'm so confused with the module development process used in Drupal (hook methods and conventions...).

First of all I have been looking at the Drupal 7 module development book by Packt, and I just finished the chapter 4 where you're supposed to implement and theme a single blog module. However by using the techniques showed until that point... I find it extremely difficult to implement a google maps powered (Block???) by just theming it as lists or using the render API.

What I found really interesting was the possibility to use theme templates and create the block content based on them; by just passing variables and priting php statemnets..., but it's not explained very well on the book either. So that's why I wanted to ask you where I could find more resources about theme templates, so that I could just put my html markup and js functions on that template, and pass to it the processed variables.

Anyway I think my best bet would be to extend existing module funcionality. In example for the maps I would use the OpenLayers Drupal module that's already done and tested. However, I need to execute my own code logic when a marker is selected, so that's another question..., how Could I insert a callback or intercept the OpenLayers module's functions so that I can extend them and save the data on my own tables or any operation I needed.

Should I rewrite the module files to add more functionality?? or could I implement my own modules and just intercept method calls?.

I'm just starting Drupal, and I think is really simple... but just for showing content, on the other hand interacting with the user, retrieving data from clients, seems to be really really difficult, because I have no idea how to show custom html markup, or add js functions, and then executing php ajax function callbacks on the server. For all these reasons I'm felling a little bit overwhelmed, and I really really need some guidance, tutorials, resources to focus on..

The other question I had is..., what are the topics that I should focus most in order to start my module fast, what I basically need is the ability to put markers on a map (Using the Javascript V3 API I guess...), and then sending AJAX callbacks to the server in order to update the selected marker info and adding it to my Session?? variables.. (This is really easy using JSF, and a framework like Primefaces.. however in the php world I'm lost) I think I should look at Drupal Entities and Fields next... but also Widgets?? Right???

Thanks a lot.

1 Answer 1

1

I'm not sure that you need to dive into any theming. The Google js API uses an empty div and javascript to fill it. Your could create a custom module with a block hook to create your block. It would also load the necessary js to engage the Google API. This assumes that you are going to access the geographic information for the map independently - i.e. via accessing the database or whatever on your own. I think it makes most sense to use something like Openlayers if the data is stored in nodes and you want to use a View to access it.

If you need to theme the block outside of the map, you could use a straightforward theming function, also in your custom module. Creating or using a template makes most sense if somebody else who is more of a html/css person with less php/js experience is going to be doing the theming. If the theming is simple, you could just create the needed id and class tags in your module and then theme it via a css file.

Your Answer

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

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