You are here

function prevnext_entity_extra_field_info in Prevnext 8

Same name and namespace in other branches
  1. 2.x prevnext.module \prevnext_entity_extra_field_info()
  2. 2.0.x prevnext.module \prevnext_entity_extra_field_info()

Implements hook_entity_extra_field_info().

File

./prevnext.module, line 52
Contains prevnext.module.

Code

function prevnext_entity_extra_field_info() {
  $extra = [];
  $config = \Drupal::config('prevnext.settings');
  $enabled_nodetypes = $config
    ->get('prevnext_enabled_nodetypes');
  if (!empty($enabled_nodetypes)) {
    foreach ($enabled_nodetypes as $bundle_key => $bundle_name) {
      if (!empty($bundle_name)) {
        $extra['node'][$bundle_key]['display']['prevnext_previous'] = [
          'label' => t('Previous'),
          'description' => t('Previous node indicator'),
          'weight' => 50,
        ];
        $extra['node'][$bundle_key]['display']['prevnext_next'] = [
          'label' => t('Next'),
          'description' => t('Next node indicator'),
          'weight' => 50,
        ];
      }
    }
  }
  return $extra;
}