Link
        
        extends DataObject
    
    
            
            in package
            
        
    
    
    
Link
Tags
Table of Contents
Properties
- $classes : string
- $template_style : string
- $allowed_types : array<string|int, mixed>
- List the allowed included link types. If null all are allowed.
- $casting : array<string|int, mixed>
- Ensures that the methods are wrapped in the correct type and values are safely escaped while rendering in the template.
- $db : array<string|int, mixed>
- Database fields
- $gql_fields : mixed
- Provides a quick way to define additional methods for provideGraphQLScaffolding as Fields
- $gql_nested_queries : array<string|int, mixed>
- Provides a quick way to define additional methods for provideGraphQLScaffolding as Nested Queries
- $has_one : array<string|int, mixed>
- Has_one relationship
- $link_to_folders : bool
- If false, when Type is "File", folders in the TreeDropdownField will not be selectable.
- $linking_mode_current : string
- $linking_mode_default : string
- $linking_mode_section : string
- $owns : mixed
- $searchable_fields : array<string|int, mixed>
- Defines a default list of filters for the search context
- $styles : array<string|int, mixed>
- A map of styles that are available in the cms for users to select from.
- $summary_fields : array<string|int, mixed>
- Defines summary fields commonly used in table columns as a quick overview of the data for this dataobject
- $table_name : string
- Defines the database table name
- $types : array<string|int, mixed>
- A map of object types that can be linked to Custom dataobjects can be added to this
Methods
- addExtraClass() : Link
- Set CSS classes for templates
- baseClassName() : string
- Returns the base class without namespacing
- canCreate() : bool
- canDelete() : bool
- canEdit() : bool
- canView() : bool
- File() : File
- forTemplate() : DBHTMLText
- Renders an HTML anchor attribute for this link
- getClass() : string
- Returns the css classes
- getClassAttr() : HTMLFragment
- Returns the html class attribute
- getCMSFields() : FieldList
- CMS Fields
- getCMSMainFields() : array<string|int, mixed>
- CMS Main fields This is so other modules can access these fields without other tabs etc.
- getCurrentPage() : Controller
- Returns the current page scope
- geti18nStyles() : array<string|int, mixed>
- Returns available styles with translations
- geti18nTypes() : array<string|int, mixed>
- Returns allowed link types with translations
- getIDAttr() : HTMLFragment
- Renders an HTML ID attribute
- getIDValue() : string
- Returns the html id attribute
- getLayout() : string
- Renders an HTML anchor tag for this link This is an alias to {@link forTemplate()}
- getLinkURL() : string
- Works out what the URL for this link should be based on it's Type
- getRenderTemplates() : array<string|int, mixed>
- Returns a list of rendering templates
- getStyle() : Link
- Get style defined by the template or admin
- getStyles() : array<string|int, mixed>
- Returns available styles
- getTarget() : string
- Returns the html target attribute
- getTargetAttr() : HTMLFragment
- Returns the html target attribute
- getTypeLabel() : string
- Returns the description label of this links type
- getTypes() : array<string|int, mixed>
- Returns allowed link types
- gqlFields() : array<string|int, mixed>
- Provides a quick way to define additional methods to provideGraphQLScaffolding as Fields
- gqlNestedQueries() : array<string|int, mixed>
- Provides a quick way to define additional methods to provideGraphQLScaffolding as Nested Queries
- isCurrent() : bool
- Returns true if this is the currently active page being used to handle this request.
- isOrphaned() : bool
- Check if the parent of this page has been removed (or made otherwise unavailable), and is still referenced by this child. Any such orphaned page may still require access via the CMS, but should not be shown as accessible to external users.
- isSection() : bool
- Check if this page is in the currently active section (e.g. it is either current or one of its children is currently being viewed).
- LinkingMode() : string
- Return "link", "current" or "section" depending on if this page is the current page, or not on the current page but in the current section.
- LinkOrCurrent() : string
- Return "link" or "current" depending on if this is the {@link Link::isCurrent()} current page.
- LinkOrSection() : string
- Return "link" or "section" depending on if this is the {@link Link::isSection()} current section.
- onBeforeWrite() : mixed
- Event handler called before writing to the database.
- setAllowedTypes() : Link
- Sets allowed link types
- setClass() : Link
- This is an alias to {@link addExtraClass()}
- setStyle() : Link
- Set style used for
- validate() : ValidationResult
- Validate
Properties
$classes
    protected
        string
    $classes
     = []
    
        custom CSS classes for template
$template_style
    protected
        string
    $template_style
    
    
        custom style for template typically defined by the template.
$allowed_types
List the allowed included link types. If null all are allowed.
    private
    static    array<string|int, mixed>
    $allowed_types
     = null
    
    
    
$casting
Ensures that the methods are wrapped in the correct type and values are safely escaped while rendering in the template.
    private
    static    array<string|int, mixed>
    $casting
     = ['ClassAttr' => 'HTMLFragment', 'TargetAttr' => 'HTMLFragment', 'IDAttr' => 'HTMLFragment']
    
    
    
$db
Database fields
    private
    static    array<string|int, mixed>
    $db
     = ['Title' => 'Varchar', 'Type' => 'Varchar(50)', 'URL' => 'Text', 'Email' => 'Varchar', 'Phone' => 'Varchar(30)', 'OpenInNewWindow' => 'Boolean', 'SelectedStyle' => 'Varchar']
    
    
    
$gql_fields
Provides a quick way to define additional methods for provideGraphQLScaffolding as Fields
    private
    static    mixed
    $gql_fields
     = []
    
    
    
$gql_nested_queries
Provides a quick way to define additional methods for provideGraphQLScaffolding as Nested Queries
    private
    static    array<string|int, mixed>
    $gql_nested_queries
     = []
    
    
    
$has_one
Has_one relationship
    private
    static    array<string|int, mixed>
    $has_one
     = ['File' => \SilverStripe\Assets\File::class]
    
    
    
$link_to_folders
If false, when Type is "File", folders in the TreeDropdownField will not be selectable.
    private
    static    bool
    $link_to_folders
     = false
    
    
    
    Tags
$linking_mode_current
    private
    static    string
    $linking_mode_current
     = 'current'
    
    
    
    Tags
$linking_mode_default
    private
    static    string
    $linking_mode_default
     = 'link'
    
    
    
    Tags
$linking_mode_section
    private
    static    string
    $linking_mode_section
     = 'section'
    
    
    
    Tags
$owns
    private
    static    mixed
    $owns
     = ['File']
    
    
    
$searchable_fields
Defines a default list of filters for the search context
    private
    static    array<string|int, mixed>
    $searchable_fields
     = ['Title', 'URL', 'Email', 'Phone']
    
    
    
$styles
A map of styles that are available in the cms for users to select from.
    private
    static    array<string|int, mixed>
    $styles
     = []
    
    
    
$summary_fields
Defines summary fields commonly used in table columns as a quick overview of the data for this dataobject
    private
    static    array<string|int, mixed>
    $summary_fields
     = ['Title' => 'Title', 'TypeLabel' => 'Type', 'LinkURL' => 'Link']
    
    
    
$table_name
Defines the database table name
    private
    static    string
    $table_name
     = 'Link'
    
    
    
$types
A map of object types that can be linked to Custom dataobjects can be added to this
    private
    static    array<string|int, mixed>
    $types
     = ['URL' => 'URL', 'Email' => 'Email address', 'Phone' => 'Phone number', 'File' => 'File on this website']
    
    
    
Methods
addExtraClass()
Set CSS classes for templates
    public
                    addExtraClass(string $class) : Link
    Parameters
- $class : string
- 
                    CSS classes. 
Return values
LinkbaseClassName()
Returns the base class without namespacing
    public
                    baseClassName(string $class) : string
    Parameters
- $class : string
Return values
stringcanCreate()
    public
                    canCreate([Member|null $member = null ][, array<string|int, mixed> $context = [] ]) : bool
    Parameters
- $member : Member|null = null
- $context : array<string|int, mixed> = []
Return values
boolcanDelete()
    public
                    canDelete([Member|null $member = null ]) : bool
    Parameters
- $member : Member|null = null
Return values
boolcanEdit()
    public
                    canEdit([Member|null $member = null ]) : bool
    Parameters
- $member : Member|null = null
Return values
boolcanView()
    public
                    canView([Member|null $member = null ]) : bool
    Parameters
- $member : Member|null = null
Return values
boolFile()
    public
                    File() : File
    Return values
FileforTemplate()
Renders an HTML anchor attribute for this link
    public
                    forTemplate() : DBHTMLText
    Return values
DBHTMLTextgetClass()
Returns the css classes
    public
                    getClass() : string
    Return values
stringgetClassAttr()
Returns the html class attribute
    public
                    getClassAttr() : HTMLFragment
    Return values
HTMLFragmentgetCMSFields()
CMS Fields
    public
                    getCMSFields() : FieldList
    Return values
FieldListgetCMSMainFields()
CMS Main fields This is so other modules can access these fields without other tabs etc.
    public
                    getCMSMainFields() : array<string|int, mixed>
    Return values
array<string|int, mixed>getCurrentPage()
Returns the current page scope
    public
                    getCurrentPage() : Controller
    Return values
Controllergeti18nStyles()
Returns available styles with translations
    public
                    geti18nStyles() : array<string|int, mixed>
    Return values
array<string|int, mixed>geti18nTypes()
Returns allowed link types with translations
    public
                    geti18nTypes() : array<string|int, mixed>
    Return values
array<string|int, mixed>getIDAttr()
Renders an HTML ID attribute
    public
                    getIDAttr() : HTMLFragment
    Return values
HTMLFragmentgetIDValue()
Returns the html id attribute
    public
                    getIDValue() : string
    Return values
stringgetLayout()
Renders an HTML anchor tag for this link This is an alias to {@link forTemplate()}
    public
                    getLayout() : string
    Return values
stringgetLinkURL()
Works out what the URL for this link should be based on it's Type
    public
                    getLinkURL() : string
    Return values
stringgetRenderTemplates()
Returns a list of rendering templates
    public
                    getRenderTemplates() : array<string|int, mixed>
    Return values
array<string|int, mixed>getStyle()
Get style defined by the template or admin
    public
                    getStyle() : Link
    Return values
LinkgetStyles()
Returns available styles
    public
                    getStyles() : array<string|int, mixed>
    Return values
array<string|int, mixed>getTarget()
Returns the html target attribute
    public
                    getTarget() : string
    Return values
stringgetTargetAttr()
Returns the html target attribute
    public
                    getTargetAttr() : HTMLFragment
    Return values
HTMLFragmentgetTypeLabel()
Returns the description label of this links type
    public
                    getTypeLabel() : string
    Return values
stringgetTypes()
Returns allowed link types
    public
                    getTypes() : array<string|int, mixed>
    Return values
array<string|int, mixed>gqlFields()
Provides a quick way to define additional methods to provideGraphQLScaffolding as Fields
    public
                    gqlFields() : array<string|int, mixed>
    Return values
array<string|int, mixed>gqlNestedQueries()
Provides a quick way to define additional methods to provideGraphQLScaffolding as Nested Queries
    public
                    gqlNestedQueries() : array<string|int, mixed>
    Return values
array<string|int, mixed>isCurrent()
Returns true if this is the currently active page being used to handle this request.
    public
                    isCurrent() : bool
    Return values
boolisOrphaned()
Check if the parent of this page has been removed (or made otherwise unavailable), and is still referenced by this child. Any such orphaned page may still require access via the CMS, but should not be shown as accessible to external users.
    public
                    isOrphaned() : bool
    Return values
boolisSection()
Check if this page is in the currently active section (e.g. it is either current or one of its children is currently being viewed).
    public
                    isSection() : bool
    Return values
boolLinkingMode()
Return "link", "current" or "section" depending on if this page is the current page, or not on the current page but in the current section.
    public
                    LinkingMode() : string
    Return values
stringLinkOrCurrent()
Return "link" or "current" depending on if this is the {@link Link::isCurrent()} current page.
    public
                    LinkOrCurrent() : string
    Return values
stringLinkOrSection()
Return "link" or "section" depending on if this is the {@link Link::isSection()} current section.
    public
                    LinkOrSection() : string
    Return values
stringonBeforeWrite()
Event handler called before writing to the database.
    public
                    onBeforeWrite() : mixed
    If the title is empty, set a default based on the link.
setAllowedTypes()
Sets allowed link types
    public
                    setAllowedTypes([array<string|int, mixed> $types = [] ]) : Link
    Parameters
- $types : array<string|int, mixed> = []
- 
                    Allowed type names 
Return values
LinksetClass()
This is an alias to {@link addExtraClass()}
    public
                    setClass(string $class) : Link
    Parameters
- $class : string
- 
                    CSS classes. 
Return values
LinksetStyle()
Set style used for
    public
                    setStyle(string $style) : Link
    Parameters
- $style : string
Return values
Linkvalidate()
Validate
    public
                    validate() : ValidationResult