You are here

class RedhenEngagementScoreViewsController in RedHen CRM 7

RedhenMembership Views Controller class.

Hierarchy

Expanded class hierarchy of RedhenEngagementScoreViewsController

1 string reference to 'RedhenEngagementScoreViewsController'
redhen_engagement_entity_info in modules/redhen_engagement/redhen_engagement.module
Implements hook_entity_info().

File

modules/redhen_engagement/lib/redhen_engagement.views.inc, line 62

View source
class RedhenEngagementScoreViewsController extends EntityDefaultViewsController {

  /**
   * Add extra fields to views_data().
   */
  public function views_data() {
    $data = parent::views_data();
    $entity_info = entity_get_info();
    foreach ($entity_info as $entity_type => $info) {
      if ($entity_type == 'redhen_engagement') {

        // Entity to engagment_score.
        $data[$info['base table']]['redhen_engagement_score_rel'] = array(
          'group' => t('Engagement Score'),
          'title' => t('@entity to Engagement Score', array(
            '@entity' => drupal_ucfirst($info['label']),
          )),
          'help' => t('The Note associated with the @entity entity.', array(
            '@entity' => drupal_ucfirst($info['label']),
          )),
          'relationship' => array(
            'entity' => $entity_type,
            'label' => t('@entity being the Engagement', array(
              '@entity' => $entity_type,
            )),
            'base' => 'redhen_engagement_score',
            'base field' => 'name',
            'relationship field' => 'engagement_score',
          ),
        );

        // Engagement score to entity.
        $data['redhen_engagement_score']['redhen_engagement_related_' . $entity_type] = array(
          'group' => t('Engagement Score'),
          'title' => t('Engagement Score to @entity', array(
            '@entity' => drupal_ucfirst($info['label']),
          )),
          'help' => t('The @entity entity that is associated with the Engagement.', array(
            '@entity' => $info['label'],
          )),
          'relationship' => array(
            'handler' => 'views_handler_relationship',
            'label' => t('@entity from Redhen Engagement', array(
              '@entity' => $entity_type,
            )),
            'base' => $info['base table'],
            'base field' => 'engagement_score_id',
            'relationship field' => 'engagement_score_id',
          ),
        );
      }
    }
    return $data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDefaultViewsController::$type protected property
EntityDefaultViewsController::getRelationshipHandlerClass public function Determines the handler to use for a relationship to an entity type.
EntityDefaultViewsController::map_from_schema_info protected function Comes up with views information based on the given schema and property info.
EntityDefaultViewsController::optionsListCallback public static function A callback returning property options, suitable to be used as views options callback.
EntityDefaultViewsController::schema_fields protected function Try to come up with some views fields with the help of the schema and the entity property information.
EntityDefaultViewsController::schema_revision_fields protected function Try to come up with some views fields with the help of the revision schema and the entity property information.
EntityDefaultViewsController::__construct public function
RedhenEngagementScoreViewsController::views_data public function Add extra fields to views_data(). Overrides EntityDefaultViewsController::views_data