You are here

function rate_entity_extra_field_info in Rate 8

Same name and namespace in other branches
  1. 8.2 rate.module \rate_entity_extra_field_info()

Implements hook_entity_extra_field_info().

File

./rate.module, line 20
Hook implementation code for the Rate module.

Code

function rate_entity_extra_field_info() {
  $extra = [];
  $config = \Drupal::config('rate.settings');
  $enabled_types_widgets = $config
    ->get('enabled_types_widgets');
  if (!empty($enabled_types_widgets)) {
    foreach ($enabled_types_widgets as $entity_type_id => $entities) {
      foreach ($entities as $bundle => $settings) {
        $extra[$entity_type_id][$bundle]['display']['rate_vote_widget'] = [
          'label' => t('Rate Vote Widget'),
          'description' => t('Displays the rate voting widget selected from the settings page.'),
          'weight' => 100,
          'visible' => TRUE,
        ];
      }
    }
  }
  return $extra;
}