business_identity
Objective:
Enhance the usability and accessibility of Drupal's administrative interface to meet business client standards by creating a unified configuration page that consolidates all business-related fields representing an enterprise, organization, retail location, or similar entity.
Field Sources:
The fields on this page primarily originate from three distinct sources:
- Drupal Core
- Third-party/Custom Modules
- Custom Fields (not available elsewhere in the system)
Module Objectives:
Provide a comprehensive, easily understandable overview of business identity data
Define and export the business identity of the organization promoted through the Drupal installation
Key Benefits for Business Users:
- Single-pane view for managing all business identity information
- Streamlined data management across multiple data sources
- Professional presentation suitable for corporate environments
- Export capability for sharing business identity across systems
- Intuitive organization reducing training time for administrative staff
This approach transforms Drupal's configuration management into a business-ready solution that aligns with enterprise requirements for data consolidation and brand consistency management.
Use Cases
Museums & Cultural Institutions
- Show exhibition hours and special event timing
- Display admission prices and membership info
- Educational program information
- Donor and sponsorship details
Hotels & Hospitality
- Room rates and availability integration
- Amenities and services display
- Check-in/check-out times
- Reservation contact information
Retail & Shops
- Store hours with seasonal variations
- Multiple location management
- Product/service categories
- Promotional event scheduling
Parks & Public Spaces
- Park hours and gate times
- Facility information (restrooms, picnic areas)
- Activity schedules
- Permit and reservation details
Organizations & Offices
- Departmental contact information
- Staff directory integration
- Meeting room availability
- Public service information
Contributing
We welcome contributions with:
- Detailed issue queue
- Development documentation
- Coding standards compliance
- Automated testing suite
*******************************
Usage Examples
In PHP code:
// Get comprehensive business info
$businessInfo = \Drupal::service('business_identity.manager')->getBusinessInfo();
$primaryContact = $businessInfo->getPrimaryContact();
$locations = $businessInfo->getLocations();
// Get specific information
$manager = \Drupal::service('business_identity.manager');
$name = $manager->getBusinessName();
$address = $manager->getFormattedAddress('headquarters', 'html');
$isOpen = $manager->isOpen();
$contactMethods = $manager->getContactMethods();
// Validate business information
$validation = $manager->validateBusinessInfo();
if ($validation['is_valid']) {
// Business info is valid
}Twig:
{# Get contact information #}
{% set contact = business_contact() %}
<p>Email: {{ contact.email }}</p>
<p>Phone: {{ contact.phone }}</p>
{# Get formatted address #}
<div class="address">
{{ business_address('headquarters', 'html') }}
</div>
{# Check if business is open #}
{% if business_is_open() %}
<span class="status-open">We're open!</span>
{% else %}
<span class="status-closed">We're closed</span>
{% endif %}
{# Get social links #}
<ul class="social-links">
{% for platform, url in business_social_links() %}
<li>
<a href="{{ url }}" target="_blank">{{ platform|capitalize }}</a>
</li>
{% endfor %}
</ul>
In a custom module:
// Alter business locations
function mymodule_business_identity_locations_alter(array &$locations) {
// Add a retail location
$locations['retail_store'] = [
'type' => 'retail_store',
'label' => t('Retail Store'),
'address' => [
'address_line1' => '123 Main St',
'locality' => 'New York',
'administrative_area' => 'NY',
'postal_code' => '10001',
'country_code' => 'US',
],
'primary' => FALSE,
];
}
// Alter operating hours
function mymodule_business_identity_operating_hours_alter(array &$hours) {
// Extend Friday hours
$hours['friday']['close'] = '19:00';
// Add holiday hours
$hours['christmas'] = [
'date' => '2024-12-25',
'open' => '',
'close' => '',
'note' => t('Closed for Christmas'),
];
}