You are here

public static function ModuleBuilderComponentFormBase::create in Module Builder 7.2

File

includes/module_builder.form.inc, line 43

Class

ModuleBuilderComponentFormBase
Backport of ComponentFormBase from 8.x-3.x version.

Code

public static function create(ContainerInterface $container) {

  // Get the component data info.
  try {
    $generate_task = $container
      ->get('module_builder.drupal_code_builder')
      ->getTask('Generate', 'module');
  } catch (SanityException $e) {

    // Switch the form class so we don't try to build the form without DCB
    // in working order. The ComponentBrokenForm form class handles the
    // exception to show a message to the user.
    return new ComponentBrokenForm($e);
  }
  return new static($generate_task);
}