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

Plugin Stuff #50

Merged
merged 13 commits into from
Dec 6, 2023
Merged
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ node_modules
/plugins/two-factor/
/plugins/vaultpress/

# Loaded via Composer
/plugins/advanced-custom-fields-pro/
/plugins/cookie-law-info/
/plugins/pojo-accessibility/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this plugin necessary? Our general stance is to not use accessibility toolbars.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple thoughts here:

  • GB requested an a11y overlay tool, but I think it's still an open discuss about what that will be. @bd-viget let me know if we have a strong preference for this one (I don't remember this being on our list, I'll check in Notion)
  • The GDPR consent plugin decision is still open as well, although I thought we were leaning toward OneTrust (WPVIP's recommendation). Happy to pivot if this your preference though @bd-viget

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The accessibility plugin is the one I thought was in our GB requirements. I don't have any other suggestions on alternatives.

I just picked the most popular GDPR plugin, but if we need to use another one, I'm totally fine, not sold on any specific one.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clatwell @bd-viget I think it's worth digging into the why on the a11y plugin. @nathan-schmidt-viget wrote an article about why these are not just benign but harmful for accessibility. I'd guess that they "just want to cover accessibility" but don't know that we'll build an accessible site that won't need this plugin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bd-viget - Oh, you're right, I didn't realize that "pojo accessibility" was the One Click Accessibility plugin they recommended. @nathan-schmidt-viget had a recommendation for an alternative that shows errors directly on the page. See this comment.

@ten1seven - GB is a multi-site network in which individual Nonprofits will have full control over the Styles for their child sites in the network. We're providing eight default Style options that Nonprofits can use as a starting place, which will all meet a11y requirements, but ultimately Site Admins will be able to deviate from the defaults and customization color palettes at will for their sites. GB wants to include an a11y overlay / checker tool so that Site Admins can check that their custom color palettes meet a11y requirements. @nathan-schmidt-viget flagged some limitations here already (e.g., the plugin will flag issues, but won't fix them).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Nathan's recommendation for Accessibility Checker. It meets the need of site admins to check their color and content choices. Should that be installed instead of One Click Accessibility? That one is a true overlay that falls into the "not actually useful and potentially harmful" category.

Copy link
Contributor

@nathan-schmidt-viget nathan-schmidt-viget Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the plugin I recommended is kind of like the WAVE tool. It does not fix the issues but will at least flag them. One Click Accessibility does not show issues, but does "helpful" overlay stuff.
As long as we flag GB so they know that One Click Accessibility will not make a site pass A11Y and could make it harder for A11Y.

+1 on what @ten1seven said

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my take on why One Click Accessibility isn't needed:

Add a toolbar toggling hat[sp.] allows you to set:

  • Resize font (increase/decrease): users set zoom/font size with global browser and OS settings
  • Grayscale: users set screen colors with global browser and OS settings
  • Negative Contrast: users set screen contrast with global browser and OS settings
  • High Contrast: users set screen contrast with global browser and OS settings
  • Light Background: users that need this will have set it for all sites they visit
  • Links Underline: we'll ensure that links are visible as links, but users that need this will have set it for all sites they visit
  • Readable Font: we'll ensure a readable font size and contrast, but users that need this (like a dyslexia font) will have set it for all sites they visit
  • Link to Sitemap / Feedback / Help pages: we'll have these if they apply

Accessibility Features:

  • Enable skip to content: we'll build in a skip link
  • Add outline focus for focusable elements: we'll have ensured focusable elements have a focus outline
  • Remove the target attribute from links: this is more of a content creator awareness issue but "open in new tab" links can slip in with WordPress' WYSIWYG
  • Add landmark roles to all links: nice but not critical
  • Customizer for style adjustment: it would be good to have a dark mode option for the themes, but this seems similar to the visual settings in the section above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nathan-schmidt-viget Just a heads up, I swapped the plugins and saw this message, wanted to document it, we may need to purchase the paid version of this plugin. cc/ @clatwell @shascher

Whoops! It looks like your website is currently password protected. The free version of Accessibility Checker can only scan live websites. To scan this website for accessibility problems either remove the password protection or upgrade to pro. Scan results may be stored from a previous scan.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bd-viget do you need to remove /plugins/pojo-accessibility/ from .gitignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see any harm leaving it in here, just in case the GB team decides to push back on a different plugin. Tagging ticket #55 to remove this if necessary.

/plugins/svg-support/
/plugins/user-switching/
/plugins/woocommerce/

# Uploads directory
/uploads/

Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ See the [PHPCS documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki/

If you need help with anything, VIP's support team is [just a ticket away](https://wpvip.com/accessing-vip-support/).

## Your documentation here
## Additional Documentation

Feel free to add to or replace this README.md content with content unique to your project, for example:

* Project-specific notes; like a list of VIP environments and branches,
* Workflow documentation; so everyone working in this repo can follow a defined process, or
* Instructions for testing new features.

This can be detailed in the `docs/` directory.
More documentation can be found in [docs](docs/index.md).
11 changes: 11 additions & 0 deletions client-mu-plugins/goodbids/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "1.0",
"active-plugins": [
"advanced-custom-fields-pro/acf.php",
"woocommerce",
"pojo-accessibility",
"svg-support",
"cookie-law-info",
"user-switching"
]
}
66 changes: 59 additions & 7 deletions client-mu-plugins/goodbids/src/classes/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ class Core {

/**
* @since 1.0.0
* @var Core|null $instance
* @var Core|null
*/
private static ?Core $instance = null;

/**
* @since 1.0.0
* @var bool
*/
private bool $initialized = false;

/**
* @since 1.0.0
* @var array
*/
private array $config = [];

/**
* Constructor
*
Expand Down Expand Up @@ -52,11 +62,50 @@ public static function get_instance() : Core {
* @since 1.0.0
*/
public function init() {
if ( ! $this->load_config() ) {
// TODO: Log error.
return;
}

$this->load_plugins();

$this->initialized = true;
}

/**
* Sets the Plugin Config.
*
* @since 1.0.0
* @return bool
*/
private function load_config() {
$json_path = GOODBIDS_PLUGIN_PATH . 'config.json';
if ( ! file_exists( $json_path ) ) {
return false;
}

$json = json_decode( wpcom_vip_file_get_contents( $json_path ), true );

if ( ! is_array( $json ) ) {
return false;
}

$this->config = $json;

return true;
}

/**
* Get a config value.
*
* @param string $key Config Key.
*
* @return mixed|null
*/
public function get_config( string $key ) {
return $this->config[ $key ] ?? null;
}

/**
* Load 3rd Party Plugins.
*
Expand All @@ -67,11 +116,14 @@ private function load_plugins() {
return;
}

wpcom_vip_load_plugin( 'advanced-custom-fields-pro/acf.php' );
wpcom_vip_load_plugin( 'woocommerce' );
wpcom_vip_load_plugin( 'pojo-accessibility' );
wpcom_vip_load_plugin( 'svg-support' );
wpcom_vip_load_plugin( 'cookie-law-info' );
wpcom_vip_load_plugin( 'user-switching' );
$plugins = $this->get_config( 'active-plugins' );

if ( empty( $plugins ) || ! is_array( $plugins ) ) {
return;
}

foreach ( $plugins as $plugin ) {
wpcom_vip_load_plugin( $plugin );
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://github.com/automattic/vip-go-skeleton",
"license": "GPL-2.0-or-later",
"require": {
"php": ">=8.0"
"php": ">=8.1"
},
"require-dev": {
"automattic/vipwpcs": "^3",
Expand Down
23 changes: 7 additions & 16 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Document Your Application Here
# GoodBids

VIP encourages you to document your application in Markdown. This is a great way of keeping your documentation up to date with what the application actually does.
## Getting Started

You can create new Markdown files in this `docs/` directory for each important part of your application.
* [Local installation Guide](local.md)
* [Git Workflow](workflow.md)

## Examples

For example, you might have:
- `docs/local.md` that describes how to run your application locally
- `docs/REST.md` that describes any custom endpoints that your application has
- `docs/syndication.md` might describe how syndication works between subsites in your application
- `docs/build.md` describes what parts of your application gets built into the final deployable application
- `docs/qa.md` describes any manual or automated QA tests and processes that you have run on your application prior to deployment.
- etc.

## Benefits

Not only does this help you onboard your new engineers, it also helps VIP support staff to understand the moving parts or complexities of your application better at a glance, without having to dig into the code.
## Plugins

* [Installing Plugins](plugins/installing.md)
* [Activating Plugins](plugins/activating.md)
8 changes: 8 additions & 0 deletions docs/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ vip dev-env --slug=goodbids start
vip dev-env --slug=goodbids stop
```

### Install Dependencies

For ACF Pro, copy `auth.json.dist` to `auth.json` in `client-mu-plugins/goodbids` and use config from [ACF's Website](https://www.advancedcustomfields.com/my-account/view-licenses/). (Credentials are in 1Password)

Then, run `composer install` in the following directories:
1. `root`: Run at project root.
2. `client-mu-plugins/goodbids`: GoodBids MU Plugin

## Local Environment URL

[http://goodbids.vipdev.lndo.site/](http://goodbids.vipdev.lndo.site/)
Expand Down
23 changes: 23 additions & 0 deletions docs/plugins/activating.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Activating Plugins

## Global Plugins

Global plugins to be used on all sites can be activated by adding the plugin slug to the `active-plugins` array in the GoodBids MU Plugin `config.json` file.

If the plugin slug does not match the plugin filename (e.g. `woocommerce/woocommerce.php`), you need to specify the both the slug and plugin filename. (Example: `advanced-custom-fields-pro/acf.php`)

```json
{
"active-plugins": [
"woocommerce",
"advanced-custom-fields-pro/acf.php"
]
}
```

## Site Specific Plugins

Conditional Plugins can be activated in-code by using:
```php
wpcom_vip_load_plugin( 'plugin-name/plugin-file.php' )
```
4 changes: 4 additions & 0 deletions docs/plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Plugins

* [Installing Plugins](plugins/installing.md)
* [Activating Plugins](plugins/activating.md)
7 changes: 7 additions & 0 deletions docs/plugins/installing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Installing Plugins

We are using [Composer](https://getcomposer.org/) and [WPackagist](https://wpackagist.org/) to manage our plugins. To install a new plugin that exists in the WordPress Plugin Repository, run the following command:

```sh
composer require wpackagist-plugin/plugin-name
```
2 changes: 1 addition & 1 deletion themes/goodbids-nonprofit/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: GoodBids Non-profit
Theme URI: https://goodbids.org
Author: Viget
Author URI: https://viget.com
Description: Twenty Twenty-Four child theme for GoodBids Charity sites.
Description: Twenty Twenty-Four child theme for GoodBids Non-profit sites.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
Loading