dev-master
9999999-devSilverStripe Link Field
BSD-3-Clause
The Requires
by IQnection
module pages iqnection
1.0.x-dev
1.0.9999999.9999999-devSilverStripe 3 Link Field
The Requires
by IQnection
pages iqnection
SilverStripe Link Field
Works just like the RedirectorPage URL/Page field Provides and interface for creating an internal or external link. Internal link provides a TreeDropdownField for selecting a page within the site tree External provides a text field for entering the full URL Also provides availability to store opening in a new tab, (*1)
Silverstripe 4+, (*2)
composer require iqnection-modules/linkfield, (*3)
private static $db = array( 'LinkedPage' => 'Link' );
$fields->push( IQnection\LinkField\LinkField::create($name,$title) );
setValue() expects either an array or serialized array of the following:, (*4)
array( 'Location' => string ['Internal' | 'External'] (required) 'Internal' => int [SiteTree Page ID] 'External' => string [external URL | null], 'NewTab' => [bool] );
<a href="$LinkedPage">Link Text</a>
the raw entered URL for External, or $Page->Link() for internal, (*5)
an absolute URL for external (adds http://), or $Page->AbsoluteLink() for internal, (*6)
for internal only, returns the linked page SiteTree object, (*7)
returns URL(), (*8)
returns bool, if the link is external, (*9)
returns string, the location set as either Internal or External, (*10)
returns _blank or self for use in a target HTML attribute, (*11)
returns a full target attribute, for new tab only [target="_blank"] pass $force=true to return attribute for both new tab and same tab, (*12)
SilverStripe Link Field
BSD-3-Clause
module pages iqnection
SilverStripe 3 Link Field
pages iqnection