{"action":"created","issue":{"url":"https://api.github.com/repos/octobercms/october/issues/877","repository_url":"https://api.github.com/repos/octobercms/october","labels_url":"https://api.github.com/repos/octobercms/october/issues/877/labels{/name}","comments_url":"https://api.github.com/repos/octobercms/october/issues/877/comments","events_url":"https://api.github.com/repos/octobercms/october/issues/877/events","html_url":"https://github.com/octobercms/october/issues/877","id":53930006,"number":877,"title":"Component property required attribute","user":{"login":"Whyounes","id":1175548,"avatar_url":"https://avatars.githubusercontent.com/u/1175548?v=3","gravatar_id":"","url":"https://api.github.com/users/Whyounes","html_url":"https://github.com/Whyounes","followers_url":"https://api.github.com/users/Whyounes/followers","following_url":"https://api.github.com/users/Whyounes/following{/other_user}","gists_url":"https://api.github.com/users/Whyounes/gists{/gist_id}","starred_url":"https://api.github.com/users/Whyounes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Whyounes/subscriptions","organizations_url":"https://api.github.com/users/Whyounes/orgs","repos_url":"https://api.github.com/users/Whyounes/repos","events_url":"https://api.github.com/users/Whyounes/events{/privacy}","received_events_url":"https://api.github.com/users/Whyounes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/octobercms/october/labels/Type:%20Enhancement","name":"Type: Enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"alekseybobkov","id":481606,"avatar_url":"https://avatars.githubusercontent.com/u/481606?v=3","gravatar_id":"","url":"https://api.github.com/users/alekseybobkov","html_url":"https://github.com/alekseybobkov","followers_url":"https://api.github.com/users/alekseybobkov/followers","following_url":"https://api.github.com/users/alekseybobkov/following{/other_user}","gists_url":"https://api.github.com/users/alekseybobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/alekseybobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alekseybobkov/subscriptions","organizations_url":"https://api.github.com/users/alekseybobkov/orgs","repos_url":"https://api.github.com/users/alekseybobkov/repos","events_url":"https://api.github.com/users/alekseybobkov/events{/privacy}","received_events_url":"https://api.github.com/users/alekseybobkov/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-01-09T23:39:27Z","updated_at":"2016-03-01T02:27:31Z","closed_at":null,"body":"Adding required to the property definition.\r\n\r\n```\r\npublic function defineProperties()\r\n    {\r\n        return [\r\n            'mailTemplate' => [\r\n                'title'             => 'Mail template',\r\n                'type'              => 'dropdown',\r\n                'required'         => true\r\n            ]\r\n        ];\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/octobercms/october/issues/comments/190499207","html_url":"https://github.com/octobercms/october/issues/877#issuecomment-190499207","issue_url":"https://api.github.com/repos/octobercms/october/issues/877","id":190499207,"user":{"login":"alekseybobkov","id":481606,"avatar_url":"https://avatars.githubusercontent.com/u/481606?v=3","gravatar_id":"","url":"https://api.github.com/users/alekseybobkov","html_url":"https://github.com/alekseybobkov","followers_url":"https://api.github.com/users/alekseybobkov/followers","following_url":"https://api.github.com/users/alekseybobkov/following{/other_user}","gists_url":"https://api.github.com/users/alekseybobkov/gists{/gist_id}","starred_url":"https://api.github.com/users/alekseybobkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alekseybobkov/subscriptions","organizations_url":"https://api.github.com/users/alekseybobkov/orgs","repos_url":"https://api.github.com/users/alekseybobkov/repos","events_url":"https://api.github.com/users/alekseybobkov/events{/privacy}","received_events_url":"https://api.github.com/users/alekseybobkov/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T02:27:30Z","updated_at":"2016-03-01T02:27:30Z","body":"The `required` parameter is already supported and described in the documentation. There are two ways to make a property required. One of them is described in the [components documentation](http://octobercms.com/docs/plugin/components#component-properties):\r\n\r\n```\r\npublic function defineProperties()\r\n{\r\n    return [\r\n        'maxItems' => [\r\n             'title'       => 'Max items',\r\n             'description' => 'The most amount of todo items allowed',\r\n             'default'     => 10,\r\n             'type'        => 'string',\r\n             'required'    => true\r\n        ]\r\n    ];\r\n}\r\n```\r\n\r\nAnother method uses new the extended syntax and described in the [Inspector documentation](http://octobercms.com/docs/ui/inspector):\r\n\r\n```\r\npublic function defineProperties()\r\n{\r\n    return [\r\n        'maxItems' => [\r\n            'title'             => 'Max items',\r\n            'description'       => 'The most amount of todo items allowed',\r\n            'default'           => 10,\r\n            'type'              => 'string',\r\n            'validation'        => [\r\n               'required'       => [\r\n                   'message'    => 'The max items property is required'\r\n               ]\r\n            ]\r\n        ]\r\n    ];\r\n}\r\n```\r\n\r\nPlease close the issue if it's resolved."}}