diff --git a/app/Entities/Podcast.php b/app/Entities/Podcast.php index eabb8ee2..eebefc77 100644 --- a/app/Entities/Podcast.php +++ b/app/Entities/Podcast.php @@ -55,7 +55,7 @@ use RuntimeException; * @property string $language_code * @property int $category_id * @property Category|null $category - * @property int[] $other_categories_ids + * @property string $other_categories_ids * @property Category[] $other_categories * @property string|null $parental_advisory * @property string|null $publisher @@ -111,10 +111,7 @@ class Podcast extends Entity */ protected ?array $other_categories = null; - /** - * @var string[]|null - */ - protected ?array $other_categories_ids = null; + protected string $other_categories_ids = ''; /** * @var Episode[]|null @@ -526,13 +523,10 @@ class Podcast extends Entity return $this->other_categories; } - /** - * @return int[]|string[] - */ - public function getOtherCategoriesIds(): array + public function getOtherCategoriesIds(): string { - if ($this->other_categories_ids === null) { - $this->other_categories_ids = array_column($this->getOtherCategories(), 'id'); + if ($this->other_categories_ids === '') { + $this->other_categories_ids = implode(',', array_column($this->getOtherCategories(), 'id')); } return $this->other_categories_ids; diff --git a/app/Resources/js/modules/code-editor.ts b/app/Resources/js/modules/code-editor.ts index 2a896586..8a44cf05 100644 --- a/app/Resources/js/modules/code-editor.ts +++ b/app/Resources/js/modules/code-editor.ts @@ -136,6 +136,21 @@ export class XMLEditor extends LitElement { overflow: hidden; border: 3px solid hsl(var(--color-border-contrast)); background-color: hsl(var(--color-background-elevated)); + transition-property: + color, + background-color, + border-color, + text-decoration-color, + fill, + stroke, + opacity, + box-shadow, + transform, + filter, + backdrop-filter, + -webkit-backdrop-filter; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; } .cm-editor.cm-focused { outline: 2px solid transparent; diff --git a/app/Resources/styles/radioBtn.css b/app/Resources/styles/radioBtn.css index da208209..e892ee0d 100644 --- a/app/Resources/styles/radioBtn.css +++ b/app/Resources/styles/radioBtn.css @@ -1,6 +1,6 @@ @layer components { .form-radio-btn { - @apply absolute right-4 top-4 border-contrast border-3 text-accent-base; + @apply absolute right-4 top-4 border-contrast border-3 text-accent-base transition; &:focus { @apply ring-accent; diff --git a/app/Views/Components/Forms/Checkbox.php b/app/Views/Components/Forms/Checkbox.php index be7af505..f7d720f5 100644 --- a/app/Views/Components/Forms/Checkbox.php +++ b/app/Views/Components/Forms/Checkbox.php @@ -9,7 +9,7 @@ use Override; class Checkbox extends FormComponent { - protected array $props = ['hint', 'helper', 'isChecked']; + protected array $props = ['hint', 'helper']; protected array $casts = [ 'isChecked' => 'boolean', @@ -19,8 +19,6 @@ class Checkbox extends FormComponent protected string $helper = ''; - protected bool $isChecked = false; - #[Override] public function render(): string { @@ -28,10 +26,10 @@ class Checkbox extends FormComponent [ 'id' => $this->id, 'name' => $this->name, - 'class' => 'form-checkbox bg-elevated text-accent-base border-contrast border-3 w-6 h-6', + 'class' => 'form-checkbox bg-elevated text-accent-base border-contrast border-3 focus:ring-accent w-6 h-6 transition', ], 'yes', - old($this->name) ? old($this->name) === 'yes' : $this->isChecked, + in_array($this->getValue(), ['yes', 'true', 'on', '1'], true), ); $hint = $this->hint === '' ? '' : (new Hint([ diff --git a/app/Views/Components/Forms/CodeEditor.php b/app/Views/Components/Forms/CodeEditor.php index 6c5d8c56..dfbbd727 100644 --- a/app/Views/Components/Forms/CodeEditor.php +++ b/app/Views/Components/Forms/CodeEditor.php @@ -18,20 +18,18 @@ class CodeEditor extends FormComponent 'class' => 'textarea', ]; - protected string $content = ''; - protected string $lang = ''; - public function setContent(string $value): void + public function setValue(string $value): void { - $this->content = htmlspecialchars_decode($value); + $this->value = htmlspecialchars_decode($value); } #[Override] public function render(): string { $this->attributes['slot'] = 'textarea'; - $textarea = form_textarea($this->attributes, $this->content); + $textarea = form_textarea($this->attributes, $this->getValue()); return <<{$textarea} diff --git a/app/Views/Components/Forms/DatetimePicker.php b/app/Views/Components/Forms/DatetimePicker.php index 58ea9717..1267ffef 100644 --- a/app/Views/Components/Forms/DatetimePicker.php +++ b/app/Views/Components/Forms/DatetimePicker.php @@ -19,14 +19,14 @@ class DatetimePicker extends FormComponent 'name' => $this->name, 'class' => 'rounded-l-lg border-0 border-rounded-r-none flex-1 focus:ring-0', 'data-input' => '', - ], old($this->name, (string) $this->value)); + ], $this->getValue()); $clearLabel = lang( 'Episode.publish_form.scheduled_publication_date_clear', ); $closeIcon = icon('close-fill'); - $this->mergeClass('flex border-3 rounded-lg border-contrast focus-within:ring-accent'); + $this->mergeClass('flex border-3 rounded-lg border-contrast focus-within:ring-accent transition'); return <<getStringifiedAttributes()}> diff --git a/app/Views/Components/Forms/FormComponent.php b/app/Views/Components/Forms/FormComponent.php index b34d2bd4..7e19f45b 100644 --- a/app/Views/Components/Forms/FormComponent.php +++ b/app/Views/Components/Forms/FormComponent.php @@ -12,6 +12,7 @@ abstract class FormComponent extends Component 'id', 'name', 'value', + 'defaultValue', 'isRequired', 'isReadonly', ]; @@ -25,10 +26,9 @@ abstract class FormComponent extends Component protected string $name; - /** - * @var null|string|list - */ - protected null|string|array $value = null; + protected string $value = ''; + + protected string $defaultValue = ''; protected bool $isRequired = false; @@ -60,4 +60,9 @@ abstract class FormComponent extends Component $this->attributes['readonly'] = 'readonly'; } } + + protected function getValue(): string + { + return old($this->name, $this->value === '' ? $this->defaultValue : $this->value); + } } diff --git a/app/Views/Components/Forms/Input.php b/app/Views/Components/Forms/Input.php index b34b07df..3714553b 100644 --- a/app/Views/Components/Forms/Input.php +++ b/app/Views/Components/Forms/Input.php @@ -15,7 +15,7 @@ class Input extends FormComponent #[Override] public function render(): string { - $this->mergeClass('w-full border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent'); + $this->mergeClass('w-full border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent transition'); if ($this->type === 'file') { $this->mergeClass('file:px-3 file:py-2 file:h-[40px] file:font-semibold file:text-skin-muted file:text-sm file:rounded-none file:border-none file:bg-highlight file:cursor-pointer'); @@ -30,8 +30,7 @@ class Input extends FormComponent } $this->attributes['type'] = $this->type; - $this->attributes['value'] = $this->value; - return form_input($this->attributes, old($this->name, (string) $this->value)); + return form_input($this->attributes, $this->getValue()); } } diff --git a/app/Views/Components/Forms/MarkdownEditor.php b/app/Views/Components/Forms/MarkdownEditor.php index e3a44f88..027d28ad 100644 --- a/app/Views/Components/Forms/MarkdownEditor.php +++ b/app/Views/Components/Forms/MarkdownEditor.php @@ -23,7 +23,7 @@ class MarkdownEditor extends FormComponent #[Override] public function render(): string { - $this->mergeClass('w-full flex flex-col bg-elevated border-3 border-contrast rounded-lg overflow-hidden focus-within:ring-accent'); + $this->mergeClass('w-full flex flex-col bg-elevated border-3 border-contrast rounded-lg overflow-hidden focus-within:ring-accent transition'); $wrapperClass = $this->attributes['class']; $this->attributes['class'] = 'bg-elevated border-none focus:border-none focus:outline-none focus:ring-0 w-full h-full'; @@ -31,7 +31,7 @@ class MarkdownEditor extends FormComponent $textarea = form_textarea( $this->attributes, - old($this->name, (string) $this->value) + $this->getValue() ); $markdownIcon = (string) icon('markdown-fill', [ 'class' => 'mr-1 text-lg opacity-40', diff --git a/app/Views/Components/Forms/PermalinkEditor.php b/app/Views/Components/Forms/PermalinkEditor.php index ea269c98..26cf31c9 100644 --- a/app/Views/Components/Forms/PermalinkEditor.php +++ b/app/Views/Components/Forms/PermalinkEditor.php @@ -19,10 +19,10 @@ class PermalinkEditor extends FormComponent #[Override] public function render(): string { - $this->mergeClass('flex-1 text-xs border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent'); + $this->mergeClass('flex-1 text-xs border-contrast rounded-lg focus:border-contrast border-3 focus-within:ring-accent transition'); $this->attributes['slot'] = 'slug-input'; - $input = form_input($this->attributes, old($this->name, (string) $this->value)); + $input = form_input($this->attributes, $this->getValue()); $editLabel = lang('Common.edit'); $copyLabel = lang('Common.copy'); diff --git a/app/Views/Components/Forms/Radio.php b/app/Views/Components/Forms/Radio.php index 12f1e91d..beac8525 100644 --- a/app/Views/Components/Forms/Radio.php +++ b/app/Views/Components/Forms/Radio.php @@ -23,9 +23,9 @@ class Radio extends FormComponent [ 'id' => $this->value, 'name' => $this->name, - 'class' => 'text-accent-base bg-elevated border-contrast border-3 w-6 h-6', + 'class' => 'text-accent-base bg-elevated border-contrast border-3 focus:ring-accent w-6 h-6 transition', ], - $this->value, + $this->getValue(), old($this->name) ? old($this->name) === $this->value : $this->isChecked, ); diff --git a/app/Views/Components/Forms/RadioButton.php b/app/Views/Components/Forms/RadioButton.php index 8ea3fe53..9f470b33 100644 --- a/app/Views/Components/Forms/RadioButton.php +++ b/app/Views/Components/Forms/RadioButton.php @@ -44,7 +44,7 @@ class RadioButton extends FormComponent $radioInput = form_radio( $data, - $this->value, + $this->getValue(), old($this->name) ? old($this->name) === $this->value : $this->isSelected, ); diff --git a/app/Views/Components/Forms/RadioGroup.php b/app/Views/Components/Forms/RadioGroup.php index 5a726338..6f40ad88 100644 --- a/app/Views/Components/Forms/RadioGroup.php +++ b/app/Views/Components/Forms/RadioGroup.php @@ -30,17 +30,18 @@ class RadioGroup extends FormComponent public function render(): string { $this->mergeClass('flex flex-col'); - $options = ''; foreach ($this->options as $option) { - $options .= (new RadioButton([ + $radioButtonData = [ 'value' => $option['value'], 'name' => $this->name, 'slot' => $option['label'], 'description' => $option['description'] ?? '', - 'isSelected' => var_export($this->value === null ? ($option['value'] === $this->options[array_key_first($this->options)]['value']) : ($this->value === $option['value']), true), + 'isSelected' => var_export($this->getValue() === '' ? $option['value'] === $this->options[0]['value'] : $option['value'] === $this->getValue(), true), 'isRequired' => var_export($this->isRequired, true), - ]))->render(); + ]; + + $options .= (new RadioButton($radioButtonData))->render(); } $helperText = ''; diff --git a/app/Views/Components/Forms/Select.php b/app/Views/Components/Forms/Select.php index b9c6145e..b62c6942 100644 --- a/app/Views/Components/Forms/Select.php +++ b/app/Views/Components/Forms/Select.php @@ -8,7 +8,7 @@ use Override; class Select extends FormComponent { - protected array $props = ['options', 'defaultValue']; + protected array $props = ['options']; protected array $casts = [ 'options' => 'array', @@ -19,8 +19,6 @@ class Select extends FormComponent */ protected array $options = []; - protected string $defaultValue = ''; - #[Override] public function render(): string { @@ -35,7 +33,7 @@ class Select extends FormComponent $this->attributes = [...$defaultAttributes, ...$this->attributes]; $options = ''; - $selected = $this->value ?? $this->defaultValue; + $selected = $this->getValue(); foreach ($this->options as $option) { $options .= ''; } diff --git a/app/Views/Components/Forms/SelectMulti.php b/app/Views/Components/Forms/SelectMulti.php index 053b234f..7f785dd9 100644 --- a/app/Views/Components/Forms/SelectMulti.php +++ b/app/Views/Components/Forms/SelectMulti.php @@ -8,12 +8,10 @@ use Override; class SelectMulti extends FormComponent { - protected array $props = ['options', 'defaultValue']; + protected array $props = ['options']; protected array $casts = [ - 'value' => 'array', - 'options' => 'array', - 'defaultValue' => 'array', + 'options' => 'array', ]; /** @@ -21,11 +19,6 @@ class SelectMulti extends FormComponent */ protected array $options = []; - /** - * @var list - */ - protected array $defaultValue = []; - #[Override] public function render(): string { @@ -43,9 +36,9 @@ class SelectMulti extends FormComponent $this->attributes = [...$defaultAttributes, ...$this->attributes]; $options = ''; - $selected = $this->value ?? $this->defaultValue; + $selected = explode(',', $this->getValue()) ?? []; foreach ($this->options as $option) { - $options .= ''; + $options .= ''; } $this->attributes['name'] = $this->name . '[]'; diff --git a/app/Views/Components/Forms/Textarea.php b/app/Views/Components/Forms/Textarea.php index 85dd3f8e..b6a6d5a1 100644 --- a/app/Views/Components/Forms/Textarea.php +++ b/app/Views/Components/Forms/Textarea.php @@ -8,24 +8,19 @@ use Override; class Textarea extends FormComponent { - public function setValue(?string $value): void + public function setValue(string $value): void { - if ($value) { - $this->value = htmlspecialchars_decode($value); - } + $this->value = htmlspecialchars_decode($value); } #[Override] public function render(): string { - $this->mergeClass('bg-elevated w-full rounded-lg border-3 border-contrast focus:border-contrast focus-within:ring-accent'); + $this->mergeClass('bg-elevated w-full rounded-lg border-3 border-contrast focus:border-contrast focus-within:ring-accent transition'); $this->attributes['id'] = $this->id; - $textarea = form_textarea( - $this->attributes, - old($this->name, $this->value ?? '', false) - ); + $textarea = form_textarea($this->attributes, $this->getValue()); return << 'boolean', @@ -33,7 +33,7 @@ class Toggler extends FormComponent 'class' => 'form-switch', ], 'yes', - old($this->name) ? old($this->name) === 'yes' : $this->isChecked + in_array($this->getValue(), ['yes', 'true', 'on', '1'], true), ); $hint = $this->hint === '' ? '' : (new Hint([ diff --git a/docs/src/content/docs/en/plugins/manifest.mdx b/docs/src/content/docs/en/plugins/manifest.mdx index 7ff20582..c6051b38 100644 --- a/docs/src/content/docs/en/plugins/manifest.mdx +++ b/docs/src/content/docs/en/plugins/manifest.mdx @@ -101,16 +101,17 @@ each property being a field key and the value being a `Field` object. A field is a form element: -| Property | Type | Note | -| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | -| `type` | `checkbox` \| `datetime` \| `email` \| `group` \| `html` \| `markdown` \| `number` \| `radio-group` \| `rss` \| `select-multiple` \| `select` \| `text` \| `textarea` \| `toggler` \| `url` | Default is `text` | -| `label` (required) | `string` | Can be translated (see i18n) | -| `hint` | `string` | Can be translated (see i18n) | -| `helper` | `string` | Can be translated (see i18n) | -| `optional` | `boolean` | Default is `false` | -| `options` | `Options` | Required for `radio-group`, `select-multiple`, and `select` types. | -| `multiple` | `boolean` | Default is `false` | -| `fields` | `Array` | Required for `group` type | +| Property | Type | Note | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `type` | `checkbox` \| `datetime` \| `email` \| `group` \| `html` \| `markdown` \| `number` \| `radio-group` \| `rss` \| `select-multiple` \| `select` \| `text` \| `textarea` \| `toggler` \| `url` | Default is `text` | +| `label` (required) | `string` | Can be translated (see i18n) | +| `hint` | `string` | Can be translated (see i18n) | +| `helper` | `string` | Can be translated (see i18n) | +| `defaultValue` | `string` | You can specify multiple comma separated values for `select-multiple` | +| `optional` | `boolean` | Default is `false` | +| `options` | `Options` | Required for `radio-group`, `select-multiple`, and `select` types. | +| `multiple` | `boolean` | Default is `false` | +| `fields` | `Array` | Required for `group` type | #### Options object diff --git a/modules/Plugins/Controllers/PluginController.php b/modules/Plugins/Controllers/PluginController.php index 65ae758b..027b9a39 100644 --- a/modules/Plugins/Controllers/PluginController.php +++ b/modules/Plugins/Controllers/PluginController.php @@ -340,9 +340,10 @@ class PluginController extends BaseController $value, $this->request->getPost('client_timezone') )->setTimezone(app_timezone()), - 'markdown' => new Markdown($value), - 'rss' => new RSS($value), - default => $value, + 'markdown' => new Markdown($value), + 'rss' => new RSS($value), + 'comma-separated-string' => implode(',', $value), + default => $value, }; } } diff --git a/modules/Plugins/Core/Plugins.php b/modules/Plugins/Core/Plugins.php index 29b9eb0f..466f07a0 100644 --- a/modules/Plugins/Core/Plugins.php +++ b/modules/Plugins/Core/Plugins.php @@ -52,13 +52,14 @@ class Plugins ]; public const FIELDS_CASTS = [ - 'checkbox' => 'bool', - 'datetime' => 'datetime', - 'markdown' => 'markdown', - 'number' => 'int', - 'rss' => 'rss', - 'toggler' => 'bool', - 'url' => 'uri', + 'checkbox' => 'bool', + 'datetime' => 'datetime', + 'markdown' => 'markdown', + 'number' => 'int', + 'rss' => 'rss', + 'toggler' => 'bool', + 'url' => 'uri', + 'select-multiple' => 'comma-separated-string', ]; /** diff --git a/modules/Plugins/Manifest/Field.php b/modules/Plugins/Manifest/Field.php index 1d0d16c2..1bc2b94c 100644 --- a/modules/Plugins/Manifest/Field.php +++ b/modules/Plugins/Manifest/Field.php @@ -12,6 +12,7 @@ use Override; * @property string $label * @property string $hint * @property string $helper + * @property string $defaultValue * @property bool $optional * @property Option[] $options * @property bool $multiple @@ -20,15 +21,16 @@ use Override; class Field extends ManifestObject { protected const VALIDATION_RULES = [ - 'type' => 'permit_empty|in_list[checkbox,datetime,email,group,html,markdown,number,radio-group,rss,select-multiple,select,text,textarea,toggler,url]', - 'key' => 'required|alpha_dash', - 'label' => 'required|string', - 'hint' => 'permit_empty|string', - 'helper' => 'permit_empty|string', - 'optional' => 'permit_empty|is_boolean', - 'options' => 'permit_empty|is_list', - 'multiple' => 'permit_empty|is_boolean', - 'fields' => 'permit_empty|is_list', + 'type' => 'permit_empty|in_list[checkbox,datetime,email,group,html,markdown,number,radio-group,rss,select-multiple,select,text,textarea,toggler,url]', + 'key' => 'required|alpha_dash', + 'label' => 'required|string', + 'hint' => 'permit_empty|string', + 'helper' => 'permit_empty|string', + 'defaultValue' => 'permit_empty|string', + 'optional' => 'permit_empty|is_boolean', + 'options' => 'permit_empty|is_list', + 'multiple' => 'permit_empty|is_boolean', + 'fields' => 'permit_empty|is_list', ]; protected const CASTS = [ @@ -46,6 +48,8 @@ class Field extends ManifestObject protected string $helper = ''; + protected string $defaultValue = ''; + protected bool $optional = false; protected bool $multiple = false; diff --git a/modules/Plugins/Manifest/manifest.schema.json b/modules/Plugins/Manifest/manifest.schema.json index df5d9edf..eaaa27d4 100644 --- a/modules/Plugins/Manifest/manifest.schema.json +++ b/modules/Plugins/Manifest/manifest.schema.json @@ -204,6 +204,9 @@ "optional": { "type": "boolean" }, + "defaultValue": { + "type": "string" + }, "options": { "type": "object", "patternProperties": { diff --git a/themes/cp_admin/_partials/_nav_menu.php b/themes/cp_admin/_partials/_nav_menu.php index 6e0f16fa..04f8227b 100644 --- a/themes/cp_admin/_partials/_nav_menu.php +++ b/themes/cp_admin/_partials/_nav_menu.php @@ -4,15 +4,17 @@ continue; } - $isSectionActive = false; + $activeSection = ''; $activeItem = ''; foreach ($data['items'] as $item) { $href = str_starts_with($item, '/') ? $item : route_to($item, $podcastId ?? null, $episodeId ?? null); + // TODO: use glob to show active section when current url starts with item if (url_is($href)) { $activeItem = $item; - $isSectionActive = true; + $activeSection = $section; } } + $isSectionActive = $section === $activeSection; ?>
class=" [&[open]>summary::after]:rotate-90"> @@ -22,7 +24,7 @@ ]) ?> - + diff --git a/themes/cp_admin/contributor/delete.php b/themes/cp_admin/contributor/delete.php index 5b9f3aef..0f4fdea6 100644 --- a/themes/cp_admin/contributor/delete.php +++ b/themes/cp_admin/contributor/delete.php @@ -16,7 +16,7 @@ 'podcastTitle' => $podcast->title, ]) ?> - $contributor->username, 'podcastTitle' => $podcast->title, ]) ?> diff --git a/themes/cp_admin/episode/create.php b/themes/cp_admin/episode/create.php index b149d971..bac39db6 100644 --- a/themes/cp_admin/episode/create.php +++ b/themes/cp_admin/episode/create.php @@ -126,7 +126,7 @@ - + @@ -200,7 +200,7 @@ subtitle="" > - + diff --git a/themes/cp_admin/episode/delete.php b/themes/cp_admin/episode/delete.php index e272f5be..7121d222 100644 --- a/themes/cp_admin/episode/delete.php +++ b/themes/cp_admin/episode/delete.php @@ -11,7 +11,7 @@ - +
diff --git a/themes/cp_admin/episode/edit.php b/themes/cp_admin/episode/edit.php index 270e9c03..ab57b79d 100644 --- a/themes/cp_admin/episode/edit.php +++ b/themes/cp_admin/episode/edit.php @@ -137,7 +137,7 @@ - + @@ -274,7 +274,7 @@ subtitle="" > - + diff --git a/themes/cp_admin/episode/persons.php b/themes/cp_admin/episode/persons.php index 884bc88a..d08b8b35 100644 --- a/themes/cp_admin/episode/persons.php +++ b/themes/cp_admin/episode/persons.php @@ -26,7 +26,7 @@ label="" hint="" options="" - defaultValue="" + defaultValue="" isRequired="true" /> @@ -37,7 +37,7 @@ label="" hint="" options="" - defaultValue="" + defaultValue="" /> diff --git a/themes/cp_admin/episode/unpublish.php b/themes/cp_admin/episode/unpublish.php index d1a3f7d1..5d6d0048 100644 --- a/themes/cp_admin/episode/unpublish.php +++ b/themes/cp_admin/episode/unpublish.php @@ -11,7 +11,7 @@ - +
diff --git a/themes/cp_admin/plugins/_field.php b/themes/cp_admin/plugins/_field.php index 82ac3036..12849892 100644 --- a/themes/cp_admin/plugins/_field.php +++ b/themes/cp_admin/plugins/_field.php @@ -4,7 +4,8 @@ name="" hint="" helper="" - isChecked="" + value="" + defaultValue="" > @@ -13,7 +14,8 @@ case 'toggler': ?> name="" hint="" helper="" - isChecked="" + value="" + defaultValue="" > @@ -26,6 +28,7 @@ case 'radio-group': ?> options="" isRequired="" value="" + defaultValue="" /> @@ -39,6 +42,7 @@ case 'select': ?> options="" isRequired="" value="" + defaultValue="" /> @@ -51,7 +55,8 @@ case 'select-multiple': ?> helper="" options="" isRequired="" - value="" + value="" + defaultValue="" /> @@ -65,6 +70,7 @@ case 'email': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -79,6 +85,7 @@ case 'url': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -92,6 +99,7 @@ case 'number': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -104,6 +112,7 @@ case 'textarea': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -116,7 +125,8 @@ case 'html': ?> hint="" helper="" isRequired="" - content="" + value="" + defaultValue="" /> @@ -129,6 +139,7 @@ case 'markdown': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -141,7 +152,8 @@ case 'rss': ?> hint="" helper="" isRequired="" - content="" + value="" + defaultValue="" /> @@ -154,6 +166,7 @@ case 'datetime': ?> helper="" isRequired="" value="" + defaultValue="" /> @@ -166,5 +179,6 @@ default: ?> helper="" isRequired="" value="" + defaultValue="" /> diff --git a/themes/cp_admin/plugins/_settings_form.php b/themes/cp_admin/plugins/_settings_form.php index 8d98d0cf..be887ce5 100644 --- a/themes/cp_admin/plugins/_settings_form.php +++ b/themes/cp_admin/plugins/_settings_form.php @@ -17,15 +17,16 @@ getTranslated($plugin->getKey(), 'label') ?> fields as $subfield): ?> 'flex-1', - 'type' => $subfield->type, - 'name' => sprintf('%s[%s][%s]', $field->key, $index, $subfield->key), - 'label' => $subfield->getTranslated($plugin->getKey(), 'label'), - 'hint' => $subfield->getTranslated($plugin->getKey(), 'hint'), - 'value' => $value[$subfield->key] ?? '', - 'helper' => $subfield->getTranslated($plugin->getKey(), 'helper'), - 'options' => esc(json_encode($subfield->getOptionsArray($plugin->getKey()))), - 'optional' => $subfield->optional, + 'class' => 'flex-1', + 'type' => $subfield->type, + 'name' => sprintf('%s[%s][%s]', $field->key, $index, $subfield->key), + 'label' => $subfield->getTranslated($plugin->getKey(), 'label'), + 'hint' => $subfield->getTranslated($plugin->getKey(), 'hint'), + 'value' => $value[$subfield->key] ?? null, + 'helper' => $subfield->getTranslated($plugin->getKey(), 'helper'), + 'defaultValue' => esc($subfield->defaultValue), + 'options' => esc(json_encode($subfield->getOptionsArray($plugin->getKey()))), + 'optional' => $subfield->optional, ]) ?> @@ -42,15 +43,16 @@
'flex-1', - 'type' => $field->type, - 'name' => sprintf('%s[%s]', $field->key, $index), - 'label' => $field->getTranslated($plugin->getKey(), 'label'), - 'hint' => $field->getTranslated($plugin->getKey(), 'hint'), - 'value' => $value, - 'helper' => $field->getTranslated($plugin->getKey(), 'helper'), - 'options' => esc(json_encode($field->getOptionsArray($plugin->getKey()))), - 'optional' => $field->optional, + 'class' => 'flex-1', + 'type' => $field->type, + 'name' => sprintf('%s[%s]', $field->key, $index), + 'label' => $field->getTranslated($plugin->getKey(), 'label'), + 'hint' => $field->getTranslated($plugin->getKey(), 'hint'), + 'value' => $value, + 'helper' => $field->getTranslated($plugin->getKey(), 'helper'), + 'defaultValue' => esc($field->defaultValue), + 'options' => esc(json_encode($field->getOptionsArray($plugin->getKey()))), + 'optional' => $field->optional, ]) ?>
@@ -65,29 +67,31 @@ getTranslated($plugin->getKey(), 'label') ?> fields as $subfield): ?> 'flex-1', - 'type' => $subfield->type, - 'name' => sprintf('%s[%s]', $field->key, $subfield->key), - 'label' => $subfield->getTranslated($plugin->getKey(), 'label'), - 'hint' => $subfield->getTranslated($plugin->getKey(), 'hint'), - 'value' => $value[$subfield->key] ?? '', - 'helper' => $subfield->getTranslated($plugin->getKey(), 'helper'), - 'options' => esc(json_encode($subfield->getOptionsArray($plugin->getKey()))), - 'optional' => $subfield->optional, + 'class' => 'flex-1', + 'type' => $subfield->type, + 'name' => sprintf('%s[%s]', $field->key, $subfield->key), + 'label' => $subfield->getTranslated($plugin->getKey(), 'label'), + 'hint' => $subfield->getTranslated($plugin->getKey(), 'hint'), + 'value' => $value[$subfield->key] ?? null, + 'helper' => $subfield->getTranslated($plugin->getKey(), 'helper'), + 'defaultValue' => esc($subfield->defaultValue), + 'options' => esc(json_encode($subfield->getOptionsArray($plugin->getKey()))), + 'optional' => $subfield->optional, ]) ?> '', - 'type' => $field->type, - 'name' => $field->key, - 'label' => $field->getTranslated($plugin->getKey(), 'label'), - 'hint' => $field->getTranslated($plugin->getKey(), 'hint'), - 'value' => get_plugin_setting($plugin->getKey(), $field->key, $context), - 'helper' => $field->getTranslated($plugin->getKey(), 'helper'), - 'options' => esc(json_encode($field->getOptionsArray($plugin->getKey()))), - 'optional' => $field->optional, + 'class' => '', + 'type' => $field->type, + 'name' => $field->key, + 'label' => $field->getTranslated($plugin->getKey(), 'label'), + 'hint' => $field->getTranslated($plugin->getKey(), 'hint'), + 'value' => get_plugin_setting($plugin->getKey(), $field->key, $context), + 'helper' => $field->getTranslated($plugin->getKey(), 'helper'), + 'defaultValue' => esc($field->defaultValue), + 'options' => esc(json_encode($field->getOptionsArray($plugin->getKey()))), + 'optional' => $field->optional, ]) ?> diff --git a/themes/cp_admin/podcast/_platform.php b/themes/cp_admin/podcast/_platform.php index 9afb4e97..d0a56dee 100644 --- a/themes/cp_admin/podcast/_platform.php +++ b/themes/cp_admin/podcast/_platform.php @@ -58,7 +58,7 @@ name="slug) . '][account_id]' ?>" value="account_id) ?>" placeholder="type}") ?>" /> - +
diff --git a/themes/cp_admin/podcast/create.php b/themes/cp_admin/podcast/create.php index 1d1ff82b..e27e2700 100644 --- a/themes/cp_admin/podcast/create.php +++ b/themes/cp_admin/podcast/create.php @@ -150,7 +150,7 @@ - + @@ -168,13 +168,13 @@ - + - + - + diff --git a/themes/cp_admin/podcast/delete.php b/themes/cp_admin/podcast/delete.php index 64520a6b..9984c0c5 100644 --- a/themes/cp_admin/podcast/delete.php +++ b/themes/cp_admin/podcast/delete.php @@ -11,7 +11,7 @@ - +
diff --git a/themes/cp_admin/podcast/edit.php b/themes/cp_admin/podcast/edit.php index f2b3430e..b8e6aaa9 100644 --- a/themes/cp_admin/podcast/edit.php +++ b/themes/cp_admin/podcast/edit.php @@ -96,13 +96,13 @@ value="category_id ?>" options="" isRequired="true" /> - + - + @@ -211,13 +211,13 @@ hint="" value="new_feed_url) ?>" /> - + - + - + diff --git a/themes/cp_admin/podcast/persons.php b/themes/cp_admin/podcast/persons.php index 8e02dc1d..b3f8c8a0 100644 --- a/themes/cp_admin/podcast/persons.php +++ b/themes/cp_admin/podcast/persons.php @@ -26,7 +26,7 @@ label="" hint="" options="" - defaultValue="" + defaultValue="" isRequired="true" /> diff --git a/themes/cp_admin/settings/general.php b/themes/cp_admin/settings/general.php index 5cad5dee..f82ede6e 100644 --- a/themes/cp_admin/settings/general.php +++ b/themes/cp_admin/settings/general.php @@ -73,9 +73,9 @@ title="" subtitle="" > - - - + + + diff --git a/themes/cp_admin/subscription/delete.php b/themes/cp_admin/subscription/delete.php index 3926af44..d71644ed 100644 --- a/themes/cp_admin/subscription/delete.php +++ b/themes/cp_admin/subscription/delete.php @@ -13,7 +13,7 @@ 'subscriber' => $subscription->email, ]) ?> - +
diff --git a/themes/cp_admin/user/delete.php b/themes/cp_admin/user/delete.php index c39490c1..5bebfb4d 100644 --- a/themes/cp_admin/user/delete.php +++ b/themes/cp_admin/user/delete.php @@ -15,7 +15,7 @@ 'user' => $user->username, ]) ?> - $user->username, ]) ?> diff --git a/themes/cp_app/_admin_navbar.php b/themes/cp_app/_admin_navbar.php index 7b77b13d..33f89e99 100644 --- a/themes/cp_app/_admin_navbar.php +++ b/themes/cp_app/_admin_navbar.php @@ -45,14 +45,14 @@ if ($userPodcasts !== []) { $items[] = [ 'type' => 'link', 'title' => << -
- - -
- {$userPodcastTitle} -
- HTML +
+
+ + +
+ {$userPodcastTitle} +
+ HTML , 'uri' => route_to('notification-list', $userPodcast->id), ]; diff --git a/themes/cp_auth/login.php b/themes/cp_auth/login.php index e7224eb9..df2992eb 100644 --- a/themes/cp_auth/login.php +++ b/themes/cp_auth/login.php @@ -29,7 +29,7 @@ - +