You are here

protected function HomeboxSettingsForm::getLayout in Homebox 8

Get layout instance.

Parameters

string $layout_id: Layout id.

array $layout_settings: An array of configuration relevant to the layout.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

mixed|object Layout instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

src/Form/HomeboxSettingsForm.php, line 79

Class

HomeboxSettingsForm
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;
}