You are here

party_data_set.form_entity.inc in Flexiform 7

Contains class for a basic entity getter.

File

includes/form_entity/party_data_set.form_entity.inc
View source
<?php

/**
 * @file
 *  Contains class for a basic entity getter.
 */

/**
 * Form entity for attached entities.
 */
class FlexiformFormEntityPartyDataSet extends FlexiformFormEntityBase {

  /**
   * {@inheritdoc}
   */
  public function getEntity() {
    parent::getEntity();
    $settings = $this->settings;

    // Get the party entity.
    if ($party = $this
      ->getParam('party')) {
      $data_set_name = $this->getter['data_set_name'];
      return $party
        ->getDataSetController($data_set_name)
        ->getEntity(0, TRUE);
    }
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function saveEntity($entity) {
    $settings = $this->settings;

    // Get the party entity. We like to party. We like to, we like to party.
    $party = $this
      ->getParam('party');
    if ($party && $entity) {
      $party
        ->getDataSetController($this->getter['data_set_name'])
        ->attachEntity($entity)
        ->save(TRUE);
    }
  }

}

Classes

Namesort descending Description
FlexiformFormEntityPartyDataSet Form entity for attached entities.