You are here

public function PartyDefaultDataSet::getActions in Party 8.2

Same name and namespace in other branches
  1. 7 includes/party.data.inc \PartyDefaultDataSet::getActions()

Get actions for the attached entity. Check party access in each case.

@todo: Build these off of delta rather than $party_id, $entity_id. It's unnecessary to pass the party id here.

Return value

An array of links suitable for theme_links().

File

includes/party.data.inc, line 315
Provides the default class for managing party - Attached entity relationships.

Class

PartyDefaultDataSet
Class PartyDefaultDataSet

Code

public function getActions($party_id, $entity_id) {
  $party_data_info = party_get_data_set_info($this->data_set);

  // @todo: Rewrite whole function. for now, hack.
  $map = array_flip($this
    ->getEntityIds());
  $delta = $map[$entity_id];
  $actions = array();
  if (party_access('edit', $this->party, $this->data_set)) {
    $actions['edit'] = array(
      'title' => 'Edit',
      'href' => 'party/' . $party_id . '/' . $party_data_info['path element'] . '/edit/' . $delta,
    );
  }
  if (party_access('detach', $this->party, $this->data_set)) {
    $actions['remove'] = array(
      'title' => 'Remove',
      'href' => 'party/' . $party_id . '/' . $party_data_info['path element'] . '/remove/' . $delta,
    );
  }
  return $actions;
}