Adds towns to states managed by RainLab.Location plugin. Be sure you have RainLab.Location plugin installed.
- component for state towns with pagination
- component for Town detail
- hooks for RainLab.Sitemap
- extends RainLab State model
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
/plugins/vojtasvoboda/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
To override Towns listing template just create partial file
/towns/default.htm as copy
/plugins/vojtasvoboda/components/towns/default.htm and make own changes.
Add towns to sitemap
Just install RainLab.Sitemap plugin and insert one town or all towns to sitemap:
List of available services provided by plugin:
$towns = App::make('locationstowns'); $town = $towns->findOneBySlug('praha'); $allTowns = $towns->all(); $townsByState = $towns->where('state_id', 285)->get();
RainLab.Location State extension
Get all towns within state:
$state = \RainLab\Location\Models\State::find('285'); $towns = $state->towns;
If you want to extend some plugin and don't know how, check Brands extending examples repository, where you can find many examples which can be applied on every plugin including this one.
Do you want some extra feature or fix bug? Send me pull request or create issue, please.
LocationTown plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform.
Icon made by Freepik from www.flaticon.com.
Found the plugin useful on 28 Aug, 2019
Found the plugin useful on 17 Jan, 2018
Add form_select_town markup and TownModel Behavior, thanks to Alvaro Cánepa
Jul 28, 2019
Add composer.json, minor fixes for OctoberCMS stable release
Jul 12, 2016
Fix YAML config paths for last OctoberCMS build
Apr 11, 2016
Add cs_CZ locale
Feb 27, 2016
Make all fields and labels translatable
Feb 27, 2016
Fix backend form and listing labels
Feb 23, 2016
Add localization for Brazil Portuguese, thanks to Amanda Tresbach
Feb 22, 2016
First version of LocationTown
Jan 25, 2016