You are here

function party_commerce_party_data_set_info in Party 8.2

Implements hook_party_data_set_info().

File

modules/party_commerce/party_commerce.module, line 11
Support for Drupal Commerce customer profiles.

Code

function party_commerce_party_data_set_info() {
  $sets = array();
  foreach (commerce_customer_profile_type_get_name() as $type => $label) {
    $sets["commerce_customer_profile_" . $type] = array(
      'label' => $label,
      'entity type' => 'commerce_customer_profile',
      'entity bundle' => $type,
      'class' => 'PartyCustomerProfileDataSet',
      // Provide details of admin interfaces
      'admin' => array(
        'manage fields' => 'admin/commerce/customer-profiles/types/' . $type . '/fields',
        'manage display' => 'admin/commerce/customer-profiles/types/' . $type . '/display',
      ),
      // Provide a piece corresponding to each data set.
      'piece' => array(
        'path' => 'customer-profile-' . str_replace('_', '-', $type),
        'title' => $label,
        'maker' => 'view',
        'page callback' => 'party_view_data_set',
        'page arguments' => array(
          1,
          "commerce_customer_profile_" . $type,
        ),
        // @todo: this needs to tell the access arguments for party_access()
        // about the argument for loading our attached entities.
        // In other words, some sort of %wildcard_to_arg() function maybe?
        'access arguments' => array(
          "view any {$type} customer profile",
        ),
        // File path is relative to implementing module.
        'file' => 'party.pages.inc',
      ),
    );
  }
  return $sets;
}