You are here

function social_topic_widget_alter in Open Social 8.4

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  2. 8.5 modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  3. 8.6 modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  4. 8.7 modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  5. 8.8 modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  6. 10.3.x modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  7. 10.0.x modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  8. 10.1.x modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()
  9. 10.2.x modules/social_features/social_topic/social_topic.module \social_topic_widget_alter()

Function that does some magic to the event type field.

Parameters

array $form: Form array.

2 calls to social_topic_widget_alter()
social_topic_form_node_topic_edit_form_alter in modules/social_features/social_topic/social_topic.module
Implements hook_form_FORM_ID_alter().
social_topic_form_node_topic_form_alter in modules/social_features/social_topic/social_topic.module
Implements hook_form_FORM_ID_alter().

File

modules/social_features/social_topic/social_topic.module, line 241
The Social topic module.

Code

function social_topic_widget_alter(array &$form) {

  /** @var \Drupal\Core\Config\ImmutableConfig $config */
  $config = \Drupal::config('social_topic.settings');

  // Change the widget if more than X.
  if (count($form['field_topic_type']['widget']['#options']) >= $config
    ->get('social_topic_type_select_changer')) {
    $form['field_topic_type']['widget']['#type'] = 'select';
  }
}