You are here

public function PluginFormFactory::hasForm in Feeds 8.3

Returns whether or not the plugin implements a form for the given type.

Parameters

\Drupal\feeds\Plugin\Type\FeedsPluginInterface $plugin: The Feeds plugin.

string $operation: The type of form to check for, which can be for example:

  • configuration Displayed when configuring the feed type.
  • feed Displayed on the feed add/edit form.
  • option A small form to appear on the plugin select box. The entity processor plugins use this to display a form for selecting an entity bundle.

Return value

bool True if the plugin implements a form of the given type. False otherwise.

File

src/Plugin/PluginFormFactory.php, line 49

Class

PluginFormFactory
Provides form discovery capabilities for plugins.

Namespace

Drupal\feeds\Plugin

Code

public function hasForm(FeedsPluginInterface $plugin, $operation) {
  $definition = $plugin
    ->getPluginDefinition();
  if (empty($definition['form'][$operation])) {
    return FALSE;
  }
  $class = $definition['form'][$operation];
  return class_exists($class) && is_subclass_of($class, PluginFormInterface::class);
}