Add shape prefix to symbol IDs, fix brand naming, add assets
- Symbol IDs now include shape for uniqueness: {shape}_{brand}_{mode}
e.g., text-only_paypal_lm, rectangle_visa_la, icon_mastercard_dm
- Fixed brand name inconsistencies:
- amazon_pay → amazon
- naverpay → naver_pay
- p24 → przelewy24
- direct_debit → bacs (unified BACS Direct Debit name)
- Added font assets (FontAwesome, Material Icons)
- Added MprIconsAssets and MprIconsConfig classes
- Updated preview.html with shape parameter support
- All 752 icons complete (38 payment × 4 shapes × 4 modes + 12 social × 3 shapes × 4 modes)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
77
README.md
77
README.md
@@ -70,6 +70,55 @@ Front office icon set is stored in `ps_mpr_config`:
|
||||
MprIcons::saveIconSet('material');
|
||||
```
|
||||
|
||||
## Admin Configuration Form
|
||||
|
||||
Add icon settings to your module's admin page using `MprIconsConfig`:
|
||||
|
||||
```php
|
||||
use MyPrestaRocks\Icons\MprIconsConfig;
|
||||
|
||||
// In getConfigForm() - add fields to your form
|
||||
$fields_form[]['form'] = [
|
||||
'legend' => ['title' => 'Icon Settings'],
|
||||
'input' => MprIconsConfig::getFormFields(),
|
||||
'submit' => ['title' => $this->l('Save')],
|
||||
];
|
||||
|
||||
// In getConfigFormValues() - get current values
|
||||
$values = array_merge($values, MprIconsConfig::getFormValues());
|
||||
|
||||
// In postProcess() - save when form submitted
|
||||
if (Tools::isSubmit('submitConfig')) {
|
||||
MprIconsConfig::processForm();
|
||||
}
|
||||
```
|
||||
|
||||
This creates a form with:
|
||||
- **Icon Set selector**: Font Awesome or Material Icons
|
||||
- **Self-host toggle**: Include icon fonts from module (for themes without icons)
|
||||
|
||||
## Self-Hosted Icon Fonts
|
||||
|
||||
If a theme doesn't include Font Awesome or Material Icons, enable self-hosting:
|
||||
|
||||
```php
|
||||
// In hookHeader or setMedia
|
||||
public function hookHeader()
|
||||
{
|
||||
MprIcons::registerAssets($this);
|
||||
}
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Check if self-hosting is enabled in config
|
||||
2. Register the appropriate CSS file (Font Awesome or Material Icons)
|
||||
3. Load fonts from `assets/fontawesome/` or `assets/material-icons/`
|
||||
|
||||
**Bundled assets:**
|
||||
- Font Awesome 4.7.0 (~30KB CSS + ~80KB woff2)
|
||||
- Material Icons (~1KB CSS + ~128KB woff2)
|
||||
|
||||
|
||||
## Available Icons
|
||||
|
||||
| Name | Font Awesome | Material |
|
||||
@@ -185,24 +234,25 @@ copy(
|
||||
<!-- Include sprite (hidden) -->
|
||||
{include file="module:yourmodule/views/img/payments.svg"}
|
||||
|
||||
<!-- Use icons -->
|
||||
<svg width="45" height="45"><use href="#visa_lm"/></svg>
|
||||
<svg width="45" height="45"><use href="#mastercard_lm"/></svg>
|
||||
<svg width="45" height="45"><use href="#paypal_lm"/></svg>
|
||||
<!-- Use icons - format: {shape}_{brand}_{mode} -->
|
||||
<svg width="45" height="45"><use href="#square_visa_lm"/></svg>
|
||||
<svg width="45" height="45"><use href="#square_mastercard_lm"/></svg>
|
||||
<svg width="45" height="45"><use href="#square_paypal_lm"/></svg>
|
||||
```
|
||||
|
||||
**Available payment brands (38):**
|
||||
|
||||
afterpay, alipay, alma, amazon_pay, american_express, apple_pay, bacs, bancontact, bank, billie, blik, cartes_bancaires, cod, credit_pay, eps, google_pay, ideal, jcb, kakao_pay, klarna, link, mastercard, mobilepay, multibanco, naverpay, p24, payco, paypal, pickup, point_of_sale, quote, revolut, samsung_pay, satispay, sepa, twint, visa, wechat_pay
|
||||
afterpay, alipay, alma, amazon, american_express, apple_pay, bacs, bancontact, bank, billie, blik, cartes_bancaires, cod, credit_pay, eps, google_pay, ideal, jcb, kakao_pay, klarna, link, mastercard, mobilepay, multibanco, naver_pay, przelewy24, payco, paypal, pickup, point_of_sale, quote, revolut, samsung_pay, satispay, sepa, twint, visa, wechat_pay
|
||||
|
||||
### Social Icons
|
||||
|
||||
```html
|
||||
{include file="module:yourmodule/views/img/socials.svg"}
|
||||
|
||||
<svg width="24" height="24"><use href="#facebook_lm"/></svg>
|
||||
<svg width="24" height="24"><use href="#x_lm"/></svg>
|
||||
<svg width="24" height="24"><use href="#instagram_lm"/></svg>
|
||||
<!-- format: {shape}_{brand}_{mode} -->
|
||||
<svg width="24" height="24"><use href="#icon_facebook_lm"/></svg>
|
||||
<svg width="24" height="24"><use href="#icon_x_lm"/></svg>
|
||||
<svg width="24" height="24"><use href="#icon_google_lm"/></svg>
|
||||
```
|
||||
|
||||
**Available social brands (12):**
|
||||
@@ -211,13 +261,14 @@ amazon, apple, facebook, google, linkedin, microsoft, outlook, paypal, reddit, t
|
||||
|
||||
### Icon ID Format
|
||||
|
||||
Icon IDs follow the pattern: `{brand}_{mode}`
|
||||
Icon IDs follow the pattern: `{shape}_{brand}_{mode}`
|
||||
|
||||
Examples:
|
||||
- `visa_lm` - Visa, light mode
|
||||
- `visa_dm` - Visa, dark mode
|
||||
- `paypal_la` - PayPal, light accent
|
||||
- `facebook_da` - Facebook, dark accent
|
||||
- `icon_visa_lm` - Visa icon, light mode
|
||||
- `square_visa_dm` - Visa square, dark mode
|
||||
- `rectangle_paypal_la` - PayPal rectangle, light accent
|
||||
- `text-only_mastercard_lm` - Mastercard text only, light mode
|
||||
- `full-logo_facebook_da` - Facebook full logo, dark accent
|
||||
|
||||
### Styling
|
||||
|
||||
|
||||
Reference in New Issue
Block a user