Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Lisätään tiedostoon /module/FinnaCustom/config/module.config.php viite omaan paikalliseen tietueajuriin (esim. 'solrmarc' => 'FinnaCustom\RecordDriver\Factory::getSolrMarc', ks. /module/Finna/config/module.config.php):

    Code Block
    languagephp
    <?php
    namespace FinnaCustom\Module\Configuration;
    $config = [
         'vufind' => [
            'plugin_managers' => [
                'recorddriver' => [
                    'factories' => [
                        'solrmarc' => 'FinnaCustomFinna\RecordDriver\Factory::getSolrMarcSolrMarc', =>
                   ],             ],
            ]
        ]
    ];
    return $config;

    Luodaan tiedosto /module/FinnaCustom/srs/FinnaCustom/RecordDriver/Factory.php ja lisätään tiedostoon metodi getSolrMarc. Samaan tapaan kuin Finna-moduulin Factoryssä:

    Code Block
    languagephp
    <?php
    namespace FinnaCustom\RecordDriver;
    use Zend\ServiceManager\ServiceManager;
    
    class Factory extends \Finna\RecordDriver\Factory
    {'VuFind\RecordDriver\SolrDefaultFactory',
              /**      *],
    Factory for SolrMarc record driver.      *      * @param ServiceManager $sm Service manager.'aliases' => [
            *      * @return SolrMarc      */
        public static function getSolrMarc(ServiceManager $sm)
        {
            $driver = new SolrMarc(
                $sm->getServiceLocator()->get('VuFind\Config')->get('config'),
                null,
                $sm->getServiceLocator()->get('VuFind\Config')->get('searches')RecordDriver\SolrDefault' => 'FinnaCustom\RecordDriver\SolrDefault',
                $sm->getServiceLocator()->get('VuFind\SearchResultsPluginManager'),             $sm->getServiceLocator()->get('VuFind\Config')->get('datasources')
            );
            $driver->attachILS(
                $sm->getServiceLocator()->get('VuFind\ILSConnection')RecordDriver\SolrMarc' => 'FinnaCustom\RecordDriver\SolrMarc',
                $sm->getServiceLocator()->get('VuFind\ILSHoldLogic'),    ]
            $sm->getServiceLocator()->get('VuFind\ILSTitleHoldLogic')    ]
        );    ]
        $driver->attachSearchService($sm->getServiceLocator()->get('VuFind\Search'));
            return $driver;
        }
    }
     ]
    
    ];
    return $config;


     

  • Luodaan tiedosto /module/FinnaCustom/srs/FinnaCustom/RecordDriver/SolrMarc.php ja lisätään tänne uusi metodi:

    Code Block
    languagephp
    <?php
    namespace FinnaCustom\RecordDriver;
    class SolrMarc extends \Finna\RecordDriver\SolrMarc
    {
        use \Finna\RecordDriver\SolrFinna;
        public function localTest()
        {
            return "localTest";
        }
    }
  • Metodia voi kutsua tietuesivun sivupohjassa templates/RecordDriver/SolrDefault/core.phtml:

    Code Block
     <?= $this->driver->localTest(); ?>

     

...