diff --git a/README.md b/README.md index cb99ed5..d301390 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ Provides a visual icon picker for content authors. Icon files are managable via # Requirements -- SilverStripe 4 or 5 +- Silverstripe CMS 6 +- For Silverstripe CMS 4 and 5, see previous releases # Version - Use release 1 for legacy non-cms editable icon files @@ -54,6 +55,3 @@ PlasticStudio\IconField\IconField: default_height: "30" ``` - - - diff --git a/code/IconField.php b/code/IconField.php index 0d7aef4..32b65a6 100755 --- a/code/IconField.php +++ b/code/IconField.php @@ -5,8 +5,8 @@ use DirectoryIterator; use SilverStripe\Core\Path; use SilverStripe\Assets\Folder; -use SilverStripe\ORM\ArrayList; -use SilverStripe\View\ArrayData; +use SilverStripe\Model\List\ArrayList; +use SilverStripe\Model\ArrayData; use SilverStripe\Forms\FormField; use SilverStripe\View\Requirements; use SilverStripe\Core\Config\Config; diff --git a/code/IconFieldPathMigrator_Task.php b/code/IconFieldPathMigrator_Task.php index 3a5210b..b51fce0 100644 --- a/code/IconFieldPathMigrator_Task.php +++ b/code/IconFieldPathMigrator_Task.php @@ -21,16 +21,16 @@ class IconFieldPathMigrator_BuildTask extends BuildTask protected string $title = 'Update icon file paths to assets folder'; protected bool $enabled = true; - + protected function execute(InputInterface $input, PolyOutput $output): int { // Get query parameters (supports both CLI & HTTP dev/tasks) $vars = $_GET ?? []; if (!isset($vars['classname']) || !isset($vars['field'])) { - $output->writeLine('Pass both class and field in the query string, eg ?classname=Skeletor\DataObjects\SummaryPanel&field=SVGIcon'); - $output->writeLine('If new folder is not "SiteIcons", pass new-path in the query string, eg &new-path=NewFolder'); - $output->writeLine('Classname must include namespace'); + $output->writeForHtml('Pass both class and field in the query string, eg ?classname=Skeletor\DataObjects\SummaryPanel&field=SVGIcon', true); + $output->writeForHtml('If new folder is not "SiteIcons", pass new-path in the query string, eg &new-path=NewFolder', true); + $output->writeForHtml('Classname must include namespace', true); return 1; } @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, PolyOutput $output): int $folderPath = isset($vars['new-path']) ? 'assets/' . $vars['new-path'] : 'assets/SiteIcons'; if (!ClassInfo::exists($classname)) { - $output->writeLine("Class {$classname} does not exist. Make sure to include namespace."); + $output->writeForHtml("Class {$classname} does not exist. Make sure to include namespace.", true); return 1; } @@ -47,7 +47,7 @@ protected function execute(InputInterface $input, PolyOutput $output): int $schema = DataObject::getSchema(); if (!$schema->classHasTable($classname)) { - $output->writeLine("Class {$classname} does not have a database table."); + $output->writeForHtml("Class {$classname} does not have a database table."); return 1; } @@ -55,7 +55,7 @@ protected function execute(InputInterface $input, PolyOutput $output): int $iconCol = Convert::raw2sql($iconField); if (!$objects || !$tableName) { - $output->writeLine("No objects found for class {$classname}"); + $output->writeForHtml("No objects found for class {$classname}", true); return 0; } @@ -66,15 +66,15 @@ protected function execute(InputInterface $input, PolyOutput $output): int $originIconName = basename($originIconPath); $newIconPath = $folderPath . '/' . $originIconName; - $output->writeLine("Updating {$object->Title}"); - $output->writeLine("Origin: {$originIconPath}"); - $output->writeLine("New path: {$newIconPath}"); + $output->writeForHtml("Updating {$object->Title}", true); + $output->writeForHtml("Origin: {$originIconPath}", true); + $output->writeForHtml("New path: {$newIconPath}", true); DB::prepared_query( "UPDATE {$tableName} SET {$iconCol} = ? WHERE ID = ?", [$newIconPath, $object->ID] ); - $output->writeLine("{$tableName} updated"); + $output->writeForHtml("{$tableName} updated", true); if ($object->hasExtension(Versioned::class)) { $tableNameVersioned = $tableName . '_Versions'; @@ -82,7 +82,7 @@ protected function execute(InputInterface $input, PolyOutput $output): int "UPDATE {$tableNameVersioned} SET {$iconCol} = ? WHERE RecordID = ?", [$newIconPath, $object->ID] ); - $output->writeLine("{$tableNameVersioned} updated"); + $output->writeForHtml("{$tableNameVersioned} updated", true); if ($object->isPublished()) { $tableNameLive = $tableName . '_Live'; @@ -90,18 +90,18 @@ protected function execute(InputInterface $input, PolyOutput $output): int "UPDATE {$tableNameLive} SET {$iconCol} = ? WHERE ID = ?", [$newIconPath, $object->ID] ); - $output->writeLine("{$tableNameLive} updated"); + $output->writeForHtml("{$tableNameLive} updated", true); } } - $output->writeLine("Panel icon updated"); + $output->writeForHtml("Panel icon updated", true); } else { - $output->writeLine("{$object->Title} - No icon, skipped"); + $output->writeForHtml("{$object->Title} - No icon, skipped", true); } - $output->writeLine("-------"); + $output->writeForHtml("-------", true); } return 0; } -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index 8ec5681..20dbcf0 100755 --- a/composer.json +++ b/composer.json @@ -20,9 +20,9 @@ ] }, "require": { - "silverstripe/cms": "^4 || ^5 || ^6", - "silverstripe/framework": "^4 || ^5 || ^6", - "silverstripe/vendor-plugin": "^1 || ^2 || ^3" + "silverstripe/cms": "^6", + "silverstripe/framework": "^6", + "silverstripe/vendor-plugin": "^3" }, "minimum-stability": "dev" }