* @return array
* row with meta data
*/
- public static function formatLabel(&$row, &$layout) {
+ public static function formatLabel(array $row, array $layout): array {
$formattedRow = ['labelFormat' => $layout['label_format_name']];
$formattedRow['labelTitle'] = $layout['title'];
$formattedRow['labelId'] = $layout['id'];
/**
* @param array $formattedRow
*/
- public function generateLabel($formattedRow) {
+ public function generateLabel(array $formattedRow): void {
switch ($formattedRow['labelFormat']) {
case 'A6 Badge Portrait 150x106':
case 'Hanging Badge 3-3/4" x 4-3"/4':
- self::labelCreator($formattedRow, 5);
+ $this->labelCreator($formattedRow, 5);
break;
case 'Avery 5395':
default:
- self::labelCreator($formattedRow);
+ $this->labelCreator($formattedRow);
break;
}
}
* @param array $formattedRow
* @param int $cellspacing
*/
- public function labelCreator(&$formattedRow, $cellspacing = 0) {
+ public function labelCreator($formattedRow, $cellspacing = 0) {
$this->lMarginLogo = 18;
$this->tMarginName = 20;
for ($i = 1; $i <= $rowCount; $i++) {
if (!empty($formattedRow['token'][$i]['token'])) {
$value = '';
- if ($formattedRow['token'][$i]['token'] != 'spacer') {
+ if ($formattedRow['token'][$i]['token'] !== 'spacer') {
$value = $formattedRow['token'][$i]['value'];
}
if (!empty($formattedRow['barcode'])) {
$data = $formattedRow['values'];
- if ($formattedRow['barcode']['type'] == 'barcode') {
+ if ($formattedRow['barcode']['type'] === 'barcode') {
$data['current_value'] = $formattedRow['values']['contact_id'] . '-' . $formattedRow['values']['participant_id'];
}
else {
}
$tokenProcessor->evaluate();
foreach ($tokenProcessor->getRows() as $row) {
+ $rows[$row->context['participantId']]['contact_id'] = $row->context['contactId'];
+ $rows[$row->context['participantId']]['participant_id'] = $row->context['participantId'];
foreach ($processorTokens as $processorToken) {
$rows[$row->context['participantId']][$processorToken] = $row->render($processorToken);
}
/**
* Test the the submit function on the event participant submit function.
+ *
+ * @throws \CRM_Core_Exception
*/
public function testSubmit(): void {
$this->createCustomGroupWithFieldOfType(['extends' => 'Participant']);
$badgeLayout = PrintLabel::get()->addSelect('data')->execute()->first();
$values = [
- 'data' => array_merge((array) $badgeLayout['data'], ['token' => [], 'font_name' => [''], 'font_size' => [], 'text_alignment' => []]),
+ 'data' => array_merge((array) $badgeLayout['data'], ['token' => [], 'font_name' => [''], 'font_size' => [], 'text_alignment' => [], 'add_barcode' => 1]),
];
foreach (array_keys($this->getAvailableTokens()) as $id => $token) {
$index = $id + 1;