CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Extending CRM_Event_Badge for custom badges no longer an option?
Pages: [1]

Author Topic: Extending CRM_Event_Badge for custom badges no longer an option?  (Read 1229 times)

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Extending CRM_Event_Badge for custom badges no longer an option?
April 28, 2014, 08:05:36 am
4.4 brought a simpler way to create badges from the UI, but it means users are restricted to the formats listed there and very few other customizations.

Extending CRM_Event_Badge allowed us to make customizations which are no longer possible. Those include custom sizing/formatting, adding colour and other tricks like custom wrapping.
Is this doable in 4.4?

Let me know if this will fit better in the Dev forum.

rjm

  • I post occasionally
  • **
  • Posts: 86
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 6.28
Re: Extending CRM_Event_Badge for custom badges no longer an option?
April 29, 2014, 03:33:28 am
I also need to customize event badges.  Can someone point me in the right direction?  Currently on 4.4.3.

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Re: Extending CRM_Event_Badge for custom badges no longer an option?
April 29, 2014, 07:22:47 am
From what I gather by skimming over the code, CRM_Event_Badge is not even used anymore and there's a bunch of useless code/files (like CRM_Event_Badge_Simple).
Wouldn't these be removed if they are no longer in use? Or can they be used in some other way?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Extending CRM_Event_Badge for custom badges no longer an option?
April 29, 2014, 07:41:04 am

can u please file a PR and an issue to do the needful

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Re: Extending CRM_Event_Badge for custom badges no longer an option?
April 29, 2014, 07:59:43 am
Okay, I got the badges to align to our format.

Solution:
Go to the "Name Badge Format" option group.
Copy the value of one of the current option values and create a new one.
Fill both the title and the name fields (if name is missing, you won't get the option to use that format).
For the value, paste the copied data from the existing format. Change according to your preferences.

The last step will take a while to perfect, but the main values are paper-size (all current ones are A4, you might want "letter"), width, height and the various margins.
Width and height refer to the actual size of each badge/label.
NX and NY refer to how many badges per column and row respectively. Usually that's 2 by 4.

In our case, this doesn't give us quite what we had before since the amount of customization is minimal but at least I can get the text to align with our badge format.
Might be helpful to add this to http://book.civicrm.org/user/current/events/event-badges so people don't have to dig around to figure it out or panic that they can longer print badges in Civi (been there, done that).

Lobo, I'll post an issue about the code cleanup/confusion in regards to CRM_Event_Badge.
As for the ability to further customize badges using custom code, it appears that that ship has sailed? Any improvements would probably have to be done in the UI.

rjm

  • I post occasionally
  • **
  • Posts: 86
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 6.28
Re: Extending CRM_Event_Badge for custom badges no longer an option?
May 10, 2014, 07:33:33 pm
I have the need to customize a badge as well.  Unfortunately, I need to change not only the paper size, but to also add custom and standard fields. 

Could you please elaborate on your suggestion to the copy the "Name Badge Format" option group?  Do you mean to copy the data in the various fields, or go find it within the code somewhere?  If we need to find it, can you please tell me the path?

Thank you.

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Re: Extending CRM_Event_Badge for custom badges no longer an option?
May 12, 2014, 05:22:00 am
I meant go to the "Name Badge Format" option group (civicrm/admin/optionValue?gid=188&reset=1 in 4.4) and create another value, copying one of the current ones and modifying that.
The format is stored in a serialized string that's the value of the option value.

In our case, we're using:
Code: [Select]
{"paper-size":"letter","orientation":"portrait","font-name":"times","font-size":12,"font-style":"","NX":2,"NY":4,"metric":"mm","lMargin":10,"tMargin":35,"SpaceX":0,"SpaceY":0,"width":98,"height":63,"lPadding":0,"tPadding":0}
That's how you'd create a custom format.

As for fields, you only get the choice of whatever fields Event Name Badge Layouts give you, which seems to include custom fields as well.
See the docs for more info (http://book.civicrm.org/user/current/events/event-badges).

kasiawaka

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 4
    • Kasuwade Solutions Inc.
Re: Extending CRM_Event_Badge for custom badges no longer an option?
March 06, 2015, 01:43:07 pm
Hmm, this doesn't seem to be working in 4.5 - the option to add new Badge Name Format as described above only allows to add a label and description fields, no option to enter a value to define that format. Also, I could not find any documentation on the new process of creating custom badge formats. It is also a bit confusing to still have the old Event Name Badge options (civicrm/admin/options/event_badge?reset=1&action=browse) in the options group. I would be happy to write something up if I get pointed in the right direction.
Kasia Wakarecy
http://kasuwade.ca

kasiawaka

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 4
    • Kasuwade Solutions Inc.
Re: Extending CRM_Event_Badge for custom badges no longer an option?
March 10, 2015, 09:40:05 am
I figured out a process to add a new badge format/layout and documented here: http://forum.civicrm.org/index.php/topic,35420.msg152926.html#msg152926
Still, no option to hack that process to add, for example, font color or background as we could before with extending CRM_Event_Badge
Kasia Wakarecy
http://kasuwade.ca

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Extending CRM_Event_Badge for custom badges no longer an option?

This forum was archived on 2017-11-26.