You are here

class reference_table_formatter_commerce_product_reference in Reference Table Formatter 7

Hierarchy

Expanded class hierarchy of reference_table_formatter_commerce_product_reference

1 string reference to 'reference_table_formatter_commerce_product_reference'
commerce_product_reference.inc in plugins/reference_types/commerce_product_reference.inc

File

plugins/reference_types/commerce_product_reference.inc, line 12

View source
class reference_table_formatter_commerce_product_reference extends reference_table_formatter_base_type {

  /**
   * {@inheritdoc}
   */
  public function get_bundles() {
    $bundles = array();

    // Check if the bundle has been nominated by the user.
    if (isset($this->instance['settings']['referenceable_types'])) {
      $settings = $this->instance['settings']['referenceable_types'];
      foreach ($settings as $key => $type) {
        if ($type != '0') {
          $bundles[] = $type;
        }
      }
      if (count($bundles) > 0) {
        return $bundles;
      }
    }

    // Otherwise all field references from all bundles.
    $info = entity_get_info($this
      ->entity_name());
    return array_keys($info['bundles']);
  }

  /**
   * {@inheritdoc}
   */
  public function entity_name() {
    return 'commerce_product';
  }

  /**
   * {@inheritdoc}
   */
  public function renderable_properties() {
    return array(
      'title',
      'sku',
      'commerce_stock',
      'product_id',
    );
  }

  /**
   * {@inheritdoc}
   */
  function load_entity_from_item($item) {
    $loaded_entity = entity_load($this
      ->entity_name(), array(
      $item['product_id'],
    ));
    return array_shift($loaded_entity);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
reference_table_formatter_base_type::$field protected property
reference_table_formatter_base_type::$instance protected property
reference_table_formatter_base_type::$settings protected property
reference_table_formatter_base_type::get_bundle_fields function Load all of the fields that can be displayed for a field and instance.
reference_table_formatter_base_type::get_configured_field_list public function The list of fields which will be shown to the user during render.
reference_table_formatter_base_type::get_entity_properties function Get the properties off an entity that are available for rendering.
reference_table_formatter_base_type::get_entity_property_label function Get the label of a property. 1
reference_table_formatter_base_type::get_renderable_fields function Get the fields and properties which can be rendered.
reference_table_formatter_base_type::get_summary public function Get a summary of the configured fields.
reference_table_formatter_base_type::get_view_modes public function Get view modes from the referenced entity.
reference_table_formatter_base_type::hide_empty public function Should empty columns be hidden.
reference_table_formatter_base_type::hide_empty_columns public function Hide columns in a table which are empty.
reference_table_formatter_base_type::is_field public function Check if a key is a property or field.
reference_table_formatter_base_type::render_table public function Render a table of content from the plugin.
reference_table_formatter_base_type::show_all_fields public function Check if the user has left the field checkboxes blank, rendering them all.
reference_table_formatter_base_type::show_header public function Check if the header should be shown on the front-end.
reference_table_formatter_base_type::__construct public function Standard plugin constructor.
reference_table_formatter_commerce_product_reference::entity_name public function The entity types that is referenced by the field. Overrides reference_table_formatter_base_type::entity_name
reference_table_formatter_commerce_product_reference::get_bundles public function Get a list of bundles which can be referenced by this field. Overrides reference_table_formatter_base_type::get_bundles
reference_table_formatter_commerce_product_reference::load_entity_from_item function Load the target entity from the given item. Overrides reference_table_formatter_base_type::load_entity_from_item
reference_table_formatter_commerce_product_reference::renderable_properties public function Get a list of properties off the target entity which are renderable. Overrides reference_table_formatter_base_type::renderable_properties