public function getSummary($location_id, $membership_id) {
    $storage = $this->entityTypeManager->getStorage('node');
    $builder = $this->entityTypeManager->getViewBuilder('node');
    $location = $storage->load($location_id);
    $result['location'] = $builder->view($location, 'calc_summary');
    $membership = $storage->load($membership_id);
    $result['membership'] = $builder->view($membership, 'calc_summary');

    $info = $membership->field_mbrshp_info->referencedEntities();
    $defaultUrl = Url::fromRoute('<front>');
    foreach ($info as $value) {
      if (!empty($value->field_mbrshp_location->first()) && $value->field_mbrshp_location->first()->get('target_id')->getValue() == $location_id) {
        $result['price']['monthly_rate'] = $value->field_mbrshp_monthly_rate->value;
        $result['price']['join_fee'] = $value->field_mbrshp_join_fee->value;
        $result['link'] = !empty($value->field_mbrshp_link->first()) ? $value->field_mbrshp_link->first()->getUrl() : $defaultUrl;
      }
    }

    return $result;
  }
public function getSummary($location_id, $membership_id) {
    $storage = $this->entityTypeManager->getStorage('node');
    $builder = $this->entityTypeManager->getViewBuilder('node');
    $location = $storage->load($location_id);
    $result['location'] = $builder->view($location, 'calc_summary');
    $membership = $storage->load($membership_id);
    $result['membership'] = $builder->view($membership, 'calc_summary');

    $info = $membership->field_mbrshp_info->referencedEntities();
    $defaultUrl = Url::fromRoute('<front>');
    foreach ($info as $value) {
      if (!empty($value->field_mbrshp_location->first()) && $value->field_mbrshp_location->first()->get('target_id')->getValue() == $location_id) {
        $result['price']['monthly_rate'] = $value->field_mbrshp_monthly_rate->value;
        $result['price']['join_fee'] = $value->field_mbrshp_join_fee->value;
        $result['link'] = !empty($value->field_mbrshp_link->first()) ? $value->field_mbrshp_link->first()->getUrl() : $defaultUrl;
      }
    }

    return $result;
  }
public function getSummary ( $ location_id , $ membership_id ) { $ storage = $ this -> entityTypeManager -> getStorage ( 'node' ) ; $ builder = $ this -> entityTypeManager -> getViewBuilder ( 'node' ) ; $ location = $ storage -> load ( $ location_id ) ; $ result [ 'location' ] = $ builder -> view ( $ location , 'calc_summary' ) ; $ membership = $ storage -> load ( $ membership_id ) ; $ result [ 'membership' ] = $ builder -> view ( $ membership , 'calc_summary' ) ; $ info = $ membership -> field_mbrshp_info -> referencedEntities ( ) ; $ defaultUrl = Url :: fromRoute ( '<front>' ) ; foreach ( $ info as $ value ) { if ( ! empty ( $ value -> field_mbrshp_location -> first ( ) ) && $ value -> field_mbrshp_location -> first ( ) -> get ( 'target_id' ) -> getValue ( ) == $ location_id ) { $ result [ 'price' ] [ 'monthly_rate' ] = $ value -> field_mbrshp_monthly_rate -> value ; $ result [ 'price' ] [ 'join_fee' ] = $ value -> field_mbrshp_join_fee -> value ; $ result [ 'link' ] = ! empty ( $ value -> field_mbrshp_link -> first ( ) ) ? $ value -> field_mbrshp_link -> first ( ) -> getUrl ( ) : $ defaultUrl ; } } return $ result ; }
Get Summary.

@param int $location_id
Location ID.
@param string $membership_id
Membership type ID.

@return string
Price.
Get Summary .