You are here

public function ConverterBase::isExecutable in Drupal 7 to 8/9 Module Upgrader 8

Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.

Parameters

TargetInterface $target: The target module.

Return value

bool

Overrides ConverterInterface::isExecutable

4 methods override ConverterBase::isExecutable()
FunctionCallModifier::isExecutable in src/Plugin/DMU/Converter/Functions/FunctionCallModifier.php
Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.
PSR4::isExecutable in src/Plugin/DMU/Converter/PSR4.php
Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.
Tests::isExecutable in src/Plugin/DMU/Converter/Tests.php
Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.
UnitTests::isExecutable in src/Plugin/DMU/Converter/UnitTests.php
Returns if this conversion applies to the target module. If FALSE, the convert() method will not be called.

File

src/ConverterBase.php, line 34

Class

ConverterBase
Base class for converters.

Namespace

Drupal\drupalmoduleupgrader

Code

public function isExecutable(TargetInterface $target) {

  // If the plugin applies to particular hook(s), only return TRUE if the
  // target module implements any of the hooks. Otherwise, return TRUE
  // unconditionally.
  if (isset($this->pluginDefinition['hook'])) {
    return (bool) array_filter((array) $this->pluginDefinition['hook'], [
      $target
        ->getIndexer('function'),
      'has',
    ]);
  }
  else {
    return TRUE;
  }
}