About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:howtos:connecting_a_new_external_data_source

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
development:howtos:connecting_a_new_external_data_source [2023/03/27 19:18] – [6. Create Controllers] demiankatzdevelopment:howtos:connecting_a_new_external_data_source [2023/03/27 19:23] – [9. Set Up Templates] demiankatz
Line 62: Line 62:
  
 ====7. Register Controllers==== ====7. Register Controllers====
-Now that your controllers are created, you should register them in the invokables array of the controller section of module/VuFind/config/module.config.php.  The entries should look like 'sample' => 'VuFind\Controller\SampleController' and 'samplerecord' => 'VuFind\Controller\SamplerecordController'.+Now that your controllers are created, you should register them in the factories and aliases arrays of the controller section of module/VuFind/config/module.config.php. In most situations, you can use the standard \VuFind\Controller\AbstractBaseFactory to build both of your controllers, though you can also build a custom factory if you need to inject additional dependencies.
      
 ====8. Set Up Routes==== ====8. Set Up Routes====
Line 68: Line 68:
     - In the $recordRoutes array, add an association between the route name (which should be your source value concatenated with the word "record") and the route's controller name (as registered in controller invokables above).  For example: 'samplerecord' => 'samplerecordcontroller'     - In the $recordRoutes array, add an association between the route name (which should be your source value concatenated with the word "record") and the route's controller name (as registered in controller invokables above).  For example: 'samplerecord' => 'samplerecordcontroller'
     - In the $staticRoutes array, add any necessary search-related routes... for example, 'Sample/Home', 'Sample/Search' and 'Sample/Advanced'.     - In the $staticRoutes array, add any necessary search-related routes... for example, 'Sample/Home', 'Sample/Search' and 'Sample/Advanced'.
-    - Note that, if you are using a [[development:architecture:customizing_vufind#modules|custom module]], you may need to copy some extra route-building logic from the main VuFind® configuration, since these convenience route-building arrays are not present by default in empty modules+    - Note that, if you are using a [[development:architecture:customizing_vufind#modules|custom module]], you may need to copy some extra route-building logic from the main VuFind® configuration or use a [[development:code_generators|code generator]], since these convenience route-building arrays are not present by default in empty modules
  
 ====9. Set Up Templates==== ====9. Set Up Templates====
 Now that the models and controllers are set up, you need some views. Now that the models and controllers are set up, you need some views.
     - //Search Templates// - Within your chosen theme, create a templates/sample directory (replacing 'sample' with a lowercased version of your search controller's name).  In this directory, you need to create one template for each action: advanced.phtml, home.phtml and search.phtml.  These templates can simply wrap around the default search templates, overriding a few settings if necessary.  See the existing templates in templates/worldcat for the simplest possible example.     - //Search Templates// - Within your chosen theme, create a templates/sample directory (replacing 'sample' with a lowercased version of your search controller's name).  In this directory, you need to create one template for each action: advanced.phtml, home.phtml and search.phtml.  These templates can simply wrap around the default search templates, overriding a few settings if necessary.  See the existing templates in templates/worldcat for the simplest possible example.
-    - //Record Templates// - If your record driver extends \VuFind\RecordDriver\SolrDefault, you may not need to create any record templates at all -- the defaults should work for you.  However, if you built a custom driver, you will need to create an appropriately-named directory under templates/RecordDriver in your chosen theme.  Look at the existing templates in templates/RecordDriver/SolrDefault to see which filenames you need to create and what sort of content they should contain (note that some are optional and some filenames are dynamically generated based on other record driver options -- i.e. the tab-*.phtml files, which are driven by allowed tab options).+    - //Record Templates// - If your record driver extends \VuFind\RecordDriver\DefaultRecord, you may not need to create any record templates at all -- the defaults should work for you.  However, if you built a custom driver, you will need to create an appropriately-named directory under templates/RecordDriver in your chosen theme.  Look at the existing templates in templates/RecordDriver/DefaultRecord to see which filenames you need to create and what sort of content they should contain (note that some are optional and some filenames are dynamically generated based on other record driver options -- i.e. the tab-*.phtml files, which are driven by allowed tab options).
 ---- struct data ---- ---- struct data ----
 properties.Page Owner :  properties.Page Owner : 
 ---- ----
  
development/howtos/connecting_a_new_external_data_source.txt · Last modified: 2023/06/19 18:21 by demiankatz