public function RateWidgetBaseForm::getFormId in Rate 8.2
Returns a unique string identifying the form.
The returned ID should be a unique string that can be a valid PHP function name, since it's used in hook implementation names such as hook_form_FORM_ID_alter().
Return value
string The unique string identifying the form.
Overrides EntityForm::getFormId
File
- src/
Form/ RateWidgetBaseForm.php, line 116
Class
- RateWidgetBaseForm
- Form controller for rate vote forms.
Namespace
Drupal\rate\FormCode
public function getFormId() {
$entity = $this
->getEntity();
$voted_entity_type = $entity
->getVotedEntityType();
$voted_entity_id = $entity
->getVotedEntityId();
$voted_entity = $this->entityTypeManager
->getStorage($voted_entity_type)
->load($voted_entity_id);
$additional_form_id_parts = [];
$additional_form_id_parts[] = $voted_entity
->getEntityTypeId();
$additional_form_id_parts[] = $voted_entity
->bundle();
$additional_form_id_parts[] = $voted_entity
->id();
$additional_form_id_parts[] = $entity
->bundle();
$additional_form_id_parts[] = $entity->rate_widget->value;
$additional_form_id_parts[] = $entity
->get('user_id')->target_id;
$form_id = implode('_', $additional_form_id_parts);
return $form_id;
}