-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINOR: better anchors #32
base: master
Are you sure you want to change the base?
Conversation
bugfix local $this->allowed_types (elliot-sawyer#27)
Add the option to create a link to an elemental anchor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also explain what this PR tries to resolve.
@@ -17,9 +17,16 @@ | |||
"require": { | |||
"silverstripe/framework": "^4 || ^5", | |||
"unclecheese/display-logic": "^2 || ^3", | |||
"giggsey/libphonenumber-for-php": "^8.0" | |||
"giggsey/libphonenumber-for-php": "^8.0", | |||
"sheadawson/silverstripe-dependentdropdownfield": "dev-master" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A library shouldn't rely on a dev-master
requirement
"repositories": [ | ||
{ | ||
"type": "vcs", | ||
"url": "https://github.com/anhld/silverstripe-dependentdropdownfield" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't propagate through to the root composer install.
$owner->Title = $element->Title; | ||
} | ||
$owner->Querystring = $owner->Querystring ? str_replace('?', '', (string) $owner->QueryString) : $owner->Querystring; | ||
$owner->Anchor = $owner->Anchor ? str_replace('#', '', (string) $owner->Anchor) : $owner->Anchor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks overly complicated.
A simple $owner->Querystring = ltrim((string)$owner->Querystring, '?');
would suffice.
|
||
// add QueryString | ||
if(!empty($this->QueryString)) { | ||
if(strpos($LinkURL, '?') === false && strpos($this->QueryString, '?') === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strpos should be str_contains
The check on the QueryString seems pointless, as this is stripped out already earlier.
|
||
// add anchor | ||
if(!empty($this->Anchor)) { | ||
if(strpos($LinkURL, '#') === false && strpos($this->Anchor, '#') === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
$sitetree_field_label = $config->get('sitetree_field_label') ?: 'MenuTitle'; | ||
|
||
// Get source data for the ElementID field | ||
$anchorOptions = function ($pageID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability, semantics and debug-ability, this should be an actual method, instead of an anonymous function.
No description provided.