Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	lang/de.yml
#	lang/en.yml
#	lang/fr.yml
#	src/Extensions/EmailLink.php
#	src/Extensions/ExternalURLLink.php
#	src/Extensions/FileLink.php
#	src/Extensions/GlobalAnchorLink.php
#	src/Extensions/NoLink.php
#	src/Extensions/PhoneLink.php
#	src/Extensions/SiteTreeLink.php
#	src/Extensions/SystemLink.php
#	src/Model/SuperLink.php
  • Loading branch information
dizzystuff committed Jan 7, 2024
2 parents 6ae755c + 75e936f commit 873034c
Show file tree
Hide file tree
Showing 22 changed files with 1,586 additions and 1,171 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
# silverstripe-superlinker

Use master/v2.x (compatible with SS 4 & 5).

This branch is under active development. It **will** change and break, likely including namespaces.

## CMS fields testing snippets

```php
// for $has_one relation, testing inline fields
$linkFields = SuperLink::singleton()->getCMSLinkFields('SuperLink' . HasOneEdit::FIELD_SEPARATOR);
$fields->addFieldsToTab('Root.Main', $linkFields->toArray());

// for $has_one relation, testing with edit form
$fields->addFieldsToTab('Root.Main', [
HasOneMiniGridField::create(
'SuperLink',
'SuperLink',
$this
)
]);

// for $has_many relation, testing with gridfield
$linksField = MiniGridField::create(
'SuperLinks',
'Links',
$this
)->setLimit(7)->setShowLimitMessage(true);
$fields->addFieldToTab('Root.Main', $linksField);

// for the HasOne/MiniGridFields, currently adding these lines provides nicer UI
$config = $linksField->getGridConfig()?->addComponent(new GridField_ActionMenu());
$linksField->setGridConfig($config);
```

## v3 to-dos
- Validations for each link type
- Richer summary fields content
- Update MiniGridField to use GridField_ActionMenu
- Remove yml config currently in place for ease of development (convert to yml.example/readme or similar)
- `DependentDropdownField`/`DependentGroupedDropdownField` no longer detect changes from `TreeDropdownField`, so the Anchors dropdown for `SiteTreeLink` is no longer working.
- Modal for adding rather than `HasOneMiniGridField`
- Resolve indecision around handling, naming and accessors for Title vs LinkText
- Broken or empty link reporting
- Proper i18n/_t()/translations
- Permissions
- Add awareness of link container objects for orphan reporting/pruning (& potentially expanding config to container/relation)
- Migration script from v2 to v3
- Documentation/readme
- Formats/themes/styles as optional extensions
- Cleverer handling of settings/options
- Can we integrate this with a new TinyMCE plugin/button or existing ss_link?
- Apply display logic (and perhaps field sort) via yml config using linktypes x fieldnames (allowing link types to share fields rather than requiring each class to utilise its own fields)
60 changes: 60 additions & 0 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,63 @@
---
Name: fromholdio-superlinker
---

Fromholdio\SuperLinker\Model\SuperLink:
extensions:
- 'Fromholdio\SuperLinker\Extensions\EmailLink'
- 'Fromholdio\SuperLinker\Extensions\ExternalLink'
- 'Fromholdio\SuperLinker\Extensions\FileLink'
- 'Fromholdio\SuperLinker\Extensions\GlobalAnchorLink'
- 'Fromholdio\SuperLinker\Extensions\NullLink'
- 'Fromholdio\SuperLinker\Extensions\PhoneLink'
- 'Fromholdio\SuperLinker\Extensions\SiteTreeLink'
- 'Fromholdio\SuperLinker\Extensions\SystemLink'
disallowed_types:
- nolink
types:
email:
sort: 2
external:
sort: 3
phone:
sort: 4
nolink:
sort: 5
globalanchor:
sort: 7
system:
sort: 6
sitetree:
sort: 0
file:
sort: 1

Fromholdio\SuperLinker\Model\VersionedSuperLink:
extensions:
- 'Fromholdio\SuperLinker\Extensions\EmailLink'
- 'Fromholdio\SuperLinker\Extensions\ExternalLink'
- 'Fromholdio\SuperLinker\Extensions\FileLink'
- 'Fromholdio\SuperLinker\Extensions\GlobalAnchorLink'
- 'Fromholdio\SuperLinker\Extensions\NullLink'
- 'Fromholdio\SuperLinker\Extensions\PhoneLink'
- 'Fromholdio\SuperLinker\Extensions\SiteTreeLink'
- 'Fromholdio\SuperLinker\Extensions\SystemLink'
disallowed_types:
- nolink
types:
email:
sort: 2
external:
sort: 3
phone:
sort: 4
nolink:
sort: 5
globalanchor:
sort: 7
system:
sort: 6
sitetree:
sort: 0
file:
sort: 1
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"homepage": "https://fromhold.io"
}],
"require": {
"silverstripe/cms": "~4.0 || ~5.0",
"fromholdio/silverstripe-dependentgroupeddropdownfield": "^1.0.0 || ^2.0.0",
"fromholdio/silverstripe-externalurlfield": "^1.0.3",
"giggsey/libphonenumber-for-php": "^8.12.55"
"silverstripe/cms": "~5.0",
"fromholdio/silverstripe-dependentgroupeddropdownfield": "^2.0.0",
"fromholdio/silverstripe-externalurlfield": "^1.1.0",
"innoweb/silverstripe-international-phone-number-field": "^5.0.0"
},
"suggest": {
"fromholdio/silverstripe-dbhtmlanchors": "",
Expand Down
62 changes: 33 additions & 29 deletions lang/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,46 @@ de:
Fromholdio\SuperLinker\Extensions\EmailLink:
Body: Inhalt
Email: Email
EmailBCC: BCC
EmailCC: CC
MustProvideEmail: 'Sie müssen eine E-Mail-Adresse angeben'
Subject: Betreff
Fromholdio\SuperLinker\Extensions\ExternalURLLink:
ExternalURLMustBeComplete: 'Externe URLs müssen vollständig sein, einschließlich http:// oder https://'
URL: URL
Fromholdio\SuperLinker\Extensions\ExternalLink:
ExternalURL: URL
Fromholdio\SuperLinker\Extensions\FileLink:
Behaviour: Verhalten
DisplayInBrowser: 'Datei im Browserfenster anzeigen (wenn möglich)'
Download: "Datei direkt auf das Gerät des Benutzers herunterladen"
File: Datei
FileRequired: 'Sie müssen eine Datei hochladen oder auswählen, auf die Sie verlinken möchten'
Fromholdio\SuperLinker\Extensions\GlobalAnchorLink:
Anchor: Anker
AnchorRequired: 'Sie müssen einen Anker auswählen'
Fromholdio\SuperLinker\Extensions\NoLink:
NoLink: '- Kein Link -'
TitleRequired: 'Sie müssen einen Titel angeben'
GlobalAnchor: 'Globaler Anker'
Fromholdio\SuperLinker\Extensions\PhoneLink:
Phone: Telefonnummer
PhoneRequired: 'Sie müssen eine Telefonnummer angeben'
PhoneNumber: 'Telefonnummer'
Fromholdio\SuperLinker\Extensions\SiteTreeLink:
Anchor: Anker
Page: Seite
PageRequired: 'Sie müssen eine Seite auswählen, auf die Sie verlinken möchten'
PageAnchorOptional: 'Seitenanker (optional)'
PageOnThisWebsite: 'Seite auf dieser Webseite'
SelectAPage: 'Seite auswählen'
SelectAnchor: 'Anker auswählen (optional)'
SelectAnAnchor: 'Anker auswählen'
Fromholdio\SuperLinker\Extensions\SuperLinkIconExtension:
LinkIcon: Symbol
Fromholdio\SuperLinker\Extensions\SystemLink:
SystemLink: 'System-Link'
SystemLinkRequired: 'Sie müssen einen Systemlink auswählen'
Fromholdio\SuperLinker\Model\SuperLink:
CustomLinkText: 'Link Text'
DoNoFollow: 'Weisen Sie Suchmaschinen an, diesem Link nicht zu folgen'
DoOpenNewWindow: 'Link in neuem Fenster öffnen'
NewWindow: 'Neues Fenster'
OptionalWillBeGenerated: 'Optional. Wird automatisch generiert, wenn es leer gelassen wird.'
TabBehaviour: Verhalten
TabTarget: Ziel
URL: URL
URLInvalid: 'Sie müssen eine gültige URL angeben'
URLRequired: 'Sie müssen eine URL angeben'
PLURALNAME: Links
PLURALS:
one: 'Ein Link'
other: '{count} Links'
SINGULARNAME: Link
Fromholdio\SuperLinker\Model\SuperLinkTrait:
DoNoFollow: 'Suchmaschinen bitten diesen Link zu ignorieren'
DoOpenInNew: 'In neuem Fenster öffnen'
LinkText: Text
LinkType: Typ
MainTab: Basis
NotConfigured: 'Nicht konfiguriert'
OptionalAutoGenerated: 'Optional. Wird automatisch aus dem Link generiert, wenn dieses Feld leer bleibt.'
OptionsGroup: Optionen
SelectLinkType: 'Linktyp auswählen'
Fromholdio\SuperLinker\Model\VersionedSuperLink:
PLURALNAME: Links
PLURALS:
one: 'Ein Link'
other: '{count} Links'
SINGULARNAME: Link
62 changes: 33 additions & 29 deletions lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,46 @@ en:
Fromholdio\SuperLinker\Extensions\EmailLink:
Body: Body
Email: Email
EmailBCC: BCC
EmailCC: CC
MustProvideEmail: 'You must provide an Email Address'
Subject: Subject
Fromholdio\SuperLinker\Extensions\ExternalURLLink:
ExternalURLMustBeComplete: 'External URLs must be complete including http:// or https://'
URL: URL
Fromholdio\SuperLinker\Extensions\ExternalLink:
ExternalURL: URL
Fromholdio\SuperLinker\Extensions\FileLink:
Behaviour: Behaviour
DisplayInBrowser: 'Display file in browser window (when possible)'
Download: "Download file directly to user's device"
File: File
FileRequired: 'You must upload or select a file to link to'
Fromholdio\SuperLinker\Extensions\GlobalAnchorLink:
Anchor: Anchor
AnchorRequired: 'You must select an anchor'
Fromholdio\SuperLinker\Extensions\NoLink:
NoLink: '- No Link -'
TitleRequired: 'You must provide a Title'
GlobalAnchor: 'Global anchor'
Fromholdio\SuperLinker\Extensions\PhoneLink:
Phone: Phone
PhoneRequired: 'You must provide a phone number'
PhoneNumber: 'Phone number'
Fromholdio\SuperLinker\Extensions\SiteTreeLink:
Anchor: Anchor
Page: Page
PageRequired: 'You must select a page to link to'
PageAnchorOptional: 'Page anchor (optional)'
PageOnThisWebsite: 'Page on this website'
SelectAPage: 'Select a page'
SelectAnchor: 'Select an anchor (optional)'
SelectAnAnchor: 'Select an anchor'
Fromholdio\SuperLinker\Extensions\SuperLinkIconExtension:
LinkIcon: Icon
Fromholdio\SuperLinker\Extensions\SystemLink:
SystemLink: 'System Link'
SystemLinkRequired: 'You must select a system link'
Fromholdio\SuperLinker\Model\SuperLink:
CustomLinkText: 'Link Text'
DoNoFollow: 'Instruct search engines not to follow this link'
DoOpenNewWindow: 'Open link in a new window'
NewWindow: 'New Window'
OptionalWillBeGenerated: 'Optional. Will be auto-generated if left blank.'
TabBehaviour: Behaviour
TabTarget: Target
URL: URL
URLInvalid: 'You must provide a valid URL'
URLRequired: 'You must provide a URL'
PLURALNAME: Links
PLURALS:
one: 'A Link'
other: '{count} Links'
SINGULARNAME: Link
Fromholdio\SuperLinker\Model\SuperLinkTrait:
DoNoFollow: 'Ask search engines to ignore'
DoOpenInNew: 'Open in new tab'
LinkText: Text
LinkType: Type
MainTab: Main
NotConfigured: 'Not configured'
OptionalAutoGenerated: 'Optional. Will be auto-generated from link if left blank.'
OptionsGroup: Options
SelectLinkType: 'Select link type'
Fromholdio\SuperLinker\Model\VersionedSuperLink:
PLURALNAME: Links
PLURALS:
one: 'A Link'
other: '{count} Links'
SINGULARNAME: Link
68 changes: 36 additions & 32 deletions lang/fr.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
fr:
Fromholdio\SuperLinker\Extensions\EmailLink:
Body: 'Corps'
Email: 'E-mail'
EmailBCC: BCC
EmailCC: CC
MustProvideEmail: 'Vous devez fournir une adresse e-mail'
Subject: 'Sujet'
Fromholdio\SuperLinker\Extensions\ExternalURLLink:
ExternalURLMustBeComplete: 'Les URL externes doivent être complètes, y compris http:// ou https://'
URL: URL
Body: Corps
Email: E-mail
Subject: Sujet
Fromholdio\SuperLinker\Extensions\ExternalLink:
ExternalURL: URL
Fromholdio\SuperLinker\Extensions\FileLink:
Behaviour: comportement
DisplayInBrowser: 'Afficher le fichier dans la fenêtre du navigateur (si possible)'
Download: "Télécharger le fichier directement sur l'appareil de l'utilisateur"
File: Fichier
FileRequired: 'Vous devez télécharger ou sélectionner un fichier à lier'
Fromholdio\SuperLinker\Extensions\GlobalAnchorLink:
Anchor: Ancre
AnchorRequired: 'Vous devez sélectionner une ancre'
Fromholdio\SuperLinker\Extensions\NoLink:
NoLink: '- Pas de lien -'
TitleRequired: 'Vous devez fournir un titre'
GlobalAnchor: 'Ancre du site'
Fromholdio\SuperLinker\Extensions\PhoneLink:
Phone: Téléphone
PhoneRequired: 'Vous devez fournir un numéro de téléphone'
PhoneNumber: 'Numéro de téléphone'
Fromholdio\SuperLinker\Extensions\SiteTreeLink:
Anchor: Ancre
Page: Page
PageRequired: 'Vous devez sélectionner une page à lier'
PageAnchorOptional: 'Ancre de page (facultatif)'
PageOnThisWebsite: 'Page sur ce site'
SelectAPage: 'Sélectionnez une page'
SelectAnchor: 'Sélectionnez une ancre (facultatif)'
SelectAnAnchor: 'Sélectionnez une ancre'
Fromholdio\SuperLinker\Extensions\SuperLinkIconExtension:
LinkIcon: Symbole
Fromholdio\SuperLinker\Extensions\SystemLink:
SystemLink: 'Lien système'
SystemLinkRequired: 'Vous devez sélectionner un lien système'
Fromholdio\SuperLinker\Model\SuperLink:
CustomLinkText: 'Texte du lien'
DoNoFollow: 'Demandez aux moteurs de recherche de ne pas suivre ce lien'
DoOpenNewWindow: 'Ouvrir le lien dans une nouvelle fenêtre'
NewWindow: 'Nouvelle fenêtre'
OptionalWillBeGenerated: 'Facultatif. Sera généré automatiquement si laissé vide.'
TabBehaviour: Comportement
TabTarget: Cible
URL: URL
URLInvalid: 'Vous devez fournir une URL valide'
URLRequired: 'Vous devez fournir une URL'
PLURALNAME: Liens
PLURALS:
one: 'Un lien'
other: '{count} liens'
SINGULARNAME: Lien
Fromholdio\SuperLinker\Model\SuperLinkTrait:
DoNoFollow: "Demandez aux moteurs de recherche d'ignorer"
DoOpenInNew: 'Ouvrir dans une nouvelle fenêtre'
LinkText: Texte
LinkType: Type
MainTab: Base
NotConfigured: 'Pas configuré'
OptionalAutoGenerated: 'Facultatif. Sera généré automatiquement à partir du lien si ce champ est laissé vide.'
OptionsGroup: Options
SelectLinkType: 'Sélectionnez le type de lien'
Fromholdio\SuperLinker\Model\VersionedSuperLink:
PLURALNAME: Liens
PLURALS:
one: 'Un lien'
other: '{count} liens'
SINGULARNAME: Lien
Loading

0 comments on commit 873034c

Please sign in to comment.