{"id":21931750,"url":"https://github.com/lekoala/silverstripe-pure-modal","last_synced_at":"2025-04-19T19:19:43.319Z","repository":{"id":43398771,"uuid":"379888438","full_name":"lekoala/silverstripe-pure-modal","owner":"lekoala","description":"Dead simple modals for SilverStripe (works in the admin too!)","archived":false,"fork":false,"pushed_at":"2024-11-14T14:47:56.000Z","size":59,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T12:11:24.053Z","etag":null,"topics":["modal","php","silverstripe","silverstripe-module"],"latest_commit_sha":null,"homepage":"","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/lekoala.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"lekoala"}},"created_at":"2021-06-24T10:34:19.000Z","updated_at":"2024-11-14T14:47:28.000Z","dependencies_parsed_at":"2024-02-09T14:42:27.740Z","dependency_job_id":null,"html_url":"https://github.com/lekoala/silverstripe-pure-modal","commit_stats":{"total_commits":35,"total_committers":3,"mean_commits":"11.666666666666666","dds":0.2571428571428571,"last_synced_commit":"edb80fb2c31e757220957085ff5de9833e7f3dbb"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fsilverstripe-pure-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fsilverstripe-pure-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fsilverstripe-pure-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lekoala%2Fsilverstripe-pure-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lekoala","download_url":"https://codeload.github.com/lekoala/silverstripe-pure-modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249777348,"owners_count":21324080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["modal","php","silverstripe","silverstripe-module"],"created_at":"2024-11-28T23:14:55.110Z","updated_at":"2025-04-19T19:19:43.280Z","avatar_url":"https://github.com/lekoala.png","language":"PHP","funding_links":["https://github.com/sponsors/lekoala"],"categories":[],"sub_categories":[],"readme":"# SilverStripe Pure Modal module\n\n![Build Status](https://github.com/lekoala/silverstripe-pure-modal/actions/workflows/ci.yml/badge.svg)\n[![scrutinizer](https://scrutinizer-ci.com/g/lekoala/silverstripe-pure-modal/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/lekoala/silverstripe-pure-modal/)\n[![Code coverage](https://codecov.io/gh/lekoala/silverstripe-pure-modal/branch/master/graph/badge.svg)](https://codecov.io/gh/lekoala/silverstripe-pure-modal)\n\n## Intro\n\nDead simple modals for SilverStripe (works in the admin too!)\n\n## Sample usage\n\nSimply pass the content to display in the modal. The modal will be accessible through a button in the fieldset\n\nYou can also set an iframe to be displayed within the modal in case you want to display a form for example.\n\n```php\n$myHtmlContent = \"\u003cp\u003eSome content here\u003c/p\u003e\";\n$ImportStuff = new PureModal('ImportStuff', 'Import Stuff', $myHtmlContent);\n$fields-\u003eaddFieldToTab('Root.Stuff', $ImportStuff);\n$ImportStuff-\u003esetIframeAction('import_stuff');\n$ImportStuff-\u003esetIframeTop(true);\n```\n\nAnd here is a sample `import_stuff` method\n\n```php\npublic function import_stuff(HTTPRequest $req)\n{\n    $Stuff = $this-\u003egetRequestedRecord();\n    $fields = new FieldList([\n        new FileField('File'),\n        new HiddenField('StuffID', null, $Stuff-\u003eID),\n    ]);\n    $actions = new FieldList([\n        new FormAction('doUpload', 'Upload')\n    ]);\n    $form = new Form(Controller::curr(), 'MyForm', $fields, $actions);\n\n    return PureModal::renderDialog($this, ['Form' =\u003e $form]);\n}\n```\n\n## Modal action\n\nThis feature require my [cms-actions](https://github.com/lekoala/silverstripe-cms-actions) module.\n\n```php\n    public function getCMSActions()\n    {\n        $actions = parent::getCMSActions();\n        $doDeny = new PureModalAction(\"doDeny\", \"Deny\");\n        $predefinedText = \u003c\u003c\u003cTEXT\nDear Customer,\n\nYour request has been denied.\n\nBest regards,\nTEXT;\n        $iframeFields = new FieldList([\n            new DropdownField(\"SelectReason\", \"Select reason\"),\n            new TextareaField(\"EnterText\", \"Enter custom text\", $predefinedText),\n        ]);\n        $doDeny-\u003esetFieldList($iframeFields);\n        $doDeny-\u003esetShouldRefresh(true);\n        $doDeny-\u003esetDialogButtonTitle('Deny the request'); // customised modal submit button\n        $actions-\u003epush($doDeny);\n    }\n```\n\nIt creates a button that opens a modal with a set of fields. These fields\nare submitted alongside the form.\n\n```php\n    public function doDeny($data)\n    {\n        $this-\u003eDeniedReason = $data['EnterText'];\n        $this-\u003eStatus = \"denied\";\n        $this-\u003ewrite();\n        return 'Denied';\n    }\n```\n\nYou can remove the submit button from the modal itself, for example to make it an information window only.\nBy doing like this:\n\n```php\n    public function getCMSActions()\n    {\n        $actions = parent::getCMSActions();\n        $doDeny = new PureModalAction(\"noopInfo\", \"Information\");\n\n        // .. add fields\n\n        $doDeny-\u003esetShowDialogButton(false);\n        $actions-\u003epush($doDeny);\n    }\n```\n\n## Compatibility\n\nTested with ^5\n\n## Maintainer\n\nLeKoala - thomas@lekoala.be\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekoala%2Fsilverstripe-pure-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flekoala%2Fsilverstripe-pure-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flekoala%2Fsilverstripe-pure-modal/lists"}