Skip to content
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

NEW Globally disallow link types #219

Merged

Conversation

emteknetnz
Copy link
Member

Issue #212

*
* @throws ReflectionException
*/
private function getLinkTypes(): array
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is method is unused

use SilverStripe\LinkField\Models\PhoneLink;
use SilverStripe\LinkField\Models\EmailLink;

class AbstractLinkFieldTest extends SapphireTest
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this file and associated fixture files from LinkFieldTest

'Relation' => 'MyLink',
], $res);
}

Copy link
Member Author

@emteknetnz emteknetnz Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below this line is new test code, above this line is existing code

Copy link
Contributor

@sabina-talipova sabina-talipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Tested locally. Just tiny enhancement.

README.md Outdated
Developers can control the link types allowed for individual `LinkField`. The `setAllowedTypes` method only allow link types that have been provided as parameters.
By default, all `Link` subclasses can be created by a `LinkField`. This includes any custom `Link` subclasses defined in your project or via a third party module.

If you wish to globally disable one of the default `Link` subclasses for all `LinkField` instances, then this can be done using the following YAML configuration, using the FQCN of the relevant default `Link` subclass you wish to disable:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you wish to globally disable one of the default `Link` subclasses for all `LinkField` instances, then this can be done using the following YAML configuration, using the FQCN of the relevant default `Link` subclass you wish to disable:
If you wish to globally disable one of the default `Link` subclasses for all `LinkField` instances, then this can be done using the following YAML configuration, using the FQCN (Fully-Qualified Class Name) of the relevant default `Link` subclass you wish to disable:

It would be nice to clarify, since we have not used this abbreviation before in the text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

@sabina-talipova sabina-talipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Locally tested.

@sabina-talipova sabina-talipova merged commit 1de5e1f into silverstripe:4 Feb 14, 2024
12 checks passed
@sabina-talipova sabina-talipova deleted the pulls/4/disable-types branch February 14, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants