Hi Demian,

I would like to second Chanel. That was a very useful example. I'm trying to do something very similar at the moment and I found that very helpful. Thank you!


On 2/26/13 11:20 AM, Demian Katz wrote:
Glad to have you back again -- it's amazing how time can fly.

Also glad to hear that the explanation was helpful.  Good luck with the hold logic changes; if you find that there's anything too painfully hard-coded to easily change, let me know and perhaps we can work out a way to make things more pluggable.

- Demian

From: Chanel Wheeler [Chanel.Wheeler@yavapai.us]
Sent: Tuesday, February 26, 2013 11:57 AM
To: vufind-tech (vufind-tech@lists.sourceforge.net)
Subject: Re: [VuFind-Tech] VuFind 2 module creation

Hi Demian,


That’s exactly the info I needed to get started! Thanks! I’ve got a driver override working now.


As for the hold logic, I think I’ve got my head around what I need to change. The hardest part will be figuring out how to get the right voodoo in the right place of the framework to extend the class(es).


(Sadly, this is the first chance I’ve had to work on VuFind since December 3. But going forward I’ll be carving out entire days just for VF. Whew.)




From: Demian Katz [mailto:demian.katz@villanova.edu]
Sent: Tuesday, December 04, 2012 6:44 AM
To: Chanel Wheeler; vufind-tech (vufind-tech@lists.sourceforge.net)
Subject: RE: VuFind 2 module creation


I totally understand where you’re coming from.  It’s always frustrating to start working with a new piece of complex software, because all you want to know is where to start working, and it is often hard to figure out.  Obviously documentation needs to be improved to address this.  In the meantime, let’s see if I can get you up and running.


First of all, modules exist for two main reasons:


1.)    To override some of the core configuration settings

2.)    To provide a namespace where you can put code


Most of VuFind 2’s settings are found in module/VuFind/config/module.config.php.  This contains all of the rules for routing URLs, constructing resources used within the code, etc., etc.


So, to get this going, you first need to create a local module if you haven’t already.  The install.php program included with VuFind 2 can do this for you.  Let’s assume you call your module VuFindLocal.  Now you should have a couple of important things:


1.)    module/VuFindLocal/config/module.config.php, where you can override settings

2.)    module/VuFindLocal/src/VuFindLocal, where you can put code namespaced to VuFindLocal – the framework will know how to automatically load this code when it is referenced


With that setup in place, you can simply override the configuration of the Symphony driver.  Currently, it looks like this in the VuFind module configuration:


    'ils_driver_plugin_manager' => array(

        /* … */

        'invokables' => array(

            /* … */

            'symphony' => 'VuFind\ILS\Driver\Symphony',


This just tells VuFind, “when somebody asks for the symphony ILS driver, create an instance of the VuFind\ILS\Driver\Symphony class.”


So you can more or less copy this configuration into the array in your VuFindLocal module, but change the namespace of the class to VuFindLocal.  You’ll end up with:


$config = array(

    'ils_driver_plugin_manager' => array(

        'invokables' => array(

            'symphony' => 'VuFindLocal\ILS\Driver\Symphony',





Now you can edit module/VuFindLocal/src/VuFindLocal/ILS/Driver/Symphony.php:




namespace VuFindLocal\ILS\Driver;


class Symphony extends \VuFind\ILS\Driver\Symphony


    /* … */



It’s a bit much at first, but really you’re just editing two files – the configuration that says what to load, and the file that is being loaded.


Changing the workflow for holds is obviously going to be a bigger project – that’s a particularly complicated part of the code – but please let me know if you need help finding anything or if you have suggestions for improvement.


- Demian


From: Chanel Wheeler [mailto:Chanel.Wheeler@yavapai.us]
Sent: Monday, December 03, 2012 4:08 PM
To: Demian Katz; vufind-tech (vufind-tech@lists.sourceforge.net)
Subject: RE: VuFind 2 module creation


I fully appreciate what the ZF2 framework is intended to accomplish at large (and wherever possible I did not hack core code in VuFind 1 – I extended classes, created my own theme, etc.). The problem I’m finding is that instead of putting 98% of my energy into making the customizations I need, I’m putting all that energy and more into trying to understand how in the world to set up all the necessary directories, files, classes that have to be created by default (which confuses me because isn’t one of the points of a framework to take away the busy work?), and VuFind specific class extensions. I don’t care how ZF2 works; I don’t want to be a ZF2 master. I just want to override existing VuFind functionality and add new functionality. </soapbox> (That was partly to relieve some frustration but also to point out where some VuFind developers will be coming from, especially those of us that can only carve out 3 or 4 hours on a good week to work on VuFind customizations.)


Two things that pop to mind immediately that I need to do are to extend the Symphony driver and modify how title/copy holds are implemented in the catalog currently. I expect that the Symphony driver modification will be straightforward once I can make sense of how I get a ZF 2 module constructed within the VuFind context (for example, ZF 2 shows the Controller directory as being at the custom module’s root but the VuFind core components have it underneath “src”  -- I don’t know if that means it has to go in src).


I don’t have a clue how to go about modifying the title/copy hold logic – that’s where I would start playing with the core code to see what objects come to play. (I haven’t even begun to try to figure out VuFind core.) But again even if I figure that out, I’m baffled as to the extent and structure of stuff I need to set up in a Module to add my modifications. If I could see a working add-on Module (that does anything) to see how the pieces are put together (independent of ZF2 theory), it would go a long way to getting started on making my own customizations. And if I could just make a Module which injected “Hello World” into the home page, I ‘d be feeling way more confident.


I would compare it to when my father was teaching me how to drive (manual, of course). He went through great explanations of how the gears work and how the clutch releases the gear, blah blah blah. That didn’t help one iota in the actuality of driving a stick. In fact, only after I got the hang of driving a stick did the theory behind the practice start to have any meaning. (I would add that it would have been more helpful if he’d driven the car while explaining the actions he was doing, showed how to recover from a near stall, etc.)


Am I making any sense?




From: Demian Katz [mailto:demian.katz@villanova.edu]
Sent: Monday, December 03, 2012 1:04 PM
To: Chanel Wheeler; vufind-tech (vufind-tech@lists.sourceforge.net)
Subject: RE: VuFind 2 module creation


VuFind 1 makes it very easy to just dive in and start editing things, but this sometimes makes merging in future upgrades more difficult.  The purpose of the VuFind 2 add-on module system is to allow you to isolate your customizations from the VuFind core code, which should make long-term maintenance easier.  This adds some up-front overhead in exchange for long-term benefits.  It should also be fairly easy once you know where all the pieces go, though obviously there’s a learning curve to reach that point (and it’s a bumpy learning curve, what with the software still being in active development and things periodically shifting around).


However, keep in mind that all of the VuFind 2 module/local directory stuff is optional.  I certainly recommend using it, but nothing is stopping you from hacking the core code directly, just like you did with VuFind 1.


In the interest of learning the new code and becoming more comfortable, perhaps a useful approach would be to implement some changes directly to get a feel for how things fit together, and then reimplement them in a local module once you are more comfortable with the system.  I suspect that the reason you’re finding this difficult is that you are essentially trying to learn so many independent things at the same time (core VuFind architecture, and the extension system… not to mention all the other things you mention).  I’m happy to help break this down into smaller pieces, especially since any conversations we have now can probably help contribute to future documentation that makes this easier for everyone.


Perhaps if you could provide an example of something specific you are interested in doing with VuFind, I can provide some pointers about how to ease into the code.  If I can find the time, it might even make sense for me to write a detailed blog post with a working example…  but even if I can’t carve that out of my schedule right away, we can start this iteratively.


- Demian


From: Chanel Wheeler [mailto:Chanel.Wheeler@yavapai.us]
Sent: Monday, December 03, 2012 2:47 PM
To: vufind-tech (vufind-tech@lists.sourceforge.net)
Subject: [VuFind-Tech] VuFind 2 module creation


I’m simultaneously trying to absorb object orientation (been functional since the 80s), MVC, ZF2, and VuFind 2. (I hate to say it but VuFind 2 is exponentially more difficult to customize than VuFind 1 was.)  I really need a VuFind 2 Hello World module about now. Are there any VuFind 2 add-on modules out there that I can install to see an applied example?





Chanel Wheeler

Library Network Programmer/Analyst

Yavapai Library Network

1120 Commerce Dr.

Prescott, AZ  86305


Phone: (928) 442-5741


Open a help desk ticket


Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:

Vufind-tech mailing list