Extending the job board
These extension points exist:
- PSR-14 event
PostProcess Fluid Variables Event \JWeiland\is dispatched by the actionsJobboard\ Event\ Post Process Fluid Variables Event listandsearchright before the variables are assigned to the view. Listeners can read the request and the settings and add or replace variables withadd. The variableFluid Variable () jobsis a query result (\TYPO3\) that is not executed yet, so a listener can limit it in the database. The page browser is built this way, seeCMS\ Extbase\ Persistence\ Query Result Interface \JWeiland\and Page browser. The options of the search form are built before the event, with aggregate queries ofJobboard\ Event Listener\ Add Paginator Event Listener \JWeiland\.Jobboard\ Service\ Job Search Options Service - Templates
- All templates, partials and layouts can be overridden, see Templates and frontend assets. This includes the info window of the map, see Info window of a job location.
- Info window of the map
- With EXT:maps2, the job board renders the info window of job locations
in a listener of the PSR-14 event
\JWeiland\, see Info window of job locations.Maps2\ Event\ Render Info Window Content Event - Job sources
- New import sources are classes tagged with
api., see Connect a job source to the import.model - DataHandler hooks and events
- The import writes all records with the DataHandler, so the hooks and
events of the TYPO3 Core are triggered, for example for search
indexing. The job board itself uses the DataHandler hook
\JWeiland\to calculate the effective salary of jobs, see Update the effective salary of the jobs. Write jobs and salary records with the DataHandler as well, or runJobboard\ Hook\ Update Effective Salary Hook vendor/afterwards.bin/ typo3 jobboard: salary: update -- all - Page title
- The page title provider can be replaced with TypoScript, see Job title as page title.
- Routing
- The route enhancer can be copied into your site configuration and changed, see Speaking URLs (route enhancer).
- Logging
- All messages of the extension use the log channel
JWeiland.. Configure own writers inJobboard $GLOBALS.['TYPO3_ CONF_ VARS'] ['LOG'] ['JWeiland'] ['Jobboard']
The address model
\JWeiland\ extends
the model of EXT:tt_address and adds the map location of EXT:maps2. It is
mapped to the table
tt_ in
EXT:jobboard/Configuration/Extbase/Persistence/Classes.php.
Info window of job locations
When a visitor clicks a marker, EXT:maps2 requests the info window content
with an AJAX request and dispatches the PSR-14 event
\JWeiland\ with the record
of the map location (
get) and the request.
The job board listens to this event with
\JWeiland\
(identifier jobboard/). The
listener is registered in EXT:jobboard/Configuration/Services.php
only if EXT:maps2 is installed. It works like this:
- If another listener has already set content
(
getis not empty), it does nothing.Info Window Content () - It searches the addresses with this map location and their open jobs, see Info window of a job location. If there is none, it does nothing. Markers of other extensions are therefore not affected, EXT:maps2 renders their info window as usual.
- Otherwise, it renders
Templates/and sets the result withMap/ Info Window. html set.Info Window Content ()
To change the HTML of the info window, override the template, see Info window of a job location.
To replace the info window with your own PHP code, register a listener of the same event that runs before the listener of the job board. If your listener sets content, the job board keeps it:
<?php
declare(strict_types=1);
/*
* This file is part of the package vendor/my-sitepackage.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
namespace Vendor\MySitepackage\EventListener;
use JWeiland\Maps2\Event\RenderInfoWindowContentEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
#[AsEventListener(
identifier: 'my-sitepackage/job-location-info-window',
before: 'jobboard/renderJobLocationInfoWindowContent',
)]
final readonly class MyJobLocationInfoWindowEventListener
{
public function __invoke(RenderInfoWindowContentEvent $event): void
{
$poiCollectionUid = (int)($event->getPoiCollectionRecord()['uid'] ?? 0);
if ($poiCollectionUid === 0) {
return;
}
// Render your own content. As the content is not empty anymore, the
// listener of the job board does not change it.
$event->setInfoWindowContent(
'<p>' . htmlspecialchars('Location ' . $poiCollectionUid) . '</p>',
);
}
}
A listener that runs after the listener of the job board can read and
change the content set by the job board with
get and
set.
Job properties for templates
Useful properties of
{job}
in Fluid:
{job.,salary Range Min} {job.salary Range Max} - Lowest and highest salary, for both salary modes. In salary mode
"Salary grade", these are the lowest and highest positive amount of all
steps or fixed amounts of all valid selected grades. In salary mode
"Free salary entry", the maximum falls back to the minimum if it is
empty. Use these properties instead of evaluating
{job..salary Mode} {job.has Salary Range} trueif minimum and maximum differ.{job.has Salary Information} trueif the job has any salary information.{job.,effective Salary Min} {job.effective Salary Max} - The stored effective salary, see Update the effective salary of the jobs.
{job.ishas Effective Salary Information} trueif one of them is greater than 0. The list and the detail view use it to decide whether a job is shown. {job.,job Areas} {job.,salary Grades} {job.benefits} - All related records.
{job.andjob Area} {job.return the first record only.salary Grade} - File properties
{job.,header Logos} {job.andtender Files} {job.are file references. They are always lists, alsopdf Files} {benefit.. Useimage} <f:to render them.for> {job.employer Address} - The address of the employer (EXT:tt_address). The name of the employer
is
{job., the logoemployer Address. company} {job.. Both may be empty, and the job may have no employer address at all.employer Address. first Image} {job.,is Import} {salaryGrade. has Steps} - Boolean values.