You are here

public function VotingApiWidgetBase::getForm in Votingapi Widgets 8

Gets the widget form as configured for given parameters.

Return value

array Configured vote form.

3 calls to VotingApiWidgetBase::getForm()
FiveStarWidget::buildForm in src/Plugin/votingapi_widget/FiveStarWidget.php
Vote form.
LikeWidget::buildForm in src/Plugin/votingapi_widget/LikeWidget.php
Vote form.
UsefulWidget::buildForm in src/Plugin/votingapi_widget/UsefulWidget.php
Vote form.

File

src/Plugin/VotingApiWidgetBase.php, line 134

Class

VotingApiWidgetBase
Base class for Voting api widget plugins.

Namespace

Drupal\votingapi_widgets\Plugin

Code

public function getForm($entity_type, $entity_bundle, $entity_id, $vote_type, $field_name, $settings) {
  $vote = $this
    ->getEntityForVoting($entity_type, $entity_bundle, $entity_id, $vote_type, $field_name);

  /*
   * @todo Remove custom entity_form_builder once
   * https://www.drupal.org/node/766146 is fixed.
   */
  return $this->entityFormBuilder
    ->getForm($vote, 'votingapi_' . $this
    ->getPluginId(), [
    'options' => $this
      ->getPluginDefinition()['values'],
    'settings' => $settings,
    'plugin' => $this,
    // @todo The following keys can be removed once #766146 is fixed.
    // @see https://www.drupal.org/node/766146
    'entity_type' => $entity_type,
    'entity_bundle' => $entity_bundle,
    'entity_id' => $entity_id,
    'vote_type' => $vote_type,
    'field_name' => $field_name,
  ]);
}