hook_entity_extra_field_info from ds

Public
</> CopyGet raw version
php
  1. /**
  2.  * Implements hook_entity_extra_field_info().
  3.  */
  4. function ds_extras_entity_extra_field_info() {
  5. $extra = array();
  6.  
  7. if (\Drupal::config('ds_extras.settings')->get('fields_extra')) {
  8. $fields = \Drupal::config('ds_extras.settings')->get('fields_extra_list');
  9. if (empty($fields)) {
  10. return $extra;
  11. }
  12. foreach ($fields as $field) {
  13. $field = trim($field);
  14. if (!empty($field)) {
  15. list($entity, $bundle, $field_name) = explode('|', $field);
  16. $extra[Html::escape($entity)][Html::escape($bundle)]['display'][$field_name] = array(
  17. 'label' => Unicode::ucfirst(str_replace('_', ' ', Html::escape($field_name))),
  18. 'description' => Unicode::ucfirst(str_replace('_', ' ', Html::escape($field_name))),
  19. 'weight' => 0,
  20. );
  21. }
  22. }
  23. }
  24.  
  25. return $extra;
  26. }