{"action":"created","comment":{"url":"https://api.github.com/repos/xwp/travel/pulls/comments/181850830","pull_request_review_id":112547223,"id":181850830,"diff_hunk":"@@ -22,6 +29,108 @@ public function init() {\n \t\tadd_action( 'activity_edit_form_fields', array( $this, 'edit_activity_meta_fields' ) );\n \t\tadd_action( 'edit_activity', array( $this, 'save_activity_meta' ) );\n \t\tadd_action( 'create_activity', array( $this, 'save_activity_meta' ) );\n+\n+\t\tadd_action( 'location_add_form_fields', array( $this, 'add_location_meta_fields' ) );\n+\t\tadd_action( 'location_edit_form_fields', array( $this, 'edit_location_meta_fields' ) );\n+\t\tadd_action( 'edit_location', array( $this, 'save_location_meta' ) );\n+\t\tadd_action( 'create_location', array( $this, 'save_location_meta' ) );\n+\n+\t\tadd_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );\n+\t}\n+\n+\t/**\n+\t * Enqueue admin scripts.\n+\t */\n+\tpublic function enqueue_admin_scripts() {\n+\t\tif ( ! isset( $_GET['taxonomy'] ) || 'location' !== $_GET['taxonomy'] ) {\n+\t\t\treturn;\n+\t\t}\n+\t\twp_enqueue_media();\n+\n+\t\twp_enqueue_script(\n+\t\t\t'amp-travel-term-controls',\n+\t\t\tget_template_directory_uri() . '/assets/js/term-controls.js',\n+\t\t\tarray( 'underscore', 'jquery' )\n+\t\t);\n+\t}\n+\n+\t/**\n+\t * Add location meta fields to add form.\n+\t */\n+\tpublic function add_location_meta_fields() {\n+\t\t?>\n+\t\t<div class='form-field form-required location-cover-image-wrap'>\n+\t\t\t<label for='location-cover-image'><?php esc_html_e( 'Activity Cover Image' ); ?></label>\n+\t\t\t<input type='hidden' id='location-cover-image-value' class='small-text' name='location-cover-image-value' value='' />\n+\t\t\t<input type='button' id='location-cover-image' class='button location-cover-image-upload-button' value='<?php esc_html_e( 'Upload' ); ?>' />\n+\t\t\t<input type='button' id='location-cover-image-remove' class='button location-cover-image-upload-button-remove' value='<?php esc_html_e( 'Remove' ); ?>' />\n+\t\t\t<div id='location-cover-image-preview'></div>\n+\t\t</div>\n+\t\t<div class='form-field form-required location-is-featured-wrape'>\n+\t\t\t<label for='location-is-featured'><?php esc_html_e( 'Featured destination' ); ?></label>\n+\t\t\t<input type=\"checkbox\" name=\"location-featured-destination\" value=\"1\" />\n+\t\t</div>\n+\t\t<?php\n+\t}\n+\n+\t/**\n+\t * Add meta fields to term edit.\n+\t *\n+\t * @param WP_Term $term WP_Term being edited.\n+\t */\n+\tpublic function edit_location_meta_fields( $term ) {\n+\t\t$cover_img_id = get_term_meta( $term->term_id, 'amp_travel_location_img', true );\n+\t\tif ( empty( $cover_img_id ) ) {\n+\t\t\t$cover_img_id = '';\n+\t\t} else {\n+\t\t\t$img_src = wp_get_attachment_image_src( $cover_img_id );\n+\t\t}\n+\n+\t\t$is_featured = get_term_meta( $term->term_id, 'amp_travel_featured', true );\n+\n+\t\t?>\n+\t\t<tr class='form-field form-required location-cover-image-wrap'>\n+\t\t\t<th scope=\"row\"><label for='location-cover-image'><?php esc_html_e( 'Activity Cover Image' ); ?></label></th>\n+\t\t\t<td>\n+\t\t\t\t<?php wp_nonce_field( basename( __FILE__ ), 'travel_location_meta_nonce' ); ?>\n+\n+\t\t\t\t<input type='hidden' id='location-cover-image-value' class='small-text' name='location-cover-image-value' value='<?php esc_attr( $cover_img_id ); ?>' />\n+\t\t\t\t<input type='button' id='location-cover-image' class='button location-cover-image-upload-button' value='<?php esc_html_e( 'Upload' ); ?>' />\n+\t\t\t\t<input type='button' id='location-cover-image-remove' class='button location-cover-image-upload-button-remove' value='<?php esc_html_e( 'Remove' ); ?>' />\n+\t\t\t\t<div id='location-cover-image-preview'><?php echo empty( $img_src ) ? '' : '<img src=\"' . esc_url( $img_src[0] ) . '\" style=\"max-width: 100%;\" />'; ?></div>\n+\t\t\t</td>\n+\t\t</tr>\n+\t\t<tr class='form-field form-required'>\n+\t\t\t<th scope=\"row\"><label for='location-is-featured'><?php esc_html_e( 'Featured destination' ); ?></label></th>\n+\t\t\t<td>\n+\t\t\t\t<input type=\"checkbox\" name=\"location-is-featured\" value=\"1\" <?php echo $is_featured ? esc_html( 'checked' ) : ''; ?> />\n+\t\t\t</td>\n+\t\t</tr>\n+\t\t<?php\n+\t}\n+\n+\t/**\n+\t * Save Location meta values on adding and editing the term.\n+\t *\n+\t * @param integer $term_id Term ID.\n+\t */\n+\tpublic function save_location_meta( $term_id ) {\n+\n+\t\tif ( ! wp_verify_nonce( $_POST['travel_location_meta_nonce'], basename( __FILE__ ) ) ) {","path":"includes/class-amp-travel-taxonomies.php","position":null,"original_position":105,"commit_id":"fe7bb55e8d838495555ad3980ad787cfc7198546","original_commit_id":"c984df8bfe9f292fb5e0aa3e4f8ea9265f8ed920","user":{"login":"kienstra","id":4063887,"avatar_url":"https://avatars2.githubusercontent.com/u/4063887?v=4","gravatar_id":"","url":"https://api.github.com/users/kienstra","html_url":"https://github.com/kienstra","followers_url":"https://api.github.com/users/kienstra/followers","following_url":"https://api.github.com/users/kienstra/following{/other_user}","gists_url":"https://api.github.com/users/kienstra/gists{/gist_id}","starred_url":"https://api.github.com/users/kienstra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kienstra/subscriptions","organizations_url":"https://api.github.com/users/kienstra/orgs","repos_url":"https://api.github.com/users/kienstra/repos","events_url":"https://api.github.com/users/kienstra/events{/privacy}","received_events_url":"https://api.github.com/users/kienstra/received_events","type":"User","site_admin":false},"body":"Thanks, `save_location_meta()` looks to be working.","created_at":"2018-04-16T19:01:47Z","updated_at":"2018-04-16T19:01:48Z","html_url":"https://github.com/xwp/travel/pull/34#discussion_r181850830","pull_request_url":"https://api.github.com/repos/xwp/travel/pulls/34","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/xwp/travel/pulls/comments/181850830"},"html":{"href":"https://github.com/xwp/travel/pull/34#discussion_r181850830"},"pull_request":{"href":"https://api.github.com/repos/xwp/travel/pulls/34"}},"in_reply_to_id":181500919},"pull_request":{"url":"https://api.github.com/repos/xwp/travel/pulls/34","id":179947442,"html_url":"https://github.com/xwp/travel/pull/34","diff_url":"https://github.com/xwp/travel/pull/34.diff","patch_url":"https://github.com/xwp/travel/pull/34.patch","issue_url":"https://api.github.com/repos/xwp/travel/issues/34","number":34,"state":"open","locked":false,"title":"[Gutenberg] Add \"Featured Destinations\" homepage block","user":{"login":"miina","id":3294597,"avatar_url":"https://avatars1.githubusercontent.com/u/3294597?v=4","gravatar_id":"","url":"https://api.github.com/users/miina","html_url":"https://github.com/miina","followers_url":"https://api.github.com/users/miina/followers","following_url":"https://api.github.com/users/miina/following{/other_user}","gists_url":"https://api.github.com/users/miina/gists{/gist_id}","starred_url":"https://api.github.com/users/miina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miina/subscriptions","organizations_url":"https://api.github.com/users/miina/orgs","repos_url":"https://api.github.com/users/miina/repos","events_url":"https://api.github.com/users/miina/events{/privacy}","received_events_url":"https://api.github.com/users/miina/received_events","type":"User","site_admin":false},"body":"~~Based on #12 and #31.~~\r\n\r\nAims to do the following:\r\n- [x] Pull data dynamically to editor.\r\n- [x] Sorts and renders the terms according to the uploaded images.\r\n- [x] Register and add relevant meta to `location` term.","created_at":"2018-04-06T13:24:07Z","updated_at":"2018-04-16T19:01:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc8e6d768aa8007ec963e908cbdc219c30df6ad8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/xwp/travel/pulls/34/commits","review_comments_url":"https://api.github.com/repos/xwp/travel/pulls/34/comments","review_comment_url":"https://api.github.com/repos/xwp/travel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xwp/travel/issues/34/comments","statuses_url":"https://api.github.com/repos/xwp/travel/statuses/fe7bb55e8d838495555ad3980ad787cfc7198546","head":{"label":"xwp:feature/25-featured_block","ref":"feature/25-featured_block","sha":"fe7bb55e8d838495555ad3980ad787cfc7198546","user":{"login":"xwp","id":9003139,"avatar_url":"https://avatars2.githubusercontent.com/u/9003139?v=4","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"repo":{"id":126378271,"name":"travel","full_name":"xwp/travel","owner":{"login":"xwp","id":9003139,"avatar_url":"https://avatars2.githubusercontent.com/u/9003139?v=4","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xwp/travel","description":null,"fork":false,"url":"https://api.github.com/repos/xwp/travel","forks_url":"https://api.github.com/repos/xwp/travel/forks","keys_url":"https://api.github.com/repos/xwp/travel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xwp/travel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xwp/travel/teams","hooks_url":"https://api.github.com/repos/xwp/travel/hooks","issue_events_url":"https://api.github.com/repos/xwp/travel/issues/events{/number}","events_url":"https://api.github.com/repos/xwp/travel/events","assignees_url":"https://api.github.com/repos/xwp/travel/assignees{/user}","branches_url":"https://api.github.com/repos/xwp/travel/branches{/branch}","tags_url":"https://api.github.com/repos/xwp/travel/tags","blobs_url":"https://api.github.com/repos/xwp/travel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xwp/travel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xwp/travel/git/refs{/sha}","trees_url":"https://api.github.com/repos/xwp/travel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xwp/travel/statuses/{sha}","languages_url":"https://api.github.com/repos/xwp/travel/languages","stargazers_url":"https://api.github.com/repos/xwp/travel/stargazers","contributors_url":"https://api.github.com/repos/xwp/travel/contributors","subscribers_url":"https://api.github.com/repos/xwp/travel/subscribers","subscription_url":"https://api.github.com/repos/xwp/travel/subscription","commits_url":"https://api.github.com/repos/xwp/travel/commits{/sha}","git_commits_url":"https://api.github.com/repos/xwp/travel/git/commits{/sha}","comments_url":"https://api.github.com/repos/xwp/travel/comments{/number}","issue_comment_url":"https://api.github.com/repos/xwp/travel/issues/comments{/number}","contents_url":"https://api.github.com/repos/xwp/travel/contents/{+path}","compare_url":"https://api.github.com/repos/xwp/travel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xwp/travel/merges","archive_url":"https://api.github.com/repos/xwp/travel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xwp/travel/downloads","issues_url":"https://api.github.com/repos/xwp/travel/issues{/number}","pulls_url":"https://api.github.com/repos/xwp/travel/pulls{/number}","milestones_url":"https://api.github.com/repos/xwp/travel/milestones{/number}","notifications_url":"https://api.github.com/repos/xwp/travel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xwp/travel/labels{/name}","releases_url":"https://api.github.com/repos/xwp/travel/releases{/id}","deployments_url":"https://api.github.com/repos/xwp/travel/deployments","created_at":"2018-03-22T18:24:12Z","updated_at":"2018-04-16T18:31:59Z","pushed_at":"2018-04-16T18:35:11Z","git_url":"git://github.com/xwp/travel.git","ssh_url":"git@github.com:xwp/travel.git","clone_url":"https://github.com/xwp/travel.git","svn_url":"https://github.com/xwp/travel","homepage":null,"size":10261,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":17,"watchers":1,"default_branch":"develop"}},"base":{"label":"xwp:develop","ref":"develop","sha":"987d01296cfe29af8c96235545c0c229e43ce163","user":{"login":"xwp","id":9003139,"avatar_url":"https://avatars2.githubusercontent.com/u/9003139?v=4","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"repo":{"id":126378271,"name":"travel","full_name":"xwp/travel","owner":{"login":"xwp","id":9003139,"avatar_url":"https://avatars2.githubusercontent.com/u/9003139?v=4","gravatar_id":"","url":"https://api.github.com/users/xwp","html_url":"https://github.com/xwp","followers_url":"https://api.github.com/users/xwp/followers","following_url":"https://api.github.com/users/xwp/following{/other_user}","gists_url":"https://api.github.com/users/xwp/gists{/gist_id}","starred_url":"https://api.github.com/users/xwp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xwp/subscriptions","organizations_url":"https://api.github.com/users/xwp/orgs","repos_url":"https://api.github.com/users/xwp/repos","events_url":"https://api.github.com/users/xwp/events{/privacy}","received_events_url":"https://api.github.com/users/xwp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xwp/travel","description":null,"fork":false,"url":"https://api.github.com/repos/xwp/travel","forks_url":"https://api.github.com/repos/xwp/travel/forks","keys_url":"https://api.github.com/repos/xwp/travel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xwp/travel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xwp/travel/teams","hooks_url":"https://api.github.com/repos/xwp/travel/hooks","issue_events_url":"https://api.github.com/repos/xwp/travel/issues/events{/number}","events_url":"https://api.github.com/repos/xwp/travel/events","assignees_url":"https://api.github.com/repos/xwp/travel/assignees{/user}","branches_url":"https://api.github.com/repos/xwp/travel/branches{/branch}","tags_url":"https://api.github.com/repos/xwp/travel/tags","blobs_url":"https://api.github.com/repos/xwp/travel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xwp/travel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xwp/travel/git/refs{/sha}","trees_url":"https://api.github.com/repos/xwp/travel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xwp/travel/statuses/{sha}","languages_url":"https://api.github.com/repos/xwp/travel/languages","stargazers_url":"https://api.github.com/repos/xwp/travel/stargazers","contributors_url":"https://api.github.com/repos/xwp/travel/contributors","subscribers_url":"https://api.github.com/repos/xwp/travel/subscribers","subscription_url":"https://api.github.com/repos/xwp/travel/subscription","commits_url":"https://api.github.com/repos/xwp/travel/commits{/sha}","git_commits_url":"https://api.github.com/repos/xwp/travel/git/commits{/sha}","comments_url":"https://api.github.com/repos/xwp/travel/comments{/number}","issue_comment_url":"https://api.github.com/repos/xwp/travel/issues/comments{/number}","contents_url":"https://api.github.com/repos/xwp/travel/contents/{+path}","compare_url":"https://api.github.com/repos/xwp/travel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xwp/travel/merges","archive_url":"https://api.github.com/repos/xwp/travel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xwp/travel/downloads","issues_url":"https://api.github.com/repos/xwp/travel/issues{/number}","pulls_url":"https://api.github.com/repos/xwp/travel/pulls{/number}","milestones_url":"https://api.github.com/repos/xwp/travel/milestones{/number}","notifications_url":"https://api.github.com/repos/xwp/travel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xwp/travel/labels{/name}","releases_url":"https://api.github.com/repos/xwp/travel/releases{/id}","deployments_url":"https://api.github.com/repos/xwp/travel/deployments","created_at":"2018-03-22T18:24:12Z","updated_at":"2018-04-16T18:31:59Z","pushed_at":"2018-04-16T18:35:11Z","git_url":"git://github.com/xwp/travel.git","ssh_url":"git@github.com:xwp/travel.git","clone_url":"https://github.com/xwp/travel.git","svn_url":"https://github.com/xwp/travel","homepage":null,"size":10261,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":17,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/xwp/travel/pulls/34"},"html":{"href":"https://github.com/xwp/travel/pull/34"},"issue":{"href":"https://api.github.com/repos/xwp/travel/issues/34"},"comments":{"href":"https://api.github.com/repos/xwp/travel/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/xwp/travel/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/xwp/travel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xwp/travel/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/xwp/travel/statuses/fe7bb55e8d838495555ad3980ad787cfc7198546"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kienstra"}}