diff --git a/config/install/yamlform.yamlform_options.gender.yml b/config/install/yamlform.yamlform_options.gender.yml index f67900a..37bc5a4 100644 --- a/config/install/yamlform.yamlform_options.gender.yml +++ b/config/install/yamlform.yamlform_options.gender.yml @@ -6,3 +6,4 @@ label: Gender options: | Male: Male Female: Female + Transgender: Transgender diff --git a/config/install/yamlform.yamlform_options.likert_quality.yml b/config/install/yamlform.yamlform_options.likert_quality.yml new file mode 100644 index 0000000..6806fc8 --- /dev/null +++ b/config/install/yamlform.yamlform_options.likert_quality.yml @@ -0,0 +1,11 @@ +langcode: en +status: true +dependencies: { } +id: likert_quality +label: 'Likert: Quality' +options: | + 1: Poor + 2: Fair + 3: Good + 4: Very good + 5: Excellent diff --git a/css/yamlform.element.message.css b/css/yamlform.element.message.css new file mode 100755 index 0000000..840d442 --- /dev/null +++ b/css/yamlform.element.message.css @@ -0,0 +1,12 @@ +/** + * @file + * Messages element styles. + */ + +.messages { + box-shadow: -8px 0 0 #3b3b3b; /* LTR */ +} +[dir="rtl"] .messages { + box-shadow: 8px 0 0 #3b3b3b; + margin-left: 0; +} diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_contact.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_contact.yml new file mode 100644 index 0000000..b51fa8e --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_contact.yml @@ -0,0 +1,132 @@ +langcode: en +status: true +dependencies: { } +uid: null +template: true +id: template_contact +title: 'Contact Us' +description: 'A basic contact form template.' +elements: | + name: + '#title': 'Your Name' + '#type': textfield + '#required': true + email: + '#title': 'Your Email' + '#type': email + '#required': true + subject: + '#title': 'Subject' + '#type': textfield + '#required': true + message: + '#title': 'Message' + '#type': textarea + '#required': true +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: 'Send message' + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: true + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 0 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: url_message + confirmation_message: 'Your message has been sent.' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: + email_confirmation: + id: email + label: 'Email confirmation' + handler_id: email_confirmation + status: true + weight: 1 + settings: + to_mail: '[yamlform-submission:values:email:raw]' + cc_mail: '' + bcc_mail: '' + from_mail: default + from_name: default + subject: '[yamlform-submission:values:subject:value]' + body: '[yamlform-submission:values:message:value]' + excluded_elements: { } + html: true + attachments: false + debug: false + email_notification: + id: email + label: 'Email notification' + handler_id: email_notification + status: true + weight: 1 + settings: + to_mail: default + cc_mail: '' + bcc_mail: '' + from_mail: '[yamlform-submission:values:email:raw]' + from_name: '[yamlform-submission:values:name:value]' + subject: '[yamlform-submission:values:subject:value]' + body: '[yamlform-submission:values:message:value]' + excluded_elements: { } + html: true + attachments: false + debug: false diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_employee_evaluation.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_employee_evaluation.yml new file mode 100644 index 0000000..5cf3d9d --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_employee_evaluation.yml @@ -0,0 +1,143 @@ +langcode: en +status: false +dependencies: { } +uid: null +template: true +id: template_employee_evaluation +title: 'Employee Evaluation' +description: 'An employee evaluation form template.' +elements: | + evaluator_information: + '#title': 'Your Information' + '#type': fieldset + evaluator_first_name: + '#title': 'First Name' + '#type': textfield + '#required': true + evaluator_last_name: + '#title': 'Last Name' + '#type': textfield + '#required': true + evaluator_job_title: + '#type': textfield + '#title': 'Job Title' + '#required': true + evaluator_relationship: + '#type': select_other + '#title': 'Relationship with employee' + '#options': + Coworker: Coworker + Supervisor: Supervisor + '#required': true + employee_information: + '#title': 'Employee Information' + '#type': fieldset + employee_first_name: + '#title': 'First Name' + '#type': textfield + '#required': true + employee_last_name: + '#title': 'Last Name' + '#type': textfield + '#required': true + employee_job_title: + '#type': textfield + '#title': 'Job Title' + '#required': true + employee_ratings: + '#type': likert + '#title': 'How would you rate the employee''s...' + '#questions': + attendance: Attendance + attire: Attire + professionalism: Professionalism + work_area: Work area + ability: Ability to do the job + work_with_others: Ability to work with others + receive_feedback: Ability to receive feedback/criticism + adaptabily: Ability to adapt + learning: Willingness to learn + participation: Willingness to participate + work_ethic: Work ethic + quality: Quality of work + '#answers': likert_quality + '#required': true + employee_qualities: + '#type': textarea + '#title': 'What are the employee''s top qualities?' + '#required': true + employee_improve: + '#type': textarea + '#title': 'In what ways could the employee improve?' + '#required': true +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: Apply + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: true + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 0 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: page + confirmation_message: 'Thank you for applying.' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: { } diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_issue.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_issue.yml new file mode 100644 index 0000000..9ba1122 --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_issue.yml @@ -0,0 +1,188 @@ +langcode: en +status: false +dependencies: { } +uid: null +template: true +id: template_issue +title: Issue +description: 'An issue form template.' +elements: | + meta_data_details: + '#title': 'Issue Meta Data' + '#type': details + '#open': true + meta_data_01: + '#type': flexbox + title: + '#type': textfield + '#title': 'Title' + '#required': true + project: + '#type': select + '#title': 'Project' + '#required': true + '#options': + 'Project I': 'Project I' + 'Project II': 'Project II' + 'Project III': 'Project III' + meta_data_02: + '#type': flexbox + category: + '#type': select + '#title': 'Category' + '#required': true + '#options': + Bug report: Bug report + Task: Task + Feature request: Feature request + Support request: Support request + Plan: Plan + priority: + '#type': select + '#title': 'Priority' + '#required': true + '#options': + 4: Critical + 3: Major + 2: Normal + 1: Minor + status: + '#type': select_other + '#title': 'Status' + '#required': true + '#options': + Active: Active + Needs work: Needs work + Needs review: Needs review + Reviewed & tested by the community: Reviewed & tested by the community + Patch (to be ported): Patch (to be ported) + Fixed: Fixed + Postponed: Postponed + Postponed (maintainer needs more info): Postponed (maintainer needs more info) + Closed (duplicate): Closed (duplicate) + Closed (won't fix): Closed (won't fix) + Closed (works as designed): Closed (works as designed) + Closed (cannot reproduce): Closed (cannot reproduce) + Closed (outdated): Closed (outdated) + version: + '#type': autocomplete + '#title': 'Version' + '#required': true + '#autocomplete_existing': true + component: + '#type': select_other + '#title': 'Component' + '#required': true + '#options': + Code: Code + Documentation: Documentation + Miscellaneous: Miscellaneous + User interface: User interface + assigned: + '#type': entity_autocomplete + '#title': 'Assigned' + '#target_type': user + '#selection_handler': default:user + '#selection_settings': + include_anonymous: false + meta_data_03: + '#type': flexbox + tags: + '#type': entity_autocomplete + '#title': 'Issue Tags' + '#description': 'Do NOT use tags for adding random keywords or duplicating any other fields. Separate terms with a comma, not a space.' + '#tags': true + '#target_type': taxonomy_term + '#selection_handler': 'default:taxonomy_term' + '#selection_settings': + target_bundles: + tags: tags + auto_create: 1 + auto_create_bundle: tags + summary_and_relationshsips_details: + '#title': 'Issue Summary' + '#type': details + '#open': true + summary: + '#type': text_format + '#title': 'Summary' + '#description': 'An issue summary is a concise overview of a full issue report. Issue summaries need to be written if the issue has more than a few comments and/or an average developer cannot understand the subject matter after a few minutes of study. These summaries are key sources of information for core developers, patch reviewers and users who need to skim large amounts of issues and information quickly.' + files_details: + '#title': 'Files' + '#type': details + '#open': true + files: + '#type': 'managed_file' + '#title': 'Files' + '#multiple': true +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: '' + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: false + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 1 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: page + confirmation_message: '' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: { } diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_application.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_application.yml index 5daccdc..f718f4c 100644 --- a/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_application.yml +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_application.yml @@ -4,7 +4,7 @@ dependencies: { } uid: null template: true id: template_job_application -title: 'Job application' +title: 'Job Application' description: 'A job application form template.' elements: | information: diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_seeker_profile.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_seeker_profile.yml new file mode 100644 index 0000000..9eb44a8 --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_job_seeker_profile.yml @@ -0,0 +1,165 @@ +langcode: en +status: false +dependencies: { } +uid: null +template: true +id: template_job_seeker_profile +title: 'Job Seeker Profile' +description: 'A job seeker profile form template.' +elements: | + introduction: + '#markup': | +

Creating a job seeker profile will help companies find you:

+ + information: + '#title': 'Job Seeker Information' + '#type': fieldset + first_name: + '#title': 'First Name' + '#type': textfield + '#required': true + last_name: + '#title': 'Last Name' + '#type': textfield + '#required': true + address: + '#type': address + '#required': true + current_title: + '#type': textfield + '#title': 'Current Job Title' + current_organization: + '#type': textfield + '#title': 'Current Place of Occupation' + positions: + '#type': textfield + '#title': 'Position you are looking for' + relocation: + '#type': checkbox + '#title': 'Willing to relocate' + salary: + '#title': 'Salary Minimum' + '#type': textfield + '#description': 'Add currency sign/currency code if desired. e.g. 500,000 USD, 500,000 CAD, ¥ 100,000' + skill: + '#title': 'Skill Level' + '#type': radios + '#options_display': two_columns + '#options': + 'Novice/Beginner': 'Novice/Beginner' + 'Intermediate/Proficient': 'Intermediate/Proficient' + 'Expert/Advanced': 'Expert/Advanced' + categories: + '#title': 'Job Categories' + '#type': checkboxes + '#options_display': two_columns + '#options': + 'Account Manager': 'Account Manager' + 'Back-End': 'Back-End' + 'Designer': 'Designer' + 'DevOps': 'DevOps' + 'Front-End': 'Front-End' + 'Project Manager': 'Project Manager' + 'Sales': 'Sales' + 'Site Builder': 'Site Builder' + 'Themer': 'Themer' + resume: + '#type': managed_file + '#title': 'Resume' + url: + '#type': url + '#title': 'Website' + '#description': Enter your existing profile/resume/portfolio link. +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: '' + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: true + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 0 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: page + confirmation_message: 'Thank you for applying.' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: + email_notification: + id: email + label: 'Email Notification' + handler_id: email_notification + status: true + weight: 1 + settings: + to_mail: default + cc_mail: '' + bcc_mail: '' + from_mail: '[yamlform-submission:values:email:raw]' + from_name: '[yamlform-submission:values:first_name] [yamlform-submission:values:last_name]' + subject: default + body: default + excluded_elements: { } + html: true + attachments: false + debug: false diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_session_evaluation.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_session_evaluation.yml new file mode 100644 index 0000000..f19f54e --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_session_evaluation.yml @@ -0,0 +1,127 @@ +langcode: en +status: false +dependencies: { } +uid: null +template: true +id: template_session_evaluation +title: 'Session Evaluation' +description: 'A session evaluation form template.' +elements: | + overall: + '#type': radios + '#title': 'How was the session overall?' + '#options_display': side_by_side + '#options': likert_quality + '#required': true + speaker: + '#type': likert + '#title': 'Please rate the speaker''s...' + '#questions': + mastery: Mastery of this topic + presentation: Presentation skills + quality: Quality of slides and visual aids + '#answers': likert_quality + '#na_answer': true + '#required': true + learn: + '#type': radios + '#title': 'Did you learn something in this session you can use in real life?' + '#options_display': side_by_side + '#options': + Yes: Yes + No: No + N/A: N/A + '#required': true + comments: + '#type': textarea + '#title': 'Comments' + '#description': 'What did you like most? What would you change? Advice for the speaker to make this session better?' +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: '' + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: false + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 1 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: page + confirmation_message: 'Thank you for your feedback.' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: + email_notification: + id: email + label: 'Email Notification' + handler_id: email_notification + status: true + weight: 1 + settings: + to_mail: default + cc_mail: '' + bcc_mail: '' + from_mail: '[yamlform-submission:values:email:raw]' + from_name: '[yamlform-submission:values:first_name] [yamlform-submission:values:last_name]' + subject: default + body: default + excluded_elements: { } + html: true + attachments: false + debug: false diff --git a/modules/yamlform_templates/config/install/yamlform.yamlform.template_user_profile.yml b/modules/yamlform_templates/config/install/yamlform.yamlform.template_user_profile.yml new file mode 100644 index 0000000..8886516 --- /dev/null +++ b/modules/yamlform_templates/config/install/yamlform.yamlform.template_user_profile.yml @@ -0,0 +1,204 @@ +langcode: en +status: false +dependencies: { } +uid: null +template: true +id: template_user_profile +title: 'User Profile' +description: 'A user profile form template.' +elements: | + account_information: + '#title': 'Your Account Information' + '#type': fieldset + user_name: + '#type': textfield + '#title': 'User Name' + picture: + '#type': managed_file + '#title': 'Picture' + '#description': 'Your virtual face or picture. Pictures larger than 1024x1024 pixels will be scaled down.' + '#max_filesize': '2' + '#file_extensions': 'gif jpg png' + personal_information: + '#title': 'Your Personal Information' + '#type': fieldset + first_name: + '#title': 'First Name' + '#type': textfield + '#required': true + last_name: + '#type': textfield + '#title': 'Last Name' + '#required': true + country: + '#type': select + '#title': 'Country' + '#options': country_names + location: + '#type': location + '#title': 'Location' + '#title_display': invisible + '#description': 'Your location will be saved and may be shared.' + '#geolocation': true + '#address__title': 'Locations' + languages: + '#type': select + '#title': 'Languages Spoken' + '#description': 'Select one or more languages you speak.' + '#multiple': true + '#select2': true + '#options': languages + gender: + '#type': radios + '#title': 'Gender' + '#options': gender + biography: + '#type': text_format + '#title': 'Biography' + '#description': 'Please include a short blurb about yourself to let us know who you are outside of Drupal.' + website: + '#type': url + '#title': 'Website' + irc: + '#type': textfield + '#title': 'IRC' + '#description': 'The nickname you use on various channels of irc.freenode.net' + twitter: + '#type': textfield + '#title': 'Twitter' + '#description': 'Your Twitter handle.' + github: + '#type': textfield + '#title': 'GitHub' + '#description': 'Your GitHub user name.' + work_information: + '#title': 'Your Work Information' + '#type': fieldset + current_organization: + '#type': textfield + '#title': 'Current Organization' + current_title: + '#type': textfield + '#title': 'Current Job Title' + organizations: + '#type': textarea + '#title': 'Past Organizations' + '#description': 'List companies or institutions you have worked for.' + industries: + '#type': select_other + '#title': 'Industries Worked In' + '#options': industry + '#multiple': true + '#select2': true + email_settings: + '#title': 'E-mail addresses' + '#type': fieldset + email: + '#type': email + '#title': 'Primary E-mall Address' + '#description': 'Enter your primary e-mail addresses, which will be used for all e-mail communications.' + emails: + '#type': email_multiple + '#title': 'Secondary E-mall Addresses' + '#description': 'Enter multiple e-mail addresses seperated by commas.' + regional_settings: + '#title': 'Regional Settings' + '#type': fieldset + time_zone: + '#type': select + '#title': 'Timezone' + '#options': time_zones + language: + '#type': select + '#title': 'Preferred Language' + '#description': 'This account''s default language for e-mails, and preferred language for site presentation.' + '#options': languages +settings: + page: true + page_submit_path: '' + page_confirm_path: '' + form_submit_label: Register + form_exception_message: '' + form_closed_message: '' + form_confidential: false + form_confidential_message: '' + form_prepopulate: false + form_prepopulate_source_entity: false + form_novalidate: false + form_autofocus: false + form_details_toggle: false + wizard_progress_bar: true + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_next_button_label: '' + wizard_prev_button_label: '' + wizard_start_label: '' + wizard_complete: true + wizard_complete_label: '' + preview: 0 + preview_next_button_label: '' + preview_prev_button_label: '' + preview_message: '' + draft: false + draft_auto_save: false + draft_button_label: '' + draft_saved_message: '' + draft_loaded_message: '' + confirmation_type: page + confirmation_message: '' + confirmation_url: '' + limit_total: null + limit_total_message: '' + limit_user: null + limit_user_message: '' + entity_limit_total: null + entity_limit_user: null + results_disabled: false + results_disabled_ignore: false + token_update: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + view_any: + roles: { } + users: { } + update_any: + roles: { } + users: { } + delete_any: + roles: { } + users: { } + purge_any: + roles: { } + users: { } + view_own: + roles: { } + users: { } + update_own: + roles: { } + users: { } + delete_own: + roles: { } + users: { } +handlers: + email_notification: + id: email + label: 'Email Notification' + handler_id: email_notification + status: true + weight: 1 + settings: + to_mail: default + cc_mail: '' + bcc_mail: '' + from_mail: '[yamlform-submission:values:email:raw]' + from_name: '[yamlform-submission:values:first_name] [yamlform-submission:values:last_name]' + subject: default + body: default + excluded_elements: { } + html: true + attachments: false + debug: false diff --git a/src/BreadCrumb/YamlFormBreadcrumbBuilder.php b/src/BreadCrumb/YamlFormBreadcrumbBuilder.php index 3902650..4ac716e 100644 --- a/src/BreadCrumb/YamlFormBreadcrumbBuilder.php +++ b/src/BreadCrumb/YamlFormBreadcrumbBuilder.php @@ -61,7 +61,9 @@ class YamlFormBreadcrumbBuilder implements BreadcrumbBuilderInterface { $this->type = 'yamlform_submission'; } elseif (($route_match->getParameter('yamlform') instanceof YamlFormInterface && $route_match->getParameter('yamlform')->access('admin'))) { - $this->type = 'yamlform'; + /** @var \Drupal\yamlform\YamlFormInterface $yamlform */ + $yamlform = $route_match->getParameter('yamlform'); + $this->type = ($yamlform->isTemplate() && \Drupal::moduleHandler()->moduleExists('yamlform_templates')) ? 'yamlform_template' : 'yamlform'; } else { $this->type = NULL; @@ -106,6 +108,10 @@ class YamlFormBreadcrumbBuilder implements BreadcrumbBuilderInterface { $breadcrumb->addLink(Link::createFromRoute($this->t('Structure'), 'system.admin_structure')); $breadcrumb->addLink(Link::createFromRoute($this->t('Forms'), 'entity.yamlform.collection')); switch ($this->type) { + case 'yamlform_template': + $breadcrumb->addLink(Link::createFromRoute('Templates', 'entity.yamlform.templates')); + break; + case 'yamlform_element': /** @var \Drupal\yamlform\YamlFormInterface $yamlform */ $yamlform = $route_match->getParameter('yamlform'); diff --git a/src/Element/YamlFormLikert.php b/src/Element/YamlFormLikert.php index 8373e35..77790e7 100755 --- a/src/Element/YamlFormLikert.php +++ b/src/Element/YamlFormLikert.php @@ -114,8 +114,8 @@ class YamlFormLikert extends FormElement { return; } - $na_value = (!empty($element['#na_answer_value'])) ? $element['#na_answer_value'] : ''; - $na_text = (!empty($element['#na_answer_text'])) ? $element['#na_answer_text'] : (string) t('N/A'); + $na_value = (!empty($element['#na_answer_value'])) ? $element['#na_answer_value'] : (string) t('N/A'); + $na_text = (!empty($element['#na_answer_text'])) ? $element['#na_answer_text'] : $na_value; $element['#answers'] += [ $na_value => $na_text, ]; @@ -127,7 +127,7 @@ class YamlFormLikert extends FormElement { public static function valueCallback(&$element, $input, FormStateInterface $form_state) { $default_value = []; foreach ($element['#questions'] as $question_key => $question_title) { - $default_value[$question_key] = ''; + $default_value[$question_key] = NULL; } if ($input === FALSE) { diff --git a/src/Element/YamlFormMessage.php b/src/Element/YamlFormMessage.php index f01b367..3601d16 100644 --- a/src/Element/YamlFormMessage.php +++ b/src/Element/YamlFormMessage.php @@ -60,6 +60,7 @@ class YamlFormMessage extends Container { 'error' => t('Error message'), 'warning' => t('Warning message'), ]; + $element['#attached']['library'][] = 'yamlform/yamlform.element.message'; // Set #states and .js-form-item (which is needed by #states). // @see core/misc/states.js diff --git a/src/Plugin/YamlFormElement/EntityAutocomplete.php b/src/Plugin/YamlFormElement/EntityAutocomplete.php index 502849d..3c6f8f8 100644 --- a/src/Plugin/YamlFormElement/EntityAutocomplete.php +++ b/src/Plugin/YamlFormElement/EntityAutocomplete.php @@ -68,6 +68,13 @@ class EntityAutocomplete extends YamlFormElementBase implements YamlFormEntityRe if ($this->hasMultipleValues($element)) { $element['#after_build'][] = [get_class($this), 'afterBuildEntityAutocomplete']; } + + // If selection handler include auto_create when need to also set it for + // the $element. + // @see \Drupal\Core\Entity\Element\EntityAutocomplete::validateEntityAutocomplete + if (!empty($element['#selection_settings']['auto_create_bundle'])) { + $element['#autocreate']['bundle'] = $element['#selection_settings']['auto_create_bundle']; + } } /** @@ -87,7 +94,18 @@ class EntityAutocomplete extends YamlFormElementBase implements YamlFormEntityRe if (is_array($value) && !empty($value)) { $entity_ids = []; foreach ($value as $item) { - $entity_ids[] = $item['target_id']; + if (isset($item['target_id'])) { + $entity_ids[] = $item['target_id']; + } + elseif (isset($item['entity'])) { + // If #auto_create is set then we need to save the entity and get + // the new entity's id. + // @todo Decide what level of access controls are needed to allow + // users to create entities. + $entity = $item['entity']; + $entity->save(); + $entity_ids[] = $entity->id(); + } } $form_state->setValueForElement($element, $entity_ids); } diff --git a/src/Plugin/YamlFormElement/ManagedFile.php b/src/Plugin/YamlFormElement/ManagedFile.php index a4a0024..c632bfa 100644 --- a/src/Plugin/YamlFormElement/ManagedFile.php +++ b/src/Plugin/YamlFormElement/ManagedFile.php @@ -35,11 +35,11 @@ class ManagedFile extends YamlFormElementBase { $max_filesize = \Drupal::config('yamlform.settings')->get('elements.default_max_filesize') ?: file_upload_max_size(); $max_filesize = Bytes::toInt($max_filesize); $max_filesize = ($max_filesize / 1024 / 1024); - + $file_extensions = \Drupal::config('yamlform.settings')->get('elements.default_file_extensions'); return parent::getDefaultProperties() + [ 'multiple' => FALSE, 'max_filesize' => $max_filesize, - 'file_extensions' => 'gif jpg png', + 'file_extensions' => $file_extensions, 'uri_scheme' => 'private', ]; } @@ -83,6 +83,16 @@ class ManagedFile extends YamlFormElementBase { $element['#upload_validators']['file_validate_size'] = [$this->getMaxFileSize($element)]; $element['#upload_validators']['file_validate_extensions'] = [$this->getFileExtensions($element)]; $element['#element_validate'][] = [get_class($this), 'validate']; + + // Add file upload help to the element. + $element['help'] = [ + '#theme' => 'file_upload_help', + '#description' => '', + '#upload_validators' => $element['#upload_validators'], + '#cardinality' => (empty($element['#multiple'])) ? 1 : -1, + '#prefix' => '
', + '#suffix' => '
', + ]; } /** diff --git a/src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php b/src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php index c846537..8b3a47c 100644 --- a/src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php +++ b/src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php @@ -484,14 +484,19 @@ trait YamlFormEntityReferenceTrait { $form['entity_reference']['selection_settings']['include_anonymous']['#return_value'] = TRUE; } + // Remove the no-ajax submit button. unset( - // Remove auto create. - $form['entity_reference']['selection_settings']['auto_create'], - $form['entity_reference']['selection_settings']['auto_create_bundle'], - // Remove the no-ajax submit button. $form['entity_reference']['selection_settings']['target_bundles_update'] ); + // Remove auto create, except for entity_autocomplete. + if ($this->getPluginId() != 'entity_autocomplete' || $target_type != 'taxonomy_term') { + unset( + $form['entity_reference']['selection_settings']['auto_create'], + $form['entity_reference']['selection_settings']['auto_create_bundle'] + ); + } + // Disable AJAX callback that we don't need. unset($form['entity_reference']['selection_settings']['target_bundles']['#ajax']); unset($form['entity_reference']['selection_settings']['sort']['field']['#ajax']); diff --git a/tests/modules/yamlform_test/includes/yamlform_test.example_elements.yml b/tests/modules/yamlform_test/includes/yamlform_test.example_elements.yml index fac0575..a245c91 100644 --- a/tests/modules/yamlform_test/includes/yamlform_test.example_elements.yml +++ b/tests/modules/yamlform_test/includes/yamlform_test.example_elements.yml @@ -20,19 +20,10 @@ entity_autocomplete: include_anonymous: true language_select: '#languages': 3 +yamlform_autocomplete: + '#autocomplete_options': country_names yamlform_codemirror: '#mode': yaml -yamlform_likert: - '#questions': - q1: 'Please answer question 1?' - q2: 'How about now answering question 2?' - q3: 'Finally, here is question 3?' - '#answers': - 1: 1 - 2: 2 - 3: 3 - 4: 4 - 5: 5 yamlform_entity_select: '#target_type': 'user' '#selection_handler': 'default:user' @@ -48,6 +39,17 @@ yamlform_entity_radios: '#selection_handler': 'default:user' '#selection_settings': include_anonymous: true +yamlform_likert: + '#questions': + q1: 'Please answer question 1?' + q2: 'How about now answering question 2?' + q3: 'Finally, here is question 3?' + '#answers': + 1: 1 + 2: 2 + 3: 3 + 4: 4 + 5: 5 yamlform_message: '#message_type': 'warning' '#message_message': 'This is a warning message.' diff --git a/yamlform.libraries.yml b/yamlform.libraries.yml index 16fd6c4..f3be95c 100755 --- a/yamlform.libraries.yml +++ b/yamlform.libraries.yml @@ -215,6 +215,12 @@ yamlform.element.location: - core/jquery.once - yamlform/jquery.geocomplete +yamlform.element.message: + version: 1.x + css: + theme: + css/yamlform.element.message.css: {} + yamlform.element.options: version: 1.x css: