/** * This method is responsible for what is rendered in any column with a * name/slug of 'title'. * * Every time the class needs to render a column, it first looks for a method * named column_{$column_title}, if it exists, that method is run, otherwise, * column_default() is called. * * Actions can be generated here. * * @param WP_Post $item * @return string * @access public */ public function column_title($item) { $current_screen = get_current_screen(); if (empty($current_screen->parent_base)) { return; } // Build the base URL $base_url = add_query_arg(array('page' => $current_screen->parent_base, 'post_id' => $item->ID), get_admin_url(null, 'admin.php')); // Add common actions $actions = array('settings' => sprintf("<a href='%s'>%s</a>", esc_url(Admin_Apple_Index_Page::action_query_params('settings', $base_url)), esc_html__('Options', 'apple-news')), 'export' => sprintf("<a href='%s'>%s</a>", esc_url(Admin_Apple_Index_Page::action_query_params('export', $base_url)), esc_html__('Download', 'apple-news'))); // Only add push if the article is not pending publish $pending = get_post_meta($item->ID, 'apple_news_api_pending', true); if (empty($pending)) { $actions['push'] = sprintf("<a href='%s'>%s</a>", esc_url(Admin_Apple_Index_Page::action_query_params('push', $base_url)), esc_html__('Publish', 'apple-news')); } // Add the delete action, if required if (get_post_meta($item->ID, 'apple_news_api_id', true)) { $actions['delete'] = sprintf("<a title='%s' href='%s'>%s</a>", esc_html__('Delete from Apple News', 'apple-news'), esc_url(Admin_Apple_Index_Page::action_query_params('delete', $base_url)), esc_html__('Delete', 'apple-news')); } // Create the share URL $share_url = get_post_meta($item->ID, 'apple_news_api_share_url', true); if ($share_url) { $actions['share'] = sprintf("<a class='share-url-button' title='%s' href='#'>%s</a><br/><input type='text' name='share-url-%s' class='apple-share-url' value='%s' />", esc_html__('Preview in News app', 'apple-news'), esc_html__('Copy News URL', 'apple-news'), absint($item->ID), esc_url($share_url)); } // Return the row action HTML return apply_filters('apple_news_column_title', sprintf('%1$s <span>(id:%2$s)</span> %3$s', esc_html($item->post_title), absint($item->ID), $this->row_actions($actions)), $item, $actions); }
esc_html_e('bottom', 'apple-news'); ?> </option> </select> <p class="description"><?php esc_html_e('The position in the article where the pull quote will appear.', 'apple-news'); ?> </p> </td> </tr> </table> <?php do_action('apple_news_after_single_settings'); ?> <p class="submit"> <a href="<?php echo esc_url(Admin_Apple_Index_Page::action_query_params('', admin_url('admin.php?page=apple_news_index'))); ?> " class="button"><?php esc_html_e('Back', 'apple-news'); ?> </a> <button type="submit" class="button button-primary"><?php esc_html_e('Save Settings and Publish to Apple News', 'apple-news'); ?> </button> </p> </form> </div>
/** * Get bulk actions. * * @return array * @access public */ public function get_bulk_actions() { return apply_filters('apple_news_bulk_actions', array(Admin_Apple_Index_Page::namespace_action('push') => __('Publish', 'apple-news'))); }