planetadeleste / wn-locationtowns-plugin
Adds towns to states managed by Winter.Location plugin.
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:winter-plugin
Requires
- php: >=7.0
- composer/installers: ~1.0
This package is auto-updated.
Last update: 2024-10-28 17:05:01 UTC
README
This plugin is a fork of VojtaSvoboda.LocationTown, migrated to WinterCMS
Adds towns to states managed by Winter.Location plugin. Included:
- component for state towns with pagination
- component for Town detail
- hooks for Winter.Sitemap
- extends Winter State model
Required plugins: Winter.Location.
Tested with the latest stable WinterCMS 1.1.3.
Render Town detail
This component render town detail. Just create page Town-detail with slug
/town-detail/:slug?
and insert Town component:
To override Town detail template just create partial file /town/default.htm
as copy
of /plugins/planetadeleste/components/town/default.htm
and make own changes.
Render list of Towns
Create page Towns with slug /towns/:page?
where page means paginating. Insert
component Towns. Set filter for State and select page for show Town detail
created above:
To override Towns listing template just create partial file /towns/default.htm
as copy
of /plugins/planetadeleste/components/towns/default.htm
and make own changes.
Add towns to sitemap
Just install Winter.Sitemap plugin and insert one town or all towns to sitemap:
Services
List of available services provided by plugin:
locationtowns service
$towns = App::make('locationstown');
$town = $towns->findOneBySlug('praha');
$allTowns = $towns->all();
$townsByState = $towns->where('state_id', 285)->get();
Winter State extension
$state = \Winter\Location\Models\State::find('285');
$towns = $state->towns;
TODO
- !!fix fixed URL path at Town:114 and Town:129 (there should by path set in component)
- !filter only by active states in towns component
- directly extend Winter.Location.State form to manage towns related to this state
- run plugin without Winter.Location (only town management)
- add select box 'country' to backend listing for filtrating states
- it is not possible to do october:down
- add import and export
Feel free to send pullrequest!
Contributing
Please send Pull Request to master branch.
License
LocationTown plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform.