You are here

function view_mode_page_pattern_features_export_render in View Mode Page 7.2

Same name and namespace in other branches
  1. 8 view_mode_page.features.inc \view_mode_page_pattern_features_export_render()
  2. 8.2 view_mode_page.features.inc \view_mode_page_pattern_features_export_render()
  3. 7 view_mode_page.features.inc \view_mode_page_pattern_features_export_render()

Implements hook_features_export_render().

File

./view_mode_page.features.inc, line 41
Integrate View Mode Page with the Features module

Code

function view_mode_page_pattern_features_export_render($module_name, $data, $export = NULL) {
  $code = array();
  $code[] = '  $vmp_config = array();';
  $code[] = '';
  foreach ($data as $sys_name) {
    $sys_name_pieces = explode(':', $sys_name);
    switch (count($sys_name_pieces)) {
      case 2:
        $entity_type = 'node';
        $content_type = $sys_name_pieces[0];
        $view_mode = $sys_name_pieces[1];
        break;
      case 3:
        $entity_type = $sys_name_pieces[0];
        $content_type = $sys_name_pieces[1];
        $view_mode = $sys_name_pieces[2];
        break;
    }
    $item = module_invoke('view_mode_page', 'get_entity_patterns', $entity_type, $content_type, $view_mode);
    ksort($item);
    $code[] = '  $vmp_config[] = ' . features_var_export($item, '  ') . ';';
  }
  $code[] = '  return $vmp_config;';
  $code = implode("\n", $code);
  return array(
    'view_mode_page_pattern_default' => $code,
  );
}