You are here

function paragraphs_pack_get_entity_type_view_modes in Paragraphs pack 7

Get all possible view modes of specified entity type.

Parameters

string $entity_type: The specified entity type.

Return value

array An array of all view modes of the specified entity type.

2 calls to paragraphs_pack_get_entity_type_view_modes()
ParagraphsPackFeatureWebTestCase::validate_view_mode_options in tests/paragraphs_pack.test_helper.inc
Validate if all correct view modes are present.
paragraphs_pack_get_allowed_view_modes in includes/paragraphs_pack.fields.inc
Returns the array of allowed view modes for a list field.

File

includes/paragraphs_pack.fields.inc, line 154
Implements custom fields: PP_FIELD_TYPE_VIEW_MODE.

Code

function paragraphs_pack_get_entity_type_view_modes($entity_type) {
  $view_modes = array(
    PP_VALUE_DEFAULT => 'Default',
  );
  $entity_info = entity_get_info($entity_type);

  // Create key => label array of view modes.
  if (isset($entity_info['view modes'])) {
    foreach ($entity_info['view modes'] as $key => $value) {
      $view_modes[$key] = $value['label'];
    }
  }
  return $view_modes;
}