2017 © Pedro Peláez
 

silverstripe-module silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects.

image

briceburg/silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects.

  • Wednesday, July 15, 2015
  • by briceburg
  • Repository
  • 0 Watchers
  • 3 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 3 Forks
  • 4 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects., (*1)

Features

  • schema.org microdata templating
  • extend any DataObject
  • reduces administrative repetitiveness and improves consistency through many_many relationships
  • extensible through YAML Configuration and subclassing

Requirements

The venerable GridFieldExtensions https://github.com/ajshort/silverstripe-gridfieldextensions, (*2)

Tested in SilverStripe 3.1, (*3)

Screenshots

editing, (*4)

list, (*5)

Usage

  • Add address and phone numbers to your Objects by extending them with FlexiAddressExtension.
class Office extends Page
{

    private static $extensions = array(
        'FlexiAddressExtension'
    );

}
  • Trigger the environment builder (/dev/build) after extending your objects -- You will now see the Address tab when editing Office in the CMS.

Front-end

FlexiAddress provides a shortcut to return the first address associated. Here's an example Office.ss, (*6)

```html


$Title

... $FlexiAddress
...

You can also loop through addresses. Here's an example Office.ss, (*7)



$Title

...

Address

Get Directions ...

You may, as always, override the built-in templates by adding them to your theme and changing markup as needed., (*8)

Limiting Fields

You may find the built-in address fields a bit too much. Here's a few strategies to limit them;, (*9)

  • Strategy 1: Globally via mysite/config/config.yml
---

FlexiAddressExtension:
  flexiaddress_fields:
    - StreetLine1
    - City
    - PhoneNumbers
  • Strategy 2: Via the $flexiaddress_fields property on extended classes

class Office extends Page { protected static $flexiaddress_fields = array( 'StreetLine1', 'City', 'PhoneNumbers' ); }
---

Office:
  flexiaddress_fields:
    - StreetLine1
    - City
    - PhoneNumbers

Changing the Address Tab Name

By default, flexiaddress adds its GridField to the Root.Address tab. You can configure this in a couple of ways;, (*10)

---

# Global Change
FlexiAddressExtension:
  flexiaddress_tab: Root.Addresses

# Class Specific
Office:
  flexiaddress_tab: Root.Main
  flexiaddress_insertBefore: Content

  • Strategy 2: Through your extended class

class Office extends Page { // Option 1 - properties //////////////////////// protected static $flexiaddress_tab = 'Root.Main'; protected static $flexiaddress_insertBefore = 'Content'; // Option 2 - via Config::inst()->update //////////////////////////////////////// public function getCMSFields() { $this->set_stat('flexiaddress_tab', 'Root.Addresses'); return parent::getCMSFields(); } }

Changing the Add New GridField Button

If you don't like "Create New Address", follow the Changing the Address Tab Name procecedure, but alter the flexiaddress_addButton propperty., (*11)

The Versions

15/07 2015

dev-master

9999999-dev https://github.com/briceburg/silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

address cms manage silverstripe contact gridfield phone flexi phone numbers

15/07 2015

0.2.0

0.2.0.0 https://github.com/briceburg/silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

address cms manage silverstripe contact gridfield phone flexi phone numbers

02/12 2014

0.1.0

0.1.0.0 https://github.com/briceburg/silverstripe-flexiaddress

Add microdata friendly addresses and phone numbers to your SilverStripe objects.

  Sources   Download

BSD-3-Clause

The Requires

 

by Brice Burgess

address cms manage silverstripe contact gridfield phone flexi phone numbers