You are here

pid.inc in Party 8.2

Sample plugin to output just the party id as a label. This is just a proof of concept / example.

File

plugins/party_name_label/pid.inc
View source
<?php

/**
 * @file
 *
 * Sample plugin to output just the party id as a label.
 * This is just a proof of concept / example.
 */

/**
 * Plugins are described by creating a $plugin array which will be used
 * by the system that includes this file.
 *
 * @todo: document our plugin settings somewhere!
 *  - 'title': The admin name of the plugin.
 *  - 'description': Description for the admin UI.
 *  - 'label callback': The callback to use for generating a label.
 *    The signature is $callback($party).
 *  - 'options form callback': The callback for the settings form.
 *    Eg, for a FieldAPI label plugin this would let you choose which field(s)
 *    to take the label text from.
 */
$plugin = array(
  'title' => t("Pid example"),
  'description' => t('Form a label from the party id.'),
  'label callback' => 'party_pid_label',
  'options form callback' => 'party_pid_options_form',
);

/**
 * Generate the label for a party.
 */
function party_pid_label($party) {
  return isset($party->pid) ? t('Party @pid', array(
    '@pid' => $party->pid,
  )) : t('Party');
}

Functions

Namesort descending Description
party_pid_label Generate the label for a party.