{"id":22487740,"url":"https://github.com/helsingborg-stad/Municipio","last_synced_at":"2025-08-02T20:31:30.560Z","repository":{"id":37484269,"uuid":"48378498","full_name":"helsingborg-stad/Municipio","owner":"helsingborg-stad","description":"A theme specifically made for municipalities. ","archived":false,"fork":false,"pushed_at":"2025-07-10T13:28:27.000Z","size":36819,"stargazers_count":37,"open_issues_count":17,"forks_count":16,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-07-10T18:54:56.070Z","etag":null,"topics":["hacktoberfest","php","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helsingborg-stad.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-21T15:15:48.000Z","updated_at":"2025-07-10T13:28:30.000Z","dependencies_parsed_at":"2024-03-04T09:46:00.635Z","dependency_job_id":"784d4c34-3e3f-4666-8362-74c3c823e434","html_url":"https://github.com/helsingborg-stad/Municipio","commit_stats":{"total_commits":3626,"total_committers":39,"mean_commits":92.97435897435898,"dds":0.7716492002206288,"last_synced_commit":"e1c58f1f95848da2a8f029ad154c65955c528703"},"previous_names":[],"tags_count":1510,"template":false,"template_full_name":null,"purl":"pkg:github/helsingborg-stad/Municipio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helsingborg-stad%2FMunicipio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helsingborg-stad%2FMunicipio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helsingborg-stad%2FMunicipio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helsingborg-stad%2FMunicipio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helsingborg-stad","download_url":"https://codeload.github.com/helsingborg-stad/Municipio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helsingborg-stad%2FMunicipio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268448362,"owners_count":24252019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","php","wordpress"],"created_at":"2024-12-06T17:17:10.020Z","updated_at":"2025-08-02T20:31:30.543Z","avatar_url":"https://github.com/helsingborg-stad.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Municipio 3\n\n## Download theme.\nTo download a complete out of the box working plugin without the need to compile or fetch dependencies.\nGo [here](https://github.com/helsingborg-stad/Municipio/releases) and download the `full-release.zip` from the latest version.\n\n## Getting started\nIt is recommended to install the bundled version of municipio trough our build management repository. [This can be found here.](https://github.com/municipio-se/municipio-deployment)\n\nTo get started you'll need to install the required npm and composer packages. To install these components you will need to have Node.js and Composer installed on your system.\n\n```\n$ cd [THEME-DIR]\n$ php build.php\n```\n\n## Dependencies\nMunicipio requires [ACF PRO](https://www.advancedcustomfields.com/pro/).\n\n## Coding standards\nFor PHP, use PSR-2 and PSR-4 where applicable.\n\n## Gulp\nYou can use Gulp to compile, concatenate and minify SASS and JavaScript.\nThe compiling of SASS will also automatically add vendor-prefixes where needed.\n\nTo compile both js and sass and start the \"watch\" task run the following command from the theme directory:\n```\n$ gulp\n```\n\n## We added support for webpack\nWebpack is a bit faster than gulp. So if you prefer to use webpack instead of gulp, just run the following command:\n```\n$ npm run watch\n```\nor just for a single build:\n```\n$ npm run build\n```\n\n## NPM scripts\n\n* **watch**: Run webpack in watch mode. To be used when working on client side code like scss,js,ts...\n* **build:dev**: Build assets with the development flag.\n* **build**: Build assets for production.\n* **i18n:update**: Updates languages/municipio.pot and languages/sv_SE.po from source files. Run this when translatable strings have been added/updated. **Requires wp-cli**.\n* **i18n:build**: Updates languages/municipio.mo .po file. Run this when changes have been made to the corresponding .po file. **Requires wp-cli**.\n\n## Composer\nYou can install composer dependencies with.\n```\n$ composer install\n```\n\n### Composer scripts\n```bash\ncomposer run test # Run phpunit tests\n```\n```bash\ncomposer run test:coverage # Run phpunit tests with code coverage\n```\n```bash\ncomposer run lint # Run phpcs\n```\n```bash\ncomposer run lint:changed # Run phpcs on changed files (Compares to main branch).\n```\n```bash\ncomposer run fix # Run phpcbf to apply fixes to code.\n```\n```bash\ncomposer run fix:changed # Run phpcbf to apply fixes to changed files (Compares to main branch).\n```\n\n## Constants\n\n### Block author pages\nAuthor pages is blocked by default. To \"unblock\" add the following constant to wp-config (or other suitable place).\n\n```\ndefine('MUNICIPIO_BLOCK_AUTHOR_PAGES', false);\n```\n\n### Load styleguide from a different host\nConstants for setting the base URI to the styleguide. Useful for third-party sites.\n\n```\ndefine('MUNICIPIO_STYLEGUIDE_URI', '//example.com/style/guide');\n```\n\n### Load specific version of styleguide\nConstants that lock version of the styleguide. Comes in handy when you want to enshure maximum stability of a site.\n\n```\ndefine('STYLEGUIDE_VERSION', 1.0.32);\n```\n\n### Load specific developement version of styleguide\nConstant that load local verrsion of the styleguide.\n\n```\ndefine('DEV_MODE', true);\n```\n\n### CSS class in BEMIT style for theme name\nConstant that contains the current theme name in BEM format. Usable when you wnat to connect component styling directly to the theme.You cannot change this.\n\n```\nMUNICIPIO_BEM_THEME_NAME\n```\n\n## Actions\n\n### Municipio/blog/post_info\n\nBlog post info header (single)\n\n- ```@param object $post``` - The post object\n\n```php\ndo_action('Municipio/author_display/name', $post);\n```\n\n### Municipio/share_post/recipients\n\nDo action on sharing post by email, e.g. send a notification\n\n- ```@param object $user``` - User object for the sender\n- ```@param array $recipients``` - List with e-mail addresses\n\n```php\ndo_action('Municipio/share_post/recipients', $user, $recipients);\n```\n\n### Municipio/comment/save_like\n\nDo action on comment like\n\n- ```@param object $comment``` - Comment object\n- ```@param int $userId``` - Current user ID\n- ```@param bool $create``` - True if a new like is created. False if it's removed\n\n```php\ndo_action('Municipio/comment/save_like', $comment, $userId, $create);\n```\n\n### Municipio/post/page/edit\n\nDo action on post edit in admin. Runs after the current_screen hook.\nUseful when something needs to execute when on the edit page of a post in admin and possibly needs access to the current post id or the post type of that post.\n\n- ```@param int $postId``` - The post ID\n- ```@param string $postType``` - The post type\n```php\ndo_action('Municipio/post/page/edit', $postId, $postType);\n```\n\n## Filters\n\n### Municipio/Template/viewData\n- ```@param array $viewData``` - The view data that is passed to filter.\n```php\napply_filters('Municipio/Template/viewData', $viewData);\n```\n**Modifiers**\n\n- ```@param array $viewData``` - The view data that is passed to filter.\n- ```@param string $postType``` - The post type slug.\n- ```@param string $template``` - The archive template name.\n\n```php\napply_filters('Municipio/Template/single/viewData', $viewData, $postType);\napply_filters('Municipio/Template/archive/viewData', $viewData, $postType, $template);\napply_filters(\"Municipio/Template/{$postType}/viewData\", $viewData);\napply_filters(\"Municipio/Template/{$postType}/single/viewData\", $viewData);\napply_filters(\"Municipio/Template/{$postType}/archive/viewData\", $viewData, $template);\n```\n\n**Deprecated:**\n\n- `Municipio/controller/base/view_data`\n- `Municipio/blade/data`\n- `Municipio/Controller/Archive/Data`\n- `Municipio/viewData`\n\n### Municipio/theme/key\nFilters the theme/styleguide asset key.\n\n- ```@param string $key``` - The key of the styleguide theme\n\n```php\napply_filters('Municipio/theme/key', $key);\n```\n\n### Municipio/author_display/name\nSet the name of the author display\n\n- ```@param string $name``` - Default name\n- ```@param string $userId``` - The ID of the user\n\n```php\napply_filters('Municipio/author_display/name', $name, $userId);\n```\n\n### Municipio/author_display/title\nSet the title label for the author name display\n\n- ```@param string $title``` - Default title\n\n```php\napply_filters('Municipio/author_display/title', $title);\n```\n\n### Municipio/ajax_url_in_head\nSet the ajax_url in the \u003chead\u003e\n\n- ```@param string $ajax_url``` - Default ajax url\n\n```php\napply_filters('Municipio/ajax_url_in_head', $ajax_url);\n```\n\n### Municipio/favicon_sizes\nAdd sizes to theme options for favicon\n\n- ```@param array $sizes``` - Default favicon sizes\n\n```php\napply_filters('Municipio/favicon_sizes', $sizes);\n```\n\n### Municipio/favicon_tag\nAdd sizes to theme options for favicon\n\n- ```@param string $tag``` - The HTML tag(s)\n- ```@param array $icon``` - The icon data\n\n```php\napply_filters('Municipio/favicon_tag', $tag, $icon);\n```\n\n### Municipio/header_grid_size\nApplied to classes string for header sizes.\n\n- ```@param string $classes``` -\n\n```php\napply_filters('Municipio/header_grid_size', $classes);\n```\n\n\n### Municipio/mobile_menu_breakpoint\nApplied to classes string for mobile hamburger menu breakpoint.\n\n- ```@param string $classes``` - The default site name\n\n```php\napply_filters('Municipio/mobile_menu_breakpoint', $classes);\n```\n\n\n### Municipio/logotype_text\nApplied to the text that displays as the logo when now logotype image is uploaded in theme options.\n\n- ```@param string $title``` - The default site name\n\n```php\napply_filters('Municipio/logotype_text', $title);\n```\n\n### Municipio/logotype_class\nApplied to the logotype class attirbute\n\n- ```@param array $classes``` - Default class(es)\n\n```php\napply_filters('Municipio/logotype_class', $classes);\n```\n\n### Municipio/logotype_tooltip\nApplied to the logotype class attirbute\n\n- ```@param string $tooltip``` - Default tooltip text\n\n```php\napply_filters('Municipio/logotype_tooltip', $tooltip);\n```\n\n### Municipio/blade/template_types\nApplied to the list of Blade template types.\n\n- ```@param array $types``` - Dafault Blade template types\n\n```php\napply_filters('Municipio/blade/template_types', $types);\n```\n\n### Municipio/search_result/…\nMultiple filters applied to the contents of a search result\n\n- ```@param string $var``` - The content of the variable\n- ```@param object $post``` - Post object\n\n```php\napply_filters('Municipio/search_result/date', $date, $post);\napply_filters('Municipio/search_result/title', $title, $post);\napply_filters('Municipio/search_result/excerpt', $excerpt, $post);\napply_filters('Municipio/search_result/permalink_url', $permalink_url, $post);\napply_filters('Municipio/search_result/permalink_text', $permalink_text, $post);\n```\n\n### Municipio/search_form/…\nFilters applied to the search form\n\n- ```@param string $var``` - The content of the variable\n\n```php\napply_filters('Municipio/search_form/action', $url);\n```\n\n### Municipio/archive/sort_keys\nModify the avaiable sorting keys for archives\n\n- ```@param array $keys``` - The keys\n- ```@param string $postType``` - The post type\n\n```php\napply_filters('Municipio/archive/sort_keys', $keys, $postType);\n```\n\n### Municipio/archive/date_filter\nModify the date filter WHERE clause\n\n- ```@param string $where``` - The sql WHERE clause\n- ```@param string $from``` - The \"from\" date from querystring\n- ```@param string $to``` - The \"to\" date from querystring\n\n```php\napply_filters('Municipio/archive/date_filter', $where, $from, $to);\n```\n\n### Municipio/Breadcrumbs\nShow/hide (true/false) breadcrumbs\n\n- ```@param boolean $bool```- True or false (show or hide)\n\n```php\napply_filters('Municipio/Breadcrumbs', $bool, get_queried_object())\n```\n\n### Municipio/Breadcrumbs/Items\nFilter the items/links in the breadcrumb\n\n- ```@param array $items``` - The breadcrumb items\n\n```php\napply_filters('Municipio/Breadcrumbs/Items', $items, get_queried_object());\n```\n\n### Municipio/admin/editor_stylesheet\nChange custom editor stylesheet\n\n- ```@param string $url``` - The stylesheet url\n\n```php\napply_filters('Municipio/admin/editor_stylesheet', $url);\n```\n\n### Municipio/oembed/should_filter_markup\nDecide if oembed markup should be filtered to HbgPrime video player (youtube and vimeo) or not.\n\n- ```@param string $url``` - The resource url\n- ```@param int $postId``` - Id of the current post\n\n```php\napply_filters('Municipio/oembed/should_filter_markup', true, $url, $postId);\n```\n\n\n### Municipio/Menu/Vertical/EnabledSidebars\nDictates what sidebars that sould be active on the current page to show the vertical menu. Simple array containing the sidebar id's.\n\n- ```@param array $sidebars``` - An flat array with sidebar id's.\n\n```php\napply_filters('Municipio/Menu/Vertical/EnabledSidebars', $sidebars);\n```\n\n### Municipio/archive/tax_query\nAdditional taxonomy queries.\n\n- ```@param array $taxQuery``` - Holds the taxonomy query.\n- ```@param object $query``` - Current query object.\n\n```php\napply_filters('Municipio/archive/tax_query', $taxQuery, $query);\n```\n\n### Municipio/taxonomy/tag_style\nAdds custom style to taxonomy labels.\n\n- ```@param string $style``` - Custom CSS.\n- ```@param string $term``` - The term.\n- ```@param string $taxonomy``` - Taxonomy.\n\n```php\napply_filters('Municipio/taxonomy/tag_style', $style, $term, $taxonomy);\n```\n\n### Municipio/Menu/Vertical/Items\nItems that should be visible in the vertical navigation menus. Represented as dots with hover-labels.\n\n- ```@param array $items``` - An array with items representing links.\n\n```php\napply_filters('Municipio/Menu/Vertical/EnabledSidebars', array(array('title' =\u003e 'Page section title', 'link' =\u003e '#anchorlink'));\n```\n\n### Municipio/ContentType/schemaParams\n\nModify the schema parameters for a content type. This filter is applied to the array of schema parameters associated with a content type, allowing for the extension or modification of the structured data (schema.org) attributes for that content type.\n\n- `@param array $schemaParams` - The default schema parameters for the content type.\n- `@param string $contentTypeKey` - The key identifying the content type.\n\n```php\nadd_filter('Municipio/ContentType/schemaParams', function($schemaParams, $contentTypeKey) {\n    if ($contentTypeKey === 'yourContentTypeKey') {\n        $schemaParams['newParameter'] = [\n            'schemaType' =\u003e 'Text',\n            'value' =\u003e 'Custom Value'\n        ];\n    }\n\n    return $schemaParams;\n}, 10, 2);\n```\n### Municipio/Controller/SingularContentType/listing\n\nModifies the listing array for the Place content type by appending location-related list items. This allows for the inclusion of additional information such as street name or a Google Maps link directly within the listing display.\n\n- `@param array $listing` - The existing listing array that will be modified.\n- `@param array $fields` - The fields associated with the post, used to extract location information.\n\n```php\nadd_filter('Municipio/Controller/SingularContentType/listing', function($listing, $fields) {\n    // Example modification to the listing array\n    if (!empty($fields['custom_field'])) {\n        $listing['custom_field'] = $fields['custom_field'];\n    }\n\n    return $listing;\n}, 10, 2);\n```\n\n### Municipio/DecoratePostObject\n\nFilters the PostObject instance after it has been constructed and decorated.\n\nThis filter allows developers to further modify or decorate the PostObject instance before it is returned by the factory. It is useful for injecting additional behavior, properties, or wrappers around the PostObject, enabling extensibility and customization of the post object representation throughout the application.\n\n- `@param \\Municipio\\PostObject\\PostObjectInterface $postObject` - The decorated PostObject instance to be filtered.\n- `@return \\Municipio\\PostObject\\PostObjectInterface` - The (potentially further) decorated PostObject instance.\n\n```php\nadd_filter('Municipio/DecoratePostObject', function(PostObjectInterface $postObject):PostObjectInterface {\n    // Example: Add custom decorator or modify the post object\n    return new MyCustomPostObjectDecorator($postObject);\n});\n```\n\n## REST routes\nThe following REST API routes are available from the theme.\n\n### ```[GET] municipio/v1/view/render/{view}```\nReturns html for the\n* ```@param string $view``` - Path to the blade view to be rendered. Appended to the route.\n* ```@param object $data``` - Data to be passed to the view.\n\nExample usage\n```typescript\nfetch('/wp-json/municipio/v1/view/render/partials/preloader')\n    .then((response) =\u003e console.log(response))\n```\n\n## Dev mode\nTo load assets from local styleguide. Set contant DEV_MODE to \"true\"\n\n```php\ndefine('DEV_MODE', true);\n```\n\n## Theme fonts\nMunicipio is integrated with google web-fonts. It enables smart loading of fonts preventing invisible fonts using Google \u0026 Adobe webfont loader.\n\n```php\ndefine('WEB_FONT', 'Roboto'); //The google fonts name (without weights)\ndefine('WEB_FONT_REMOTE', true); //Load font kit from cdn\n```\n# Version 2.0\nThe goal of version 2.0 is to restructure the theme frontend and move towards the BEM (IT) standard for markup. More filters will be added in a automatic manner, mutch like ACF doe's it. These will for now, be documented below.\n\n## Deprecated functionality (notice phase)\nVersion 2.0 will introduce some warnings aboute the removal of some prevoius functionality. According to plan, this functionality will be actually be removed in version 3.0. Functions that will be removed in 3.0 are.\n\n- Gravitiforms optimizations\n- Honeypot functionality for comments (this will be moved to separate plugin). Will also include google recaptcha.\n- Contact widget (replacement avabile in modularity)\n- RichText Widget (replacement embedded in core)\n- PostType \u0026 Taxonomy creator (move to plugin)\n- Upload filters (move to plugin)\n\n## Filters\n\n### Deprecated filters\n- HbgBlade/data replaced with Municipio/viewData\n- Municipio/ajax_url_in_head replaced with Municipio/ajaxUrl\n- Modularity/CoreTemplatesSearchPaths\n\n### Blade view filter\nAll variables sent (created) in a controller will automatically go trough a filter named with the variable key.\n\n```php\napply_filters('Municipio/{{KEY}}', $var);\n```\n\n## Global view filter\nYou may prefer to get a full array of everything sent to a view. After the filter above has run, a global filter will be applied. This replaces the old  filter.\n\n```php\napply_filters('Municipio/viewData', $var);\n```\n## Constants\nMUNICIPIO_FRAGMENT_CACHE - Set to false to remove fragment cache.\n\n## Theme view structure\n\n```\nbem-views\n│   [Main folder for  theme views, containing WordPress templates like page.blade.php]\n│\n└───components\n│   │   [Components for the theme like card.blade.php]\n│   │\n└───partials\n│   │   [Big chunks that are reused in templates footer.blade.php]\n│   │\n└───templates\n    │   [General templates that are included in main WordPress views like master.blade.php]\n│   │\n└───utilities\n    │   [Small pieces used by components like button.blade.php]\n│   │\n└───widgets\n    │   [Widgetized components]\n    │\n\n```\n\n## PHP Tests\nMunicipio uses [PHPUnit](https://phpunit.de/) for unit testing. For mocking and stubbing we use [WP_Mock](https://wp-mock.gitbook.io/). This means that you can use WP_Mock, [Mockery](https://github.com/mockery/mockery)(since this is a wrapper for WP_Mock) and PHPUnit_MockObject for mocking and stubbing.\n\n### PHPUnit Tests file structure\nAll tests are stored in the `tests/phpunit/tests` folder. The file structure should mirror the file structure of the theme. The file name should be the same as the file you want to test. For example, if you want to test the file `src/Controller/Base.php` you should create the file `tests/phpunit/tests/Controller/Base.php`. To avoid having too large test files, you can instead create a folder with the same name as the file you want to test and put the test files inside. Please note that for separating files by which class function you are testing, you should name the file e.g. `Base.functionName.php`.\n\n### Running PHPUnit tests\nRun `composer test` in the terminal.\n\n### Running PHPUnit tests with code coverage\nRun `composer test:coverage` in the terminal. This will generate a code coverage report in the `tests/phpunit/.coverage` folder.\n\n## Image compression\nMunicipio supports image compression with shortpixel. This will enque a cronjob with a slight delay to compress newly uploaded images. Simpley define SHORTPIXEL_API_KEY constant in your config file and that's it!\n\nCompression level will be medium/glossy for high quality photos.\n\n## Tested with support from BrowserStack\nThis software is tested with the awesome tools from Browserstack.\n\n\u003ca href=\"https://browserstack.com\"\u003e\u003cimg src=\"https://utveckling.helsingborg.se/wp-content/uploads/sites/19/2018/09/browserstack-logo.png\"/\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelsingborg-stad%2FMunicipio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelsingborg-stad%2FMunicipio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelsingborg-stad%2FMunicipio/lists"}