function commerce_recurring_field_widget_form_alter in Commerce Recurring Framework 8
Implements hook_field_widget_form_alter().
File
- ./
commerce_recurring.module, line 37 - Provides recurring billing for Drupal Commerce.
Code
function commerce_recurring_field_widget_form_alter(&$element, FormStateInterface $form_state, $context) {
$field_definition = $context['items']
->getFieldDefinition();
$field_name = $field_definition
->getName();
$widget_name = $context['widget']
->getPluginId();
if ($field_name == 'subscription_type' && $widget_name == 'commerce_plugin_select') {
// The standalone subscription type is used for subscriptions not backed
// by a purchasable entity, so it doesn't make sense to offer it on a
// purchasable entity form (such as the product variation one).
unset($element['target_plugin_id']['#options']['standalone']);
}
}