class NodePreviewFormSelect

Implements hook_form_FORM_ID_alter().

Plugin annotation

@BootstrapForm("node_preview_form_select")

Hierarchy

Expanded class hierarchy of NodePreviewFormSelect

Related topics

Namespace

Drupal\bootstrap\Plugin\Form
Source
class NodePreviewFormSelect extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
    $form->addClass(['form-inline', 'bg-info', 'text-center', 'clearfix']);

    // Backlink.
    $options = $form->backlink->getProperty('options', []);

    $form->backlink->addClass(isset($options['attributes']['class']) ? $options['attributes']['class'] : []);
    $form->backlink->addClass(['btn', 'btn-info', 'pull-left']);
    $form->backlink->setButtonSize();
    $form->backlink->setIcon(Bootstrap::glyphicon('chevron-left'));

    // Ensure the UUID is set.
    if ($uuid = $form->uuid->getProperty('value')) {
      $options['query'] = ['uuid' => $uuid];
    }

    // Override the options attributes.
    $options['attributes'] = $form->backlink->getAttributes()->getArrayCopy();

    $form->backlink->setProperty('options', $options);


    // View mode.
    $form->view_mode->addClass('pull-right', $form::WRAPPER);
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
FormBase::alterForm public function The alter method to store the code. Overrides FormInterface::alterForm
FormBase::submitForm public static function Form submission handler. Overrides FormInterface::submitForm
FormBase::submitFormElement public static function Form submission handler. Overrides FormInterface::submitFormElement
FormBase::validateForm public static function Form validation handler. Overrides FormInterface::validateForm
FormBase::validateFormElement public static function Form validation handler. Overrides FormInterface::validateFormElement
NodePreviewFormSelect::alterFormElement public function The alter method to store the code. Overrides FormBase::alterFormElement
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function