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.)

 

chanel

 

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:

 

<?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?

 

chanel

 

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?

 

Thanks,

chanel

 

Chanel Wheeler

Library Network Programmer/Analyst

Yavapai Library Network

1120 Commerce Dr.

Prescott, AZ  86305

 

Phone: (928) 442-5741

chanel.wheeler@yavapai.us

Open a help desk ticket