{"id":20816069,"url":"https://github.com/arillo/silverstripe-utils","last_synced_at":"2026-04-22T00:32:51.039Z","repository":{"id":62486971,"uuid":"156687277","full_name":"arillo/silverstripe-utils","owner":"arillo","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-23T22:43:45.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-28T16:21:57.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arillo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-08T10:07:54.000Z","updated_at":"2020-01-23T22:43:47.000Z","dependencies_parsed_at":"2022-11-02T10:15:33.745Z","dependency_job_id":null,"html_url":"https://github.com/arillo/silverstripe-utils","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/arillo/silverstripe-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillo%2Fsilverstripe-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillo%2Fsilverstripe-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillo%2Fsilverstripe-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillo%2Fsilverstripe-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arillo","download_url":"https://codeload.github.com/arillo/silverstripe-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arillo%2Fsilverstripe-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32115872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"ssl_error","status_checked_at":"2026-04-22T00:30:22.894Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T21:27:53.866Z","updated_at":"2026-04-22T00:32:51.022Z","avatar_url":"https://github.com/arillo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Arillo\\Utils\n\n[![Latest Stable Version](https://poser.pugx.org/arillo/silverstripe-utils/v/stable?format=flat)](https://packagist.org/packages/arillo/silverstripe-utils)\n\u0026nbsp;\n[![Total Downloads](https://poser.pugx.org/arillo/silverstripe-utils/downloads?format=flat)](https://packagist.org/packages/arillo/silverstripe-utils)\n\nUtils and helpers for SilverStripe CMS.\n\n### Requirements\n\nSilverStripe CMS ^4.0\n\n## Installation\n\n```bash\ncomposer require arillo/silverstripe-utils\n```\n\n## Usage\n\nThis module is a bundle of classes to alter functionality in the CMS.\n\n### Arillo\\Utils\\HiddenLeftAndMain\n\nAttach `Arillo\\Utils\\HiddenLeftAndMain` to any LeftAndMain subclass you want to hide, e.g. in `config.yml`:\n\n```\nSilverStripe\\CampaignAdmin\\CampaignAdmin:\n  extensions:\n    - Arillo\\Utils\\HiddenLeftAndMain\n```\n\n### Arillo\\Utils\\FluentFilteredHelper\n\nIf you use `silverstripe-fluent` with `TractorCow\\Fluent\\Extension\\FluentFilteredExtension` you can add `Arillo\\Utils\\FluentFilteredHelper` to your translated DataObject and it will attach all Locales on record creation and deletes locale entries on record deletion. In config, e.g. add:\n\n```\nMyDataObject:\n  # will create locale entries for this record on first save, default: true\n  auto_create_locales: true\n\n  # will delete locale entries on record deletion, default: false\n  auto_delete_locales: true\n  extensions:\n    - 'TractorCow\\Fluent\\Extension\\FluentFilteredExtension'\n    - 'Arillo\\Utils\\FluentFilteredHelper'\n```\n\n### Arillo\\Utils\\FluentHelper\n\nWith `Arillo\\Utils\\FluentHelper::force_delete` you can improve UX in CMS while record deletion. At the moment Fluent forces you to delete a page in each Locale, to remove it from SiteTree. Example usage:\n\n```\n\u003c?php\nuse SilverStripe\\CMS\\Model\\SiteTree;\nuse Arillo\\Utils\\FluentHelper;\n\nclass Page extends SiteTree\n{\n    public function onBeforeDelete()\n    {\n        parent::onBeforeDelete();\n        FluentHelper::force_delete($this); // insert this\n    }\n}\n```\n\n### Arillo\\Utils\\CMS\n\nSome unsorted functions.\n\nRemove campaign-related actions from Menu:\n\n```\n\u003c?php\nuse SilverStripe\\CMS\\Model\\SiteTree;\nuse Arillo\\Utils\\CMS;\n\nclass Page extends SiteTree\n{\n    public function getCMSActions()\n    {\n        return CMS::remove_campaign_actions(parent::getCMSActions());\n    }\n}\n```\n\nThumbnail helper function for gridfield usage:\n\n```\n\u003c?php\nuse SilverStripe\\ORM\\DataObject;\nuse SilverStripe\\Assets\\Image;\nuse Arillo\\Utils\\CMS;\n\nclass MyDataObject extends DataObject\n{\n    private static $has_one = [ 'Image' =\u003e Image::class ];\n    private static $summary_fields = [ 'Thumbnail' =\u003e 'Image' ];\n\n    public function getThumbnail()\n    {\n        return CMS::thumbnail($this-\u003eImage());\n    }\n}\n```\n\n### Arillo\\Utils\\AlertField\n\nDisplay a message in CMS ([bootstrap alert style](https://v4-alpha.getbootstrap.com/components/alerts/)). E.g.:\n\n```\n\u003c?php\nuse SilverStripe\\CMS\\Model\\SiteTree;\nuse Arillo\\Utils\\AlertField;\n\nclass Page extends SiteTree\n{\n    public function getCMSFields()\n    {\n        $fields = parent::getCMSFields();\n        $fields-\u003eaddFieldToTab(\n            'Root.Main',\n            AlertField::create('PageInfo', \"Page type: {$this-\u003eClassName}\", 'dark')\n        , 'Title');\n        return $fields;\n    }\n}\n```\n\n### Arillo\\Utils\\SortableDataObject\n\nAdd this extension to a DataObject to make it sortable:\n\n```\nuse SilverStripe\\ORM\\DataObject;\nuse Arillo\\Utils\\SortableDataObject;\n\nclass MyDataObject extends DataObject\n{\n    private static $extensions = [\n        SortableDataObject::class,\n    ];\n}\n```\n\nYou can apply `GridFieldOrderableRows` to the managing `GridField` with the following helper function:\n\n```\nuse Arillo\\Utils\\SortableDataObject;\n\n...\n..\n.\n\nSortableDataObject::make_gridfield_sortable($gridField);\n```\n\n### Arillo\\Utils\\Env\n\nThere are 3 global helper functions for template usage:\n\n```\nIs DEV: \u003c% if $IsDev %\u003eyes\u003c% else %\u003eno\u003c% end_if %\u003e \u003cbr\u003e\nIs TEST: \u003c% if $IsTest %\u003eyes\u003c% else %\u003eno\u003c% end_if %\u003e \u003cbr\u003e\nIs PROD: \u003c% if $IsProd %\u003eyes\u003c% else %\u003eno\u003c% end_if %\u003e \u003cbr\u003e\n```\n\nin php:\n\n```\nArillo\\Utils\\Env::is_dev();\nArillo\\Utils\\Env::is_prod();\nArillo\\Utils\\Env::is_test();\n```\n\n### Arillo\\Utils\\PageHelper\n\nHelper for pages \u0026 templates functions.\n\nAdds `PageInstance` and `PageControllerInstance` template methods. Most helpfull in case there should be only one instance of a SiteTree subclass:\n\n```\n\u003c%-- access a page by classname in templates --%\u003e\n$PageInstance(SomeSiteTreeSubClassName).Title\n$PageInstance(SomeSiteTreeSubClassName).Link\n\n\u003c%-- e.g. render a Form from a diffrent controller --%\u003e\n$PageControllerInstance(SomeSiteTreeSubClassName).Form\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farillo%2Fsilverstripe-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farillo%2Fsilverstripe-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farillo%2Fsilverstripe-utils/lists"}