{% endblock %}
{% block content %}
{% if webhook.id %}{% endif %}
{{ forms.textField({
first: true,
label: 'Name'|t('webhooks'),
required: true,
instructions: 'What the webhook will be called within the Control Panel.'|t('webhooks'),
id: 'name',
name: 'name',
value: webhook.name,
errors: webhook.getErrors('name')
}) }}
{{ forms.textField({
label: 'Sender Class'|t('webhooks'),
required: true,
instructions: 'The class name the sender must be an instance of.'|t('webhooks'),
id: 'class',
name: 'class',
class: 'code',
placeholder: 'craft\\elements\\Entry',
value: webhook.class,
errors: webhook.getErrors('class')
}) }}
{{ forms.textField({
label: 'Event Name'|t('webhooks'),
required: true,
instructions: 'The name of the event that must be triggered.'|t('webhooks'),
id: 'event',
name: 'event',
class: 'code',
placeholder: 'afterSave',
value: webhook.event,
errors: webhook.getErrors('event')
}) }}
{% set urlInput %}
{% endset %}
{{ forms.field({
label: 'Request Type & URL'|t('webhooks'),
required: true,
instructions: 'The request type and URL that the webhook should send. (The URL will be provided by your [task automation tool][1].)'|t('webhooks') ~ '\n\n[1]: https://github.com/craftcms/webhooks#integration-with-task-automation-tools',
id: 'url',
errors: webhook.getErrors('url')
}, urlInput) }}
{{ forms.textareaField({
label: 'Extra User Attributes'|t('webhooks'),
instructions: 'List of additional attributes for the logged-in user that should be included in the webhook body.'|t('webhooks') ~ ' ' ~ '(Place separate attributes on new lines.)'|t('webhooks'),
id: 'user-attributes',
name: 'userAttributes',
placeholder: 'photo.url',
class: 'code nicetext',
value: webhook.userAttributes,
errors: webhook.getErrors('userAttributes')
}) }}
{{ forms.textareaField({
label: 'Extra Sender Attributes'|t('webhooks'),
instructions: 'List of additional attributes for the event sender that should be included in the webhook body.'|t('webhooks') ~ ' ' ~ '(Place separate attributes on new lines.)'|t('webhooks'),
id: 'sender-attributes',
name: 'senderAttributes',
placeholder: 'author.email',
class: 'code nicetext',
value: webhook.senderAttributes,
errors: webhook.getErrors('senderAttributes')
}) }}
{{ forms.textareaField({
label: 'Extra Event Attributes'|t('webhooks'),
instructions: 'List of additional attributes for the event properties that should be included in the webhook body.'|t('webhooks') ~ ' ' ~ '(Place separate attributes on new lines.)'|t('webhooks'),
id: 'event-attributes',
name: 'eventAttributes',
class: 'code nicetext',
value: webhook.eventAttributes,
errors: webhook.getErrors('eventAttributes')
}) }}