Problem/Motivation

A standalone part of #2278541: Refactor block visibility to use condition plugins is adding schema support and optional-ity to condition plugins.

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
13.07 KB
blueminds’s picture

Status: Needs review » Needs work

Found only minor things:

  1. +++ b/core/lib/Drupal/Core/Condition/ConditionPluginBase.php
    @@ -37,7 +37,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
    -      '#default_value' => isset($this->configuration['negate']) ? $this->configuration['negate'] : FALSE,
    
    +++ b/core/modules/node/src/Plugin/Condition/NodeType.php
    @@ -80,8 +68,18 @@ public function summary() {
    +    if (empty($this->configuration['bundles']) && !$this->configuration['negate']) {
    
    +++ b/core/modules/user/src/Plugin/Condition/UserRole.php
    @@ -81,6 +80,9 @@ public function summary() {
    +    if (empty($this->configuration['roles']) && !$this->configuration['negate']) {
    

    Shouldn't these use isNegated()?

  2. +++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
    @@ -50,4 +60,45 @@ public function setContextValue($name, $value) {
    +      elseif ($value instanceof ContainerInterface) {
    

    ContainerIterface seems not to be imported. Does this work because this special case does not occur during tests? Probably not that relevant as it will be removed with dependency serialization.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
13.33 KB
2.3 KB

Good feedback, thanks!

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

This looks good I think. Had to check why the type validation is removed, but it's a checkboxes element, form API already ensures that you can't submit anything that's not part of the selection. Also wtf at Language as Lang....

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • Commit 130cbfb on 8.x by webchick:
    Issue #2283929 by tim.plunkett: Clean up condition plugins to have...
tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.