PHP code example of fromholdio / silverstripe-relativeurlfield

1. Go to this page and download the library: Download fromholdio/silverstripe-relativeurlfield 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/ */

    

fromholdio / silverstripe-relativeurlfield example snippets



$field = RelativeURLField::create('FieldName', 'Field Title');

// available toggles/settings
$field->setBaseURL();                           // The base URL that the user-entered value is relative to. Defaults to Director::absoluteBaseURL().
$field->setBaseURLBySiteTree();                 // Pass a SiteTree object here, to use it's AbsoluteLink as the BaseURL (useful for Multisites for example, pass the Site object).
$field->setIsQueryStringAllowed();              // Can user