protected function MailchimpSignupFormFormatter::getFormId in Mailchimp 2.x
Same name and namespace in other branches
- 8 modules/mailchimp_signup/src/Plugin/Field/FieldFormatter/MailchimpSignupFormFormatter.php \Drupal\mailchimp_signup\Plugin\Field\FieldFormatter\MailchimpSignupFormFormatter::getFormId()
Get the ID of the form.
Parameters
\Drupal\mailchimp_signup\Entity\MailchimpSignup $entity: An instance of the SignUp entity.
Return value
string Returns the id of the form.
1 call to MailchimpSignupFormFormatter::getFormId()
- MailchimpSignupFormFormatter::viewElements in modules/
mailchimp_signup/ src/ Plugin/ Field/ FieldFormatter/ MailchimpSignupFormFormatter.php - Builds a renderable array for a field value.
File
- modules/
mailchimp_signup/ src/ Plugin/ Field/ FieldFormatter/ MailchimpSignupFormFormatter.php, line 69
Class
- MailchimpSignupFormFormatter
- Plugin implementation of the 'mailchimp_signup_form' formatter.
Namespace
Drupal\mailchimp_signup\Plugin\Field\FieldFormatterCode
protected function getFormId(MailchimpSignup $entity) {
// The base form_id.
// We keep it the same way as it was until now,
// without having to add the suffix. We are doing this
// in case there are already existing form hooks relying
// on this name, so that we cant at least keep some BC
// before having to add the suffix for each form coming up next.
$id = 'mailchimp_signup_subscribe_block_' . $entity->id . '_form';
// Add the suffix in case we've already created one block
// with a signup form.
if (static::$counter && static::$counter >= 1) {
$id = sprintf('%s_%d', $id, static::$counter);
}
static::$counter++;
return $id;
}