You are here

party_activity_handler_delete_link_field.inc in Party 8.2

Contains a Views field handler to take care of displaying deletes links as fields

File

modules/party_activity/views/party_activity_handler_delete_link_field.inc
View source
<?php

/**
 * @file
 * Contains a Views field handler to take care of displaying deletes links
 * as fields
 */
class party_activity_handler_delete_link_field extends party_activity_handler_link_field {
  function construct() {
    parent::construct();
    $this->additional_fields['type'] = 'type';
    $this->additional_fields['party_activity_id'] = 'party_activity_id';
  }
  function render($values) {
    $type = $values->{$this->aliases['type']};

    //Creating a dummy model to check access against
    $dummy_activity = (object) array(
      'type' => $type,
    );
    if (!party_activity_access('edit', $dummy_activity)) {
      return;
    }
    $text = !empty($this->options['text']) ? $this->options['text'] : t('delete');
    $activity_id = $values->{$this->aliases['party_activity_id']};
    return l($text, 'admin/community/activities/activity/' . $activity_id . '/delete');
  }

}

Classes

Namesort descending Description
party_activity_handler_delete_link_field @file Contains a Views field handler to take care of displaying deletes links as fields