$enabled->freeze();
}
}
- $this->addElement('text', 'image_URL', ts('Image URL'));
+ // TODO: Remove when dropping image_URL column
+ if ($this->_id) {
+ $imageUrl = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $this->_id, 'image_URL');
+ if ($imageUrl) {
+ $this->addElement('text', 'image_URL', ts('Image URL'));
+ }
+ }
+ $this->assign('hasImageUrl', !empty($imageUrl));
+ $this->add('text', 'icon', ts('Icon'), ['class' => 'crm-icon-picker', 'title' => ts('Choose Icon'), 'allowClear' => TRUE]);
$this->add('text', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'description')
);
}
}
+ // If icon is set, it overrides image_URL
+ if (!empty($params['icon'])) {
+ $params['image_URL'] = '';
+ }
+
$contactType = CRM_Contact_BAO_ContactType::add($params);
CRM_Core_Session::setStatus(ts("The Contact Type '%1' has been saved.",
[1 => $contactType->label]
<td>{ts}{$contactTypeName}{/ts} {ts}(built-in){/ts}</td>
{/if}
</tr>
- <tr class="crm-contact-type-form-block-image_URL">
- <td class="label">{$form.image_URL.label} {help id="id-image_URL"}</td>
- <td>{$form.image_URL.html|crmAddClass:'huge40'}</td>
+ {if $hasImageUrl}
+ <tr class="crm-contact-type-form-block-image_URL">
+ <td class="label">{$form.image_URL.label}</td>
+ <td>{$form.image_URL.html|crmAddClass:'huge40'}</td>
+ </tr>
+ <tr class="description status-warning">
+ <td></td><td>{ts}Support for Image URL will be dropped in the future. Please select an icon instead.{/ts}</td>
+ </tr>
+ {/if}
+ <tr class="crm-contact-type-form-block-icon">
+ <td class="label">{$form.icon.label}</td>
+ <td>{$form.icon.html}</td>
</tr>
<tr class="crm-contact-type-form-block-description">
<td class="label">{$form.description.label}
{htxt id="id-contactSubtype-intro"}
{ts}CiviCRM comes with 3 basic (built-in) contact types: Individual, Household, and Organization. You can create additional contact types based on these basic types to further differentiate contacts (for example you might create Student, Parent, Staff, and /or Volunteer "subtypes" from the basic Individual type...). You can also re-name the built-in types. Contact subtypes are especially useful when you need to collect and display different sets of custom data for different types of contacts.{/ts}
{/htxt}
-
-{htxt id="id-image_URL-title"}
- {ts}Contact Type Icon{/ts}
-{/htxt}
-{htxt id="id-image_URL"}
-<div>{ts 1='<span class="font-italic">sites/.../files</span>' 2='<span class="font-italic">media</span>'}Use this field to set your own icon for this Contact Type. Icon images should be 16 x 16 pixels for best fit. Enter a relative or complete URL to the image file location. Use a location outside of your CiviCRM code directory to reduce the likelihood of losing your image files during an upgrade. (For Drupal sites, you might want to use the %1 directory. For Joomla sites, the consider using the %2 directory.){/ts}</div>
- Examples:
- <ul>
- <li>{ts}Relative URL for a default Drupal site:{/ts}<br /><span class="font-italic">../../../default/files/volunteer_contact_icon.png</span></li>
- <li>{ts}Complete URL for icon accessible from an external location:{/ts}<br /><span class="font-italic">http://www.example.com/images/new_icon.gif</span></li>
- </ul>
-{/htxt}