You are here

protected function HomeboxForm::getLayout in Homebox 8

Provide layout plugin instance.

Parameters

string $layout_id: Layout id.

array $layout_settings: Layout settings.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

Return value

mixed|object Layout plugin.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

src/Form/HomeboxForm.php, line 121

Class

HomeboxForm
Class HomeboxForm.

Namespace

Drupal\homebox\Form

Code

protected function getLayout($layout_id, array $layout_settings, FormStateInterface $form_state) {
  if (!($layout_plugin = $form_state
    ->get('layout_plugin'))) {
    $layout_plugin = $this->layoutPluginManager
      ->createInstance($layout_id, $layout_settings);
    $form_state
      ->set('layout_plugin', $layout_plugin);
  }
  return $layout_plugin;
}