You are here

function node_read_time_entity_extra_field_info in Node read time 8

Implements hook_entity_extra_field_info().

File

./node_read_time.module, line 36
Reading time module.

Code

function node_read_time_entity_extra_field_info() {
  $config = \Drupal::config('node_read_time.settings');
  $bundles = $config
    ->get('reading_time')['container'];
  $extra = NULL;
  if ($bundles) {
    foreach ($bundles as $machine_name => $bundle) {
      if ($bundle['is_activated']) {
        $extra['node'][$machine_name]['display']['reading_time'] = [
          'label' => t('Reading time'),
          'description' => t('This field is used to display the reading time of a node.'),
          'weight' => 100,
          'visible' => TRUE,
        ];
      }
    }
  }
  return $extra;
}