You are here

public static function NodeListField::matches in Fasttoggle 8.2

Return whether this setting matches the provided field definition.

Parameters

$definition: The field definition for which a match is being sought.

Return value

boolean Whether this plugin handles the definition.

Overrides SettingInterface::matches

File

src/Plugin/Setting/NodeListField.php, line 72
Fasttoggle Node Sticky

Class

NodeListField
Abstract interface for settings. Plugin strings are used for quick filtering without the need to instantiate the class.

Namespace

Drupal\fasttoggle\Plugin\Setting

Code

public static function matches($definition) {
  $has_get = is_callable(array(
    $definition,
    'get',
  ));
  $entity = $has_get ? $definition
    ->get('entity_type') : $definition
    ->getProvider();
  $matching_field_types = [
    'list_integer',
    'list_string',
  ];
  $does_match = $entity == 'node' && in_array($definition
    ->getType(), $matching_field_types);
  return $does_match;
}