Tip:
Highlight text to annotate it
X
Go ahead and make sure that this module is saved and lets go ahead and take a look at
this in action. So i'm going to go ahead and visit a few pages.
Now in Drupal there is an admin theme and a default theme, so we're not seeing the block
in our admin theme but because we put our captured code in our "hook_init" function,
we're still capturing the pages visited.
Now let's go to our home page which is using our default theme.
And here on the left hand side, sure enough, we have our history block. We have below are
the last five pages you've visited so that's functioning properly. And then we have our
list of pages and we can click on any one of these to visit them.
Right. There's our content page. We go back and refresh, we'll see the content now displays
toward the top because we just visited it and it got added to our history. If we want
to change the number that's visible, we can go ahead and click on the cog wheel. Click
on configure block. lets go ahead and make this our number maximum number eighteen and
click "save block".
This takes us back to our home page and now we have a long list of history here that we
can use to navigate back.
Now we're using the most basic of hooks in this demonstration but already you can see
that you can create something fairly usable with just those hooks. In fact, a lot of modules
are just comprised of those few hooks. And this ability to track history is actually
pretty practical so we are going to use this as a jumping off point for exploring some
of the other API's in layers in Drupal including the database layer and the themeing layer
and get something that's even more fun.
If you go back to the steps folder, there is one more step here. This is the final module
code which is just what we were just working with but it's got some additional comments
in it, so next to every hook implementation is a URL to the page on "API dot drupal dot
org" that explains the hook and gives you some ore details about it.
I've also added some challenges that you can use to further extend this code and play with
it and see if you can figure out how to do some of these things.
A lot of these we'll cover in future videos. Some of them are just functionality improvements
that will help you get familiar with the structure of a hook, if not necessarily, expose you
to specific drupal API functions but they can still be fun to work through, so this
file is a good jumping off point to explore these hooks a little further and play with
the code a little bit and see if you can add some new functionality to this module, something
that you see missing in particular. And once you had a chance to look through those API
pages and hopefully go through some of those challenges, go ahead and move on to the next
video.