PHP code example of briceburg / silverstripe-flexiaddress

1. Go to this page and download the library: Download briceburg/silverstripe-flexiaddress library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

briceburg / silverstripe-flexiaddress example snippets


class Office extends Page
{

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

}


class Office extends Page
{

    protected static $flexiaddress_fields = array(
        'StreetLine1',
        'City',
        'PhoneNumbers'
    );
}


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();
    }
   
}