You are here

public static function Element::createStandalone in Express 8

Creates a new standalone \Drupal\bootstrap\Utility\Element instance.

It does not reference the original element passed. If an Element instance is passed, it will clone it so it doesn't affect the original element.

Parameters

array|string|\Drupal\bootstrap\Utility\Element $element: A render array element, string or Element instance.

\Drupal\Core\Form\FormStateInterface $form_state: A current FormState instance, if any.

Return value

\Drupal\bootstrap\Utility\Element The newly created element instance.

3 calls to Element::createStandalone()
BootstrapDropdown::preprocessLinks in themes/contrib/bootstrap/src/Plugin/Preprocess/BootstrapDropdown.php
Preprocess links in the variables array to convert them from dropbuttons.
Schemas::batchFinished in themes/contrib/bootstrap/src/Plugin/Setting/Schemas.php
Batch 'finished' callback
SettingBase::getSettingElement in themes/contrib/bootstrap/src/Plugin/Setting/SettingBase.php
Retrieves the form element for the setting.

File

themes/contrib/bootstrap/src/Utility/Element.php, line 287
Contains \Drupal\bootstrap\Utility\Element.

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\bootstrap\Utility

Code

public static function createStandalone($element = [], FormStateInterface $form_state = NULL) {

  // Immediately return a cloned version if element is already an Element.
  if ($element instanceof self) {
    return clone $element;
  }
  $standalone = is_object($element) ? clone $element : $element;
  return static::create($standalone, $form_state);
}