You are here

public static function HideModifier::modification in Modifiers Pack 8

1 call to HideModifier::modification()
HideModifierTest::testModification in modules/modifiers_hide/tests/src/Unit/HideModifierTest.php
@covers ::modification

File

modules/modifiers_hide/src/Plugin/modifiers/HideModifier.php, line 22

Class

HideModifier
Provides a Modifier to hide an element.

Namespace

Drupal\modifiers_hide\Plugin\modifiers

Code

public static function modification($selector, array $config) {
  if (filter_var($config['hide'], FILTER_VALIDATE_BOOLEAN)) {
    $media = parent::getMediaQuery($config);
    $css[$media][$selector][] = 'display:none';
    return new Modification($css);
  }
  return NULL;
}