Have a place in the admin panel were you can specify either accepted combinations, or unaccepted combinations of filterable items, based on an individual site's own styleguide standards.

Then upon entry into the database we validate each row as 1, 0 or NULL where 1 = Compliant, 0 = Non-Compliant and NULL = No compliance rules govern this combination.

When viewing the report, you will either see a checkmark for compliant, an X for non compliance, or nothing if it's non in either list. We would also add a filter for this, so users could easily see patterns that are either compliant, or non-compliant in one shot.

Comments

WidgetsBurritos created an issue. See original summary.

WidgetsBurritos’s picture

Assigned: Unassigned » WidgetsBurritos
WidgetsBurritos’s picture

Status: Active » Needs review
StatusFileSize
new22.38 KB

This is an initial proof of concept. We may wish to clean it up a bit more, but it shows us what is possible here.

WidgetsBurritos’s picture

StatusFileSize
new24.82 KB

This version of the patch uses JSON instead of the proprietary string splitter. This allows us portability later, and provides a nice format so we could potentially build a better admin experience with down the road. For a quick explanation of how everything works:

1. Go to admin/config/system/panels_pane_report:
2. Enter json for either your allowed/disallowed combinations. Here is an example:
[{"bundle":"article","display_layout":"threecol_25_50_25"},{"bundle":"article","build_mode":"teaser"},{"bundle":"display_storage_type","display_layout":"panelizer_entity"}]

The above sets up three separate rule combinations. If any of those combinations are found when adding a row to the database, it will get flagged as either passing or failing. The following keys can be used in any combination here:

- build_mode
- bundle
- display_layout
- display_storage_type
- display_storage_id
- entity_type
- page_status
- page_title
- page_storage_id
- pattern_status
- pattern_storage_id
- pattern_title
- style_mode

3. After saving your criteria, go regenerate the report and you should see matching/failing items. Any item that neither pass nor fail criteria sets, get marked as neutral.

WidgetsBurritos’s picture

Status: Needs review » Needs work

The last submitted patch, 4: styleguide_compliance-2852651-4.patch, failed testing.

WidgetsBurritos’s picture

Assigned: bighappyface » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.23 KB
new24.81 KB

This should resolve that last test failure.

WidgetsBurritos’s picture

Assigned: Unassigned » bighappyface
WidgetsBurritos’s picture

Assigned: bighappyface » WidgetsBurritos
Status: Needs review » Needs work

For ease of use, and to also not interfere with users who don't necessarily need this functionality, I've decided to take a much different approach. Now it is going to live as a submodule of PPR. This is going to require a bit of restructuring, but I think that allows us to keep this separate functionality separate. This will require creating some hooks. I will identify the necessary hooks here, but will implement those separately, which can be tracked as part of a separate issue: #2856866: Identify and implement alter hooks

For now this is back in progress until I have something to show.

WidgetsBurritos’s picture

Status: Needs work » Needs review
StatusFileSize
new37.34 KB
new28.94 KB

Okay so this is a completely new approach, using the entity api to define styleguide criteria. It's ready for an initial review.

Note: The patch itself is based on three commits (2 of which come from other pending issues). I also included a separate patch file which only shows the changes introduced by the particular patch.

The last submitted patch, 10: styleguide_compliance-2852651-10.patch, failed testing.

WidgetsBurritos’s picture

StatusFileSize
new29.98 KB

Alright, now that the pre-reqs are merged, here is a smaller patch. Let's hope this fixes that test error.

Status: Needs review » Needs work

The last submitted patch, 12: styleguide_compliance-2852651-12.patch, failed testing.

WidgetsBurritos’s picture

Status: Needs work » Needs review
StatusFileSize
new29.95 KB

Minor tweaks to the test cases

Status: Needs review » Needs work

The last submitted patch, 14: styleguide_compliance-2852651-14.patch, failed testing.

WidgetsBurritos’s picture

Status: Needs work » Needs review
StatusFileSize
new30 KB

Trying again now that the submodule base is already in the repo

WidgetsBurritos’s picture

Status: Needs review » Needs work

Okay now that the tests are working here, I'm gonna clean up a few things and then hopefully have a final candidate ready for review.

WidgetsBurritos’s picture

Status: Needs work » Needs review
StatusFileSize
new31.16 KB
WidgetsBurritos’s picture

WidgetsBurritos’s picture

@bighappyface would you mind reviewing this when you get the chance?

bighappyface’s picture

@WidgetsBurritos are you cool to wait for me to review this with you in person next week?

WidgetsBurritos’s picture

@bighappyface yeah for sure. I realize it's pretty code heavy.

WidgetsBurritos’s picture

Status: Needs review » Needs work

Walked through this with @brant.darilek and we discovered these issues needed fixed. I will jump on them and submit a new patch.

  1. +++ b/ppr_styleguide/ppr_styleguide.module
    @@ -4,3 +4,254 @@
    +    foreach ($rules as list($key, $op, $value)) {
    

    confirm all three values exist

  2. +++ b/ppr_styleguide/ppr_styleguide.views.inc
    @@ -0,0 +1,96 @@
    +    'filter' => array('handler' => 'views_handler_filter_boolean_operator'),
    

    use the new operator from #2853271: Add "No Reference" option to page status filter

  3. +++ b/ppr_styleguide/tests/StyleguideUnitTestCase.test
    @@ -0,0 +1,309 @@
    +    $rules = array('bundle=article', 'style_mode=rounded_corners');
    

    check these tests

  4. +++ b/ppr_styleguide/tests/StyleguideUnitTestCase.test
    @@ -0,0 +1,309 @@
    +  }
    

    add test to confirm row that both matches and fails different criteria sets

  5. +++ b/ppr_styleguide/tests/StyleguideUnitTestCase.test
    @@ -0,0 +1,309 @@
    +      'b=d',
    

    add options for missing operators, or values.

  6. +++ b/ppr_styleguide/tests/StyleguideWebTestCase.test
    @@ -0,0 +1,164 @@
    +    $this->assertRaw('name="page_status"');
    

    are these last two still necessary?

WidgetsBurritos’s picture

WidgetsBurritos’s picture

Status: Needs work » Needs review
StatusFileSize
new32.37 KB
new7.6 KB

I've made the changes mentioned in comment #23 and also a few other minor tweaks.

WidgetsBurritos’s picture

  • WidgetsBurritos committed 492c054 on 7.x-1.x
    Issue #2852651 by WidgetsBurritos, brant.darilek, bighappyface:...

WidgetsBurritos’s picture

Status: Needs review » Fixed
WidgetsBurritos’s picture

Status: Fixed » Closed (fixed)