Skip to content
Open

SS6 #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
Silverstripe:
name: 'Silverstripe (bundle)'
uses: nswdpc/ci-files/.github/workflows/silverstripe_53_83.yml@v-4
uses: nswdpc/ci-files/.github/workflows/silverstripe_6_83.yml@v-4
PHPStan:
name: 'PHPStan (analyse)'
uses: nswdpc/ci-files/.github/workflows/phpstan.silverstripe_83.yml@v-4
Expand Down
24 changes: 19 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,26 @@
}
],
"require": {
"dnadesign/silverstripe-elemental": "^5",
"codem/silverstripe-html5-inputs": "^1",
"gorriecoe/silverstripe-link": "^1.5"
"dnadesign/silverstripe-elemental": "^6",
"codem/silverstripe-html5-inputs": "^2",
"gorriecoe/silverstripe-link": "dev-ss6"
},
"require-dev": {
"cambis/silverstripe-rector": "^2",
"cambis/silverstan": "^2",
"friendsofphp/php-cs-fixer": "^3",
"nswdpc/ci-files": "dev-v-4",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^11.5",
"phpstan/phpstan": "^2",
"phpstan/phpstan-phpunit": "^2",
"rector/rector": "^2"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/nswdpc/silverstripe-link.git"
}
],
"autoload": {
"psr-4": {
"NSWDPC\\Elemental\\Models\\Iframe\\": [
Expand All @@ -49,12 +55,20 @@
"client/static"
]
},
"scripts": {
"phpstan-analyse": "./vendor/bin/phpstan analyse --ansi --no-progress --no-interaction --configuration vendor/nswdpc/ci-files/phpstan/.phpstan.silverstripe.neon src/ tests/",
"rector-dryrun": "./vendor/bin/rector process --dry-run --ansi --config vendor/nswdpc/ci-files/rector/.rector.silverstripe_6_83.php src/ tests/",
"rector-process": "./vendor/bin/rector process --no-diffs --ansi --config vendor/nswdpc/ci-files/rector/.rector.silverstripe_6_83.php src/ tests/",
"phpcsfixer-fix": "./vendor/bin/php-cs-fixer fix --ansi --no-interaction --config vendor/nswdpc/ci-files/php-cs-fixer/.php-cs-fixer.php src/ tests/"
},
"config": {
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true,
"silverstripe/recipe-plugin": true,
"phpstan/extension-installer": true
}
}
},
"prefer-stable": true,
"minimum-stability": "dev"
}
9 changes: 3 additions & 6 deletions src/Models/Elements/ElementIframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use SilverStripe\Security\PermissionProvider;
use SilverStripe\Security\Permission;
use SilverStripe\View\Requirements;
use SilverStripe\View\ViewableData;

/**
* Iframe content block
Expand Down Expand Up @@ -67,7 +66,7 @@ class ElementIframe extends BaseElement implements PermissionProvider

private static string $title = 'Iframe';

private static string $description = 'Display content in an HTML iframe tag';
private static string $class_description = 'Display content in an HTML iframe tag';

private static array $responsive_options = [
'16x9' => '16x9',
Expand All @@ -93,7 +92,7 @@ public function getType()
* Apply requirements when templating
*/
#[\Override]
public function forTemplate($holder = true)
public function forTemplate($holder = true): string
{

// Responsive CSS
Expand Down Expand Up @@ -263,7 +262,7 @@ public function onBeforeWrite()
public function saveURLtoLink(string $urlValue = null): ?int
{

if ($urlValue === null || $urlValue === '' || $urlValue === '0') {
if (in_array($urlValue, [null, '', '0'], true)) {
// avoid saving a link model that has no URL
return null;
}
Expand Down Expand Up @@ -350,8 +349,6 @@ public function getURLAsString(): string
$linkURL = $link->getLinkURL();
if (is_string($linkURL)) {
$url = $linkURL;
} elseif ($linkURL instanceof ViewableData) {
$url = $linkURL->forTemplate();
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/IframeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use SilverStripe\Assets\Dev\TestAssetStore;
use SilverStripe\Assets\File;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Core\Validation\ValidationException;
use SilverStripe\View\Requirements;

/**
Expand Down