Files
pomysloweprezenty.pl/autoload/admin/ViewModels/Forms/FormAction.php
Jacek Pyziak 3ecbe628dc Add view classes for articles, banners, languages, menu, newsletter, containers, shop categories, clients, payment methods, products, and search
- Created Articles.php for rendering article views including full articles, miniature lists, and news sections.
- Added Banners.php for handling banner displays.
- Introduced Languages.php for rendering language options.
- Implemented Menu.php for dynamic menu rendering.
- Developed Newsletter.php for newsletter view rendering.
- Created Scontainers.php for rendering specific containers.
- Added ShopCategory.php for category descriptions and product listings.
- Introduced ShopClient.php for managing client-related views such as address editing and order history.
- Implemented ShopPaymentMethod.php for displaying payment methods in the basket.
- Created ShopProduct.php for generating product URLs.
- Added ShopSearch.php for rendering a simple search form.
- Added .htaccess file to enhance security by restricting access to sensitive files and directories.
2026-02-21 23:00:15 +01:00

74 lines
1.8 KiB
PHP

<?php
namespace admin\ViewModels\Forms;
/**
* Definicja akcji formularza (przycisku)
*/
class FormAction
{
public string $name;
public string $label;
public string $type;
public string $url;
public ?string $backUrl;
public string $cssClass;
public array $attributes;
/**
* @param string $name Nazwa akcji (save, cancel, delete)
* @param string $label Etykieta przycisku
* @param string $url URL akcji (dla save)
* @param string|null $backUrl URL powrotu po zapisie
* @param string $cssClass Klasy CSS przycisku
* @param string $type Typ przycisku (submit, button, link)
* @param array $attributes Dodatkowe atrybuty HTML
*/
public function __construct(
string $name,
string $label,
string $url = '',
?string $backUrl = null,
string $cssClass = 'btn btn-primary',
string $type = 'submit',
array $attributes = []
) {
$this->name = $name;
$this->label = $label;
$this->url = $url;
$this->backUrl = $backUrl;
$this->cssClass = $cssClass;
$this->type = $type;
$this->attributes = $attributes;
}
/**
* Predefiniowana akcja Zapisz
*/
public static function save(string $url, string $backUrl = '', string $label = 'Zapisz'): self
{
return new self(
'save',
$label,
$url,
$backUrl,
'btn btn-primary',
'submit'
);
}
/**
* Predefiniowana akcja Anuluj
*/
public static function cancel(string $backUrl, string $label = 'Anuluj'): self
{
return new self(
'cancel',
$label,
$backUrl,
null,
'btn btn-default',
'link'
);
}
}