Download the PHP package fromholdio/silverstripe-superlinker without Composer
On this page you can find all versions of the php package fromholdio/silverstripe-superlinker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fromholdio/silverstripe-superlinker
More information about fromholdio/silverstripe-superlinker
Files in fromholdio/silverstripe-superlinker
Package silverstripe-superlinker
Short Description Superlinker
License BSD-3-Clause
Homepage https://github.com/fromholdio/silverstripe-superlinker
Informations about the package silverstripe-superlinker
SilverStripe SuperLinker
A powerful, extensible link management system for SilverStripe that provides a unified interface for creating and managing all types of links in your CMS.
Table of Contents
- Overview
- Why SuperLinker?
- Requirements
- Installation
- Core Concepts
- Quick Start
- Link Types
- Configuration
- Usage
- Optional Features
- Dependencies
- Implementation Modules
- API Reference
- Real-World Examples
- Migration
- License
Overview
SuperLinker is a comprehensive link management system that replaces fragmented link handling with a single, extensible DataObject. It provides:
- 8 built-in link types: SiteTree, External, Email, Phone, File, System, GlobalAnchor, Null
- Extensible architecture: Add custom link types via extensions
- Optional features: Description, Icon, Image support
- Consistent UX: Same interface for all link types
- Type-specific settings: Configure behavior per link type
- Automatic validation: Link health checks and orphan detection
- Template helpers: isCurrent(), isSection(), LinkingMode()
- Flexible rendering: Type-specific templates
Why SuperLinker?
Before SuperLinker, managing links in SilverStripe meant:
- Multiple incompatible link modules (Linkable, etc.)
- Inconsistent UX across different link types
- Difficult to add new link types
- No unified validation or health checks
- Fragmented template rendering
With SuperLinker, you get:
- Single DataObject for all link types
- Consistent CMS interface
- Easy extension with new types
- Built-in validation and health checks
- Unified template rendering
- Type-specific configuration
Requirements
- SilverStripe CMS ^6.0
- PHP 8.1+
Core Dependencies
- fromholdio/silverstripe-dbhtmlanchors ^2.1.0
- fromholdio/silverstripe-dependentgroupeddropdownfield ^4.0.0
- fromholdio/silverstripe-externalurlfield ^2.0.0
- fromholdio/silverstripe-globalanchors ^2.1.0
- fromholdio/silverstripe-minigridfield ^2.0.0
- fromholdio/silverstripe-systemlinks ^2.0.0
- innoweb/silverstripe-international-phone-number-field ^6.0.0
- unclecheese/display-logic ^4.0.0
Installation
Run dev/build:
Core Concepts
Link Types
A link type defines a category of link (e.g., 'sitetree', 'external', 'email'). Each type:
- Has a unique key (e.g., 'sitetree')
- Provides its own fields and validation
- Can have type-specific settings
- Is implemented via Extension
Type Extensions
Link types are added via SuperLinkTypeExtension subclasses that:
- Define the type key and label
- Add database fields for the type
- Provide CMS fields
- Implement URL generation logic
- Handle validation
Settings
Settings control optional features:
link_text- Custom link text fieldopen_in_new- Open in new tab optionno_follow- SEO nofollow optionlink_description- Description field (optional extension)link_image- Image upload (optional extension)icon- Icon upload (optional extension)
Settings can be enabled globally or per-type.
Link Health
SuperLinker tracks link health:
- Valid: Has type, type is available, not orphaned, not empty
- Orphaned: Container object doesn't exist (future feature)
- Empty: No URL generated
Template Rendering
Links render via templates with fallback chain:
Quick Start
1. Basic has_one Relation
2. Add CMS Fields
3. Use in Templates
Or with custom markup:
4. has_many Relations
Link Types
SiteTree Link
Links to pages within your SilverStripe site.
Features:
- TreeDropdownField for page selection
- Optional anchor selection (page content + global anchors)
- isCurrent() and isSection() support
- Configurable tree root
Configuration:
Usage:
External Link
Links to external URLs.
Features:
- ExternalURLField with validation
- Protocol/scheme validation
- Query string and fragment support
- Internal URL blocking (optional)
Configuration:
Email Link
Creates mailto: links with optional subject and body.
Features:
- Email validation
- Optional CC/BCC fields
- Subject and body fields
- Automatic mailto: URL generation
Configuration:
Phone Link
Creates tel: links for phone numbers.
Features:
- International phone number field
- Automatic formatting
- tel: URL generation
Usage:
File Link
Links to files in the assets folder.
Features:
- TreeDropdownField or UploadField
- Force download option
- Configurable starting folder
- Upload enable/disable
Configuration:
Usage:
System Link
Links to system routes (login, logout, etc.).
Features:
- Dropdown of configured system links
- Dynamic URL generation
- Special URL processing ($Login, $Logout, etc.)
Configuration:
Usage:
Global Anchor Link
Links to globally-defined page anchors.
Features:
- Dropdown of configured anchors
- Relative or absolute URL generation
- Current page context awareness
Configuration:
Usage:
Null Link
Text-only, no actual link.
Features:
- Displays text without href
- Useful for disabled menu items
- No URL generated
Usage: Automatically renders as text without <a> tag.
Configuration
Enabling/Disabling Link Types
Type-Specific Settings
Global Settings
Custom Type Configuration
Usage
In PHP
Getting Link Data
Adding CSS Classes
Filtering Valid Links
In Templates
Basic Usage
With Attributes
Looping Links
With Linking Mode
Type-Specific Rendering
Custom Templates
Create type-specific templates:
templates/Fromholdio/SuperLinker/Model/SuperLink_external.ss:
templates/Fromholdio/SuperLinker/Model/SuperLink_file.ss:
templates/Fromholdio/SuperLinker/Model/SuperLink.ss (fallback):
Optional Features
Description Extension
Add description field to links.
Installation:
Configuration:
Usage:
Templates:
Auto-Generated Descriptions:
For SiteTree and File links, implement on target:
Icon Extension
Add icon upload to links.
Installation:
Configuration:
Usage:
Templates:
Image Extension
Add image upload to links.
Installation:
Configuration:
Usage:
Templates:
Auto-Generated Images:
For SiteTree links:
Apply helper extensions:
Dependencies
SuperLinker relies on several companion modules that provide specific functionality.
SystemLinks
Purpose: Define static system links (login, logout, etc.) for use in templates and CMS.
Installation: Included with SuperLinker
Configuration:
Special URLs:
$Login- Automatically resolves to Security::login_url()$Logout- Automatically resolves to Security::logout_url() with token$LostPassword- Automatically resolves to Security::lost_password_url()
Usage in Templates:
Usage in PHP:
Documentation: See vendor/fromholdio/silverstripe-systemlinks/README.md
GlobalAnchors
Purpose: Define static global HTML anchors for use across the site.
Installation: Included with SuperLinker
Configuration:
Usage in Templates:
Usage in PHP:
Documentation: See vendor/fromholdio/silverstripe-globalanchors/README.md
RelativeURLField
Purpose: Form field for entering URL slugs with collision detection.
Installation: Included with SuperLinker
Features:
- Base URL display
- Collision checking against SiteTree
- Query string support (optional)
- Full path support (optional)
- Auto-incrementing on collision
Usage:
Documentation: See vendor/fromholdio/silverstripe-relativeurlfield/README.md
HasOneEdit
Purpose: Inline editing of has_one relations.
Installation: Included with SuperLinker
Usage:
Note: This module is aging and may be replaced in future versions.
Documentation: See vendor/fromholdio/silverstripe-hasoneedit/README.md
Other Dependencies
- DBHTMLAnchors: Extracts anchors from HTML content
- DependentGroupedDropdownField: Dropdown that depends on another field
- ExternalURLField: URL field with validation
- MiniGridField: Compact GridField for has_many relations
- InternationalPhoneNumberField: Phone number field with formatting
Implementation Modules
SuperLinker provides base functionality. These modules extend it for specific use cases.
superlinker-ctas
Purpose: Call-to-Action / Button DataObjects
Status: Superseded by SuperLinker v3+. For new projects, create custom subclasses as needed.
Installation:
What it provides:
CTAclass extendingSuperLink- Pre-configured for button/CTA use cases
Usage:
Documentation: See vendor/fromholdio/silverstripe-superlinker-ctas/README.md
superlinker-redirection
Purpose: Redirector pages using SuperLink targets
Installation:
What it provides:
RedirectionPage- Replacement for core RedirectorPageRedirectionDataObject - Standalone redirects- Admin interface for managing redirects
- Support for all SuperLink types as targets
Features:
- Redirect to any link type (not just internal/external)
- HTTP status code selection (301, 302, 303, 307, 308)
- Redirect from custom URL paths
- Collision detection
- Hidden from site tree
Usage:
Documentation: See vendor/fromholdio/silverstripe-superlinker-redirection/README.md
superlinker-targets
Purpose: Basic link/target DataObjects
Installation:
What it provides:
Targetclass extendingSuperLink- Generic link objects for various uses
Usage:
Documentation: See vendor/fromholdio/silverstripe-superlinker-targets/README.md
API Reference
SuperLink Core Methods
Link Information
URL Methods
Link Health
HTML Attributes
Settings
Template Helpers
CMS Fields
Type Extension Methods
SiteTreeLink
ExternalLink
EmailLink
PhoneLink
FileLink
SystemLink
GlobalAnchorLink
Optional Extension Methods
SuperLinkDescriptionExtension
SuperLinkIconExtension
SuperLinkImageExtension
Real-World Examples
Example 1: Navigation Menu with SuperLinks
Template:
Example 2: CTA Buttons with Images
Template:
Example 3: Footer Links with Icons
Template:
Example 4: Custom Link Type
Create a custom link type for YouTube videos:
Apply extension:
Example 5: Versioned SuperLinks
For versioned content:
Migration
From Linkable or Similar Modules
-
Install SuperLinker:
-
Update DataObject Relations:
-
Update CMS Fields:
-
Update Templates:
-
Run dev/build:
- Migrate Data: Write a migration task to convert existing link data to SuperLink format.
License
BSD-3-Clause
Support
- GitHub: https://github.com/fromholdio/silverstripe-superlinker
- Issues: https://github.com/fromholdio/silverstripe-superlinker/issues
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.
Credits
Developed by Luke Fromhold
All versions of silverstripe-superlinker with dependencies
fromholdio/silverstripe-dbhtmlanchors Version ^2.1.0
fromholdio/silverstripe-dependentgroupeddropdownfield Version ^4.1.0
fromholdio/silverstripe-externalurlfield Version ^2.0.0
fromholdio/silverstripe-globalanchors Version ^2.1.0
fromholdio/silverstripe-minigridfield Version ^2.0.0
fromholdio/silverstripe-systemlinks Version ^2.0.0
innoweb/silverstripe-international-phone-number-field Version ^6.0.2
unclecheese/display-logic Version ^4.0.0