1. Go to this page and download the library: Download helsingborg-stad/municipio library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
add_filter('Municipio/Controller/SingularContentType/listing', function($listing, $fields) {
// Example modification to the listing array
if (!empty($fields['custom_field'])) {
$listing['custom_field'] = $fields['custom_field'];
}
return $listing;
}, 10, 2);
add_filter('Municipio/DecoratePostObject', function(PostObjectInterface $postObject):PostObjectInterface {
// Example: Add custom decorator or modify the post object
return new MyCustomPostObjectDecorator($postObject);
});
define('DEV_MODE', true);
define('WEB_FONT', 'Roboto'); //The google fonts name (without weights)
define('WEB_FONT_REMOTE', true); //Load font kit from cdn
use Municipio\Customizer\Fonts\FontChoices;
use Municipio\Customizer\Fonts\FontSettings;
$uploadedFonts = FontSettings::getUploadedFontNames();
$googleFonts = FontChoices::getEnabledGoogleFonts();
$availableFonts = array_values(array_unique(array_merge(
$uploadedFonts,
$googleFonts,
)));
// Example payload shape for a design tool.
$designToolFonts = [
'all' => $availableFonts,
'uploaded' => $uploadedFonts,
'google' => $googleFonts,
];