You are here

features.inc in Custom Formatters 7.2

Same filename and directory in other branches
  1. 6 includes/features.inc

Features module integration.

File

includes/features.inc
View source
<?php

/**
 * @file
 * Features module integration.
 */

/**
 * Implements hook_features_pipe_component_alter().
 */
function custom_formatters_features_pipe_field_instance_alter(&$pipe, $data) {
  foreach ($data as $id) {
    list($entity_type, $bundle_name, $field_name) = explode('-', $id);
    $field = field_info_instance($entity_type, $field_name, $bundle_name);
    if (!is_null($field) && isset($field['display']) && is_array($field['display'])) {
      foreach ($field['display'] as $display) {
        if (isset($display['module']) && $display['module'] == 'custom_formatters') {

          /** @var stdClass $formatter */
          $formatter = custom_formatters_crud_load(drupal_substr($display['type'], 18));
          if ($formatter && isset($formatter->export_type) && $formatter->export_type == EXPORT_IN_DATABASE) {
            $pipe['formatters'][$formatter->name] = $formatter->name;
          }
        }
      }
    }
  }
}

Functions

Namesort descending Description
custom_formatters_features_pipe_field_instance_alter Implements hook_features_pipe_component_alter().