Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Block, shortcode, and functions that render just the button. #84

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

benlk
Copy link
Collaborator

@benlk benlk commented Aug 22, 2020

Changes

This pull request makes the following changes:

  • Refactors the Republication Tracker Tool widget to create two new static functions:
    • Republication_Tracker_Tool_Widget::button_output( $label = '' ); when echoed returns the button of the widget that opens the modal, with the optional parameter$label that changes the button text from the default
    • Republication_Tracker_Tool_Widget::maybe_print_modal_content(); which, when echoed, if the modal content has not already been output on the page, does so.
  • Adds a [republication_modal_button label=""] shortcode that outputs a button that will open the modal, with the optional parameter label="" to change the button text
  • Reduces selector specificity for widget-provided styles on button.republication-tracker-tool-button
  • Makes notes about all of that in the docs/ directory
  • The property Republication_Tracker_Tool_Widget->has_instance is now Republication_Tracker_Tool->has_instance.

Why

For #66 and https://github.com/PublicI/umbrella-public-integrity/issues/65

Testing/Questions

Features that this PR affects:

  • The Block Editor: adds a block
  • The post editor: adds a shortcode
  • The Widget output: changes some of how the widget is output upon the page
  • The property Republication_Tracker_Tool_Widget->has_instance is now Republication_Tracker_Tool->has_instance, which may have effects on third-party code.

Questions that need to be answered before merging:

  • Is this PR targeting the correct branch in this repository?
  • Does this work in Largo and outside of it?
    • I've tested it on Largo and on the publicintegrity.org theme
  • Are you worried about the property Republication_Tracker_Tool_Widget->has_instance moving to Republication_Tracker_Tool->has_instance?
  • Do the new block and shortcode require screenshots?

Steps to test this PR:

  1. Add some shortcodes to a post content:
    • [republication_modal_button label=""]
    • [republication_modal_button label="Cheese"]
    • [republication_modal_button label="Llanfair­pwllgwyngyll­gogery­chwyrn­drobwll­llan­tysilio­gogo­goch"]
    • [republication_modal_button label="The Republication Tracker Tool is designed to make sharing your content easier."]
    • [republication_modal_button]
  2. Add some Republication Modal Button blocks to some posts.
  3. Add some Republication Tracker Tool widgets to some widget areas on post pages.
  4. Visit the post pages and make sure that nothing is horribly broken.

Before merging this PR:

  • update readme.txt to replace TKTK with this PR number.

Additional information

INN Member/Labs Client requesting: Center for Public Integrity

  • Contributor has read INN's GitHub code of conduct
  • Contributor would like to be mentioned in the release notes as: The Center for Public Integrity
  • Contributor agrees to the license terms of this repository.

benlk added 10 commits August 21, 2020 16:38
- pull the button and modal output out of the main widget() function of
  the widget and create them as static functions
- move the widget's has_instance boolean property to the plugin class,
  for tracking whether widget/shortcode/block has created a modal
- `wp scaffold` a block, using a shortcode as a render callback
- add a shortcode to this plugin that outputs the button and enqueues
  necessary assets like the modal and its CSS and JavaScript files
@benlk benlk added category: feature request New/added features community contribution From outside contributors labels Aug 22, 2020
@benlk benlk self-assigned this Aug 22, 2020
@benlk benlk added this to the Version 1.0.3 milestone Aug 28, 2020
@benlk benlk mentioned this pull request Sep 1, 2020
@benlk benlk requested a review from a team as a code owner May 24, 2022 10:19
@adekbadek
Copy link
Member

Hi @benlk – could you please resolve the conflicts here?

@benlk
Copy link
Collaborator Author

benlk commented Jun 8, 2022

Hi @adekbadek — An Automattician who worked on the AMP compatibility for this plugin should handle the merge conflict here; I'm not familiar with the changes that it introduced and it's been almost two years since I worked on this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: feature request New/added features community contribution From outside contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants