343

Product support

Visit this product's website for support.

Categories

Adds towns to states managed by RainLab.Location plugin. Be sure you have RainLab.Location plugin installed.

Plugin includes:

  • 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:

Town component

To override Town detail template just create partial file /town/default.htm as copy of /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 created above:

Towns component

To override Towns listing template just create partial file /towns/default.htm as copy of /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:

Towns in sitemap

Services

List of available services provided by plugin:

Locationtowns service

$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;

Extending plugin

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.

Contributing

Do you want some extra feature or fix bug? Send me pull request or create issue, please.

Code check

Codacy

License

LocationTown plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform.

Icon made by Freepik from www.flaticon.com.

1.0.8

Add form_select_town markup and TownModel Behavior, thanks to Alvaro Cánepa

Jul 28, 2019

1.0.7

Add composer.json, minor fixes for OctoberCMS stable release

Jul 12, 2016

1.0.6

Fix YAML config paths for last OctoberCMS build

Apr 11, 2016

1.0.5

Add cs_CZ locale

Feb 27, 2016

1.0.4

Make all fields and labels translatable

Feb 27, 2016

1.0.3

Fix backend form and listing labels

Feb 23, 2016

1.0.2

Add localization for Brazil Portuguese, thanks to Amanda Tresbach

Feb 22, 2016

1.0.1

First version of LocationTown

Jan 25, 2016