You are here

class ClipPathModifier in Modifiers Pack 8

Provides a Modifier to use CSS Clip Path for an element.

Plugin annotation


@Modifier(
  id = "clip_path_modifier",
  label = @Translation("Clip Path Modifier"),
  description = @Translation("Provides a Modifier to use CSS Clip Path for an element."),
)

Hierarchy

  • class \Drupal\modifiers_clip_path\Plugin\modifiers\ClipPathModifier extends \Drupal\modifiers\ModifierPluginBase

Expanded class hierarchy of ClipPathModifier

File

modules/modifiers_clip_path/src/Plugin/modifiers/ClipPathModifier.php, line 17

Namespace

Drupal\modifiers_clip_path\Plugin\modifiers
View source
class ClipPathModifier extends ModifierPluginBase {

  /**
   * {@inheritdoc}
   */
  public static function modification($selector, array $config) {
    if (!empty($config['clip_path'])) {
      $media = parent::getMediaQuery($config);
      $css[$media][$selector][] = '-webkit-clip-path:' . $config['clip_path'];
      $css[$media][$selector][] = 'clip-path:' . $config['clip_path'];
      return new Modification($css);
    }
    return NULL;
  }

}

Members