{"action":"created","issue":{"url":"https://api.github.com/repos/pojome/elementor/issues/5771","repository_url":"https://api.github.com/repos/pojome/elementor","labels_url":"https://api.github.com/repos/pojome/elementor/issues/5771/labels{/name}","comments_url":"https://api.github.com/repos/pojome/elementor/issues/5771/comments","events_url":"https://api.github.com/repos/pojome/elementor/issues/5771/events","html_url":"https://github.com/pojome/elementor/issues/5771","id":361815022,"node_id":"MDU6SXNzdWUzNjE4MTUwMjI=","number":5771,"title":"Actual label wont display in email when using the label | value method","user":{"login":"tehg33k","id":10551687,"node_id":"MDQ6VXNlcjEwNTUxNjg3","avatar_url":"https://avatars1.githubusercontent.com/u/10551687?v=4","gravatar_id":"","url":"https://api.github.com/users/tehg33k","html_url":"https://github.com/tehg33k","followers_url":"https://api.github.com/users/tehg33k/followers","following_url":"https://api.github.com/users/tehg33k/following{/other_user}","gists_url":"https://api.github.com/users/tehg33k/gists{/gist_id}","starred_url":"https://api.github.com/users/tehg33k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tehg33k/subscriptions","organizations_url":"https://api.github.com/users/tehg33k/orgs","repos_url":"https://api.github.com/users/tehg33k/repos","events_url":"https://api.github.com/users/tehg33k/events{/privacy}","received_events_url":"https://api.github.com/users/tehg33k/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-19T15:53:48Z","updated_at":"2018-09-20T12:42:04Z","closed_at":"2018-09-20T12:42:04Z","author_association":"NONE","body":"This is for a Form, with the label | value option added in Elementor Pro 2.1\r\n\r\nFor the new form label | value notation, do I still have access to the label they chose? My client's form is using a field called \"Reason for contacting\". I want to send an email to different addresses (value) based on their selection, but in that email I need to display the actual reason (label).\r\n"},"comment":{"url":"https://api.github.com/repos/pojome/elementor/issues/comments/423168465","html_url":"https://github.com/pojome/elementor/issues/5771#issuecomment-423168465","issue_url":"https://api.github.com/repos/pojome/elementor/issues/5771","id":423168465,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzE2ODQ2NQ==","user":{"login":"bainternet","id":660572,"node_id":"MDQ6VXNlcjY2MDU3Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/660572?v=4","gravatar_id":"","url":"https://api.github.com/users/bainternet","html_url":"https://github.com/bainternet","followers_url":"https://api.github.com/users/bainternet/followers","following_url":"https://api.github.com/users/bainternet/following{/other_user}","gists_url":"https://api.github.com/users/bainternet/gists{/gist_id}","starred_url":"https://api.github.com/users/bainternet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bainternet/subscriptions","organizations_url":"https://api.github.com/users/bainternet/orgs","repos_url":"https://api.github.com/users/bainternet/repos","events_url":"https://api.github.com/users/bainternet/events{/privacy}","received_events_url":"https://api.github.com/users/bainternet/received_events","type":"User","site_admin":false},"created_at":"2018-09-20T12:42:04Z","updated_at":"2018-09-20T12:42:04Z","author_association":"COLLABORATOR","body":"Thanks for reporting,\r\nNext time, Please follow guidelines for opening a new [issue report](https://github.com/pojome/elementor/issues/new?template=Bug_report.md), so we can help you better.\r\n\r\n\r\nAs for the \"issue\" described, its not an issue and it works just as we developed it.\r\n\r\nif you want the label to be sent as well you can use the provided hooks to add the label, for example, this snippet will send \"label: value\" to the email.\r\n\r\n```PHP\r\n/**\r\n * @param array  $field\r\n * @param ElementorPro\\Modules\\Forms\\Classes\\Form_Record  $record\r\n * @param ElementorPro\\Modules\\Forms\\Classes\\Ajax_Handler $ajax_handler\r\n */\r\nadd_action( 'elementor_pro/forms/process/select', function ( $field, $record, $ajax_handler ) {\r\n\t// Get Form Fields Settings and find current field\r\n\t$settings = $record->get( 'form_settings' );\r\n\t$current_field_settings = [];\r\n\tforeach ( $settings['form_fields'] as $form_field ) {\r\n\t\tif ( $form_field['_id'] === $field['id'] ) {\r\n\t\t\t$current_field_settings = $form_field;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\t// Get current field options\r\n\t$options = preg_split( \"/\\\\r\\\\n|\\\\r|\\\\n/\", $current_field_settings['field_options'] );\r\n\r\n\tif ( ! $options ) {\r\n\t\treturn '';\r\n\t}\r\n\t// loop over the options and find the selected one\r\n\tforeach ( $options as $option ) {\r\n\t\tif ( false === strpos( $option, '|' ) ) {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tlist( $label, $value ) = explode( '|', $option );\r\n\t\tif ( $value === $field['raw_value'] ) {\r\n\t\t\t// This is a match so we set the value to contain the label as well\r\n\t\t\t$record->update_field( $field['id'], 'value', $label . ': ' . $value );\r\n\t\t}\r\n\t}\r\n}, 10, 3 );\r\n```"}}
{"actor":{"display_login":"bainternet"}}