Download the PHP package restruct/silverstripe-admintweaks without Composer

On this page you can find all versions of the php package restruct/silverstripe-admintweaks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-admintweaks

Admin tweaks for Silverstripe

The small CMS and developer improvements most Silverstripe projects end up writing for themselves, in one module: a switcher that names the CMS and environment you are in and links to your other CMSes, page-type icons in the site tree, permission codes next to every permission checkbox, opt-in ModelAdmin and form-field tweaks, template helpers, deduplicated error mails, and repair tasks for a migrated asset store. A few sensible defaults apply on install; everything else is switched on per project. For Silverstripe 6 (the 3.x line covers Silverstripe 4 and 5).

Maintained by Restruct. If this module saves you time, you can support ongoing maintenance.

Namespace: Restruct\Silverstripe\AdminTweaks

Every project rebuilds the same small things

A stock Silverstripe CMS does the big things well and leaves the small ones to each project. Which of the organisation's CMSes is this, and is it the test server? Which permission code does that checkbox in the Security admin stand for? ModelAdmin offers an Export to CSV that just dumps the summary fields, and a CSV import that is a data-integrity risk on a synced model. An API key in a form needs a copy button. Error mails go out once per error, so a database outage sends hundreds. And a site migrated from Silverstripe 3 or 4 can leave folders that break the Files section and images that render nothing.

This module collects the fixes for those, so a project switches them on with a line of YAML instead of copying code around:

Area What you get Details
Admin UI Page-type icons, permission badges, Bootstrap Icon classes, menu grouping, CMS system switcher, GridField and checkbox fixes Icons
ModelAdmin Search bar open on load, scaffolded CSV buttons and import off
Form fields CopyTextField, MultivalueSortField, IpAddressField, Bootstrap classes Form fields
GridField Editable and orderable configs, versioned ordering GridField
Templates 30+ helper methods, extra iterators, image placeholders Template helpers
SiteConfig Contact details, social media, theme settings, raw HTML in head/body SiteConfig
Caching Cached HTTP requests, JSON and JSON-LD parsing Caching and helpers
Email and logging System sender from env, error mails with deduplication Email and logging
QueuedJobs Queue report recipient filled from env; ScheduledMethodCall and cleanup-broken-jobs moved to queuedjobs-enhancements QueuedJobs
Tasks Repair tasks for a migrated asset store, a read-only ORM query task Tasks

What changes as soon as it is installed

In the CMS

Defaults

With other modules installed

Module Enhancement
symbiote/silverstripe-grouped-cms-menu Groups admin sections under "Advanced Config"
symbiote/silverstripe-queuedjobs Job context in error mails; report recipient from env (see QueuedJobs)
wilr/silverstripe-googlesitemaps Activates sitemap generation
silverstripe/mimevalidator Activates MIME upload validation
wedevelopnl/silverstripe-webp-images Activates WEBP output (no Silverstripe 6 release yet)
restruct/silverstripe-shortcodable Registers the CurrentYear and FeaturedImage shortcodes

Opt-in tweaks for the CMS

Tell your CMSes apart: the system switcher

For organisations running several Silverstripe CMSes side by side (for example a public site, a document system and an e-learning platform): the admin menu header names the CMS you are in, with the environment, and opens a dropdown with links to the other CMSes (screenshot at the top).

ModelAdmin: search open, CSV buttons off

ModelAdminExtension is registered on ModelAdmin; enable it per subclass (or project-wide via YAML on SilverStripe\Admin\ModelAdmin, with per-subclass overrides):

hide_scaffolded_csv_buttons also switches the CSV import itself off ($showImportForm = false), not only its button: without that, ModelAdmin keeps accepting a hand-built import POST. To apply it to every ModelAdmin:

Hide the Reports and Campaigns sections

Hiding the Reports and Campaigns CMS sections is opt-in since 4.1 (#54), and applied at runtime so no After: ordering is needed to override it:

The sections keep working at their URLs; only the menu items go. While the setting is unset, dev environments log a one-off notice about the change from 3.x; set it to false to keep the sections and silence the notice. See UPGRADING.md.

Bootstrap Icon classes

Standard bi bi-* classes for buttons and other admin UI, mirroring core's .font-icon-* pattern. They need the Bootstrap Icons stylesheet, loaded from a CDN once you switch it on:

Menu grouping

With symbiote/silverstripe-grouped-cms-menu installed, the configuration sections (Settings, Archive, Redirects, Subsites, Queued Jobs and restruct/silverstripe-blockbase's blocks admin, those that are installed) are grouped under "Advanced Config" in the menu. Nothing to configure.

Form fields and GridField configs

GridField configurations:

More in GridField.

Templates, SiteConfig and caching

Template helpers

All helpers: Template helpers.

SiteConfig fields (opt-in)

Every option: SiteConfig.

Cached HTTP requests

More, including GeneralHelpers and the image fallback extensions: Caching and helpers.

Tie a DataObject's permissions to Pages access: EnforceCMSPermission

Ties a DataObject's canView / canEdit / canDelete / canCreate to Pages section access: each returns Permission::check('CMS_ACCESS_CMSMain') for the current user. The $member argument is ignored, so canEdit($someOtherMember) still answers for whoever is logged in. Holders of CMS_ACCESS_LeftAndMain (all CMS sections) and ADMIN pass as well, as Permission::check() treats those as implying CMS_ACCESS_CMSMain.

Email and error mails

APP_SYSTEM_EMAIL_* fills Email.admin_email when the project has not set it. SMTP is configured with Symfony Mailer's MAILER_DSN; the APP_SMTP_* variables of the 3.x line (SwiftMailer, Silverstripe 4 only) do nothing here.

Error mails are sent only when all four APP_LOG_MAIL_* variables are set, so leave them out on dev and test. They carry the request and server details, and repeats of the same error are deduplicated, so an outage does not flood the inbox.

Formatter, deduplication settings and troubleshooting: Email and logging.

QueuedJobs

ScheduledMethodCall and the cleanup-broken-jobs task are no longer part of this module. Both live in restruct/silverstripe-queuedjobs-enhancements (namespace Restruct\QueuedJobsEnhancements, requires Silverstripe 5.4+), as Restruct\QueuedJobsEnhancements\Jobs\ScheduledMethodCall and sake dev/tasks/cleanup-broken-jobs (Silverstripe 5) / sake tasks:cleanup-broken-jobs (Silverstripe 6). See that module's README for usage.

What this module still does for queuedjobs:

Tasks: repair a migrated asset store, query the ORM

Repair tasks for a site migrated to Silverstripe 5 or 6

Three BuildTasks that fix asset artifacts left behind by a migration from Silverstripe 3 or 4. All are dry-run by default; pass --apply to write. Run them in this order:

# Task Fixes
1 sake tasks:fix-folder-filefilename /admin/assets dies with HashFileIDHelper::buildFileID requires an $hash value. Folder rows must have an EMPTY FileFilename (a folder derives its path from the parent chain); a populated value makes the folder's visibility lookup build a file ID with no hash. Also reports empty-FileHash File rows, which trip the same exception.
2 sake tasks:fix-misclassified-images Image files carried over with ClassName = File instead of Image. Blank tiles in the asset-admin grid, but more importantly, a has_one Image relation pointing at such a record renders nothing on the front end, because Fill()/FitMax()/ScaleWidth() don't exist on File. Resolves the target class via File::get_class_for_file_extension(), so .svg correctly becomes your registered SVG image class rather than Image.
3 sake tasks:generate-cms-thumbnails Blank tiles in the asset-admin file grid. The grid is served by GraphQL and asset-admin deliberately injects a non-generating thumbnail generator (ThumbnailGenerator.graphql -> Generates: false), so it emits the __FitMax[...] URL but never creates the variant. Normal uploads generate variants on save; migrated files never went through SS5, so their variants don't exist and the <img> 404s. SS4 ran ImageThumbnailHelper inside MigrateFileTask; SS5 removed the task but kept the helper. This runs it.

Order matters: (2) before (3), because the thumbnail helper skips anything whose getIsImage() is false; a file still stuck on ClassName = File would be passed over.

Prerequisite for (3): the files must actually be migrated (a populated FileHash). On a database where FileHash is empty there are no stored bytes to make a thumbnail from, and the task will correctly report that it generated nothing.

Task (3) requires silverstripe/asset-admin; it hides itself if that isn't installed.

Developer tasks

Task What it does
sake tasks:orm-query --class=Member --limit=5 Read-only ORM lookups from the command line (CLI and dev mode only): --filter, --exclude, --where, --fields, --sort, --limit, --count, --group-by, --sum/--avg/--min/--max, --sql to show the query, --schema to show the class's fields, relations and extensions.
sake tasks:qjob-profile --class='My\Jobs\SyncJob' --maxcalls=50 Runs a queued job in-process and reports memory, step, jobData size and message count per process() call, to find what a job accumulates. Dev only: it really runs the job. Deprecated: moved to queuedjobs-enhancements 1.7.0 under the same name, and this copy switches itself off when that is installed.
sake tasks:focuspoint-invert-yaxis Inverts all FocusPoint Y values (FocusPoint v2 to v3), for when the module's own migration did not run or went wrong.

The task invocations changed from 3.x (dev/tasks/... apply=1 became tasks:... --apply); the full table is in UPGRADING.md.

Technical

Version compatibility

Branch Module version Silverstripe PHP Status
main 4.x 6 8.3+ active development
v3 3.x 4, 5 as Silverstripe requires security and bug fixes until Silverstripe 5 EOL (April 2027)
v2 2.x 4 as Silverstripe requires no further releases

composer.json on each branch is the source of truth for exact constraints. Upgrading from 3.x? See UPGRADING.md: the CMS menu behaviour and the task invocations both changed. Release history: CHANGELOG.md.

Installation

Then flush and build the database (sake db:build --flush on Silverstripe 6). The defaults above apply from then on; the rest is switched on in your project's config.

Building the admin assets

The compiled CSS and JS in client/dist/ are committed. To change them, edit client/src/ and rebuild with Laravel Mix, from a checkout of the module (the lockfile is yarn.lock):

Tests

The PHPUnit suite in tests/ needs a Silverstripe 6 host project with silverstripe/recipe-testing; .github/workflows/ci.yml builds one and is the reference.

Browser tests (Playwright, against a real CMS) live in tests/browser/ and run in .github/workflows/browser-tests.yml. The screenshots in this README are generated from the same fixtures; see tests/browser/screenshots/README.md to regenerate them.

Further reading

License

MIT, see LICENSE.


All versions of silverstripe-admintweaks with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
silverstripe/framework Version ^6
silverstripe/vendor-plugin Version ^3
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package restruct/silverstripe-admintweaks contains the following files

Loading the files please wait ...