Theme Dev Environment and Webpack Bundles loading


I’m a frontend developper from France (Angular/Material). I’m pretty new to Omeka, i need it for my non-profit organization. I’m developing a custom theme based on Material Design. I’m usually familiar to single-page web apps, so php/zend is pretty new to me. I started a project with PhpStorm because i’m familiar to JetBrain IDEs. So i have few questions:

1) Auto-completion in views, partial views
The only way i managed to have Type definitions in views is using PHPDocs, is there a better way to do it ?
Eg with linked-resources.phtml

 * @var Omeka\Api\Representation\AbstractResourceEntityRepresentation | Omeka\Api\Representation\ItemSetRepresentation $objectResource
 * @var Omeka\Api\Representation\AbstractResourceEntityRepresentation | Omeka\Api\Representation\ItemSetRepresentation $this
 * @var int $page
 * @var int $perPage
 * @var int $property
 * @var Omeka\Api\Representation\ValueRepresentation[][] $subjectValues
 * @var int $totalCount
 * @var Omeka\Api\Representation\PropertyRepresentation[] $properties

2) Webpack bundles, JQuery etc.
I see jQuery is massively used in Omeka themes and i’m a little preoccupied to serve just needed javascript (eventually css too) on each page. I’m using Webpack and Material web components. What is the best place and way to load my generated js/css bundles regarding views/partial views loaded ?

Do you use AJAX and Jquery animations ? If no, maybe loading the JQuery slim build should be a best option ?


You’re probably right on the first point… we more or less do without typehinting in the views.

There’s no requirement to use jQuery, though it is used by some of the javascript we provide out of the box. As for loading your own… I guess it depends on how your process is set up. We use the Zend Framework headScript helper (and other similar helpers) to load scripts. Things used across an entire theme are typically provided for in the layout.phtml partial, but scripts and other assets used only by certain views or partials can simply be loaded by calling headScript in those views; the assets will be included in the head only when that view is actually used.

Thank you for your answer, i’ll do it with headScript.
Is it possible to do some theming for Modules ?

What do you mean by theming for modules, exactly?

I mean, overwriting the module views in the theme folder. I was, not sure, but i tried, with Mapping and it seems to work :wink:

Okay, that’s what I thought but I just wanted to be sure.

Yeah, the theme’s views basically just override anything provided by the core or a module, so as long as you place the file in the same location under “views” the theme’s version should be used.

1 Like

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.