Change status text in columns.yaml in OctoberCMS
Ad
I Want to Change Yes/No to Active/Closed for that i have tried
status:
label: Status
type: group
conditions: status in (:filtered)
options:
pending: Pending
active: Active
closed: Closed
AND
status:
label: Status
type: switch
The above code is found in https://octobercms.com/docs/backend/lists#column-switch
Can anyone have any solution ?
Ad
Answer
Ad
There is no yaml configuration for switch
column type to do this, but two other solutions are possible
Method 1. You need to override localization file.
- Create
lang/en/backend
directory in your project folder - Create file
lang.php
and add there:
<?php return [ 'list' => [ 'column_switch_true' => 'Active', 'column_switch_false' => 'Closed' ], ];
- (optional) The base lang file is
modules/backend/lang/en/lang.php
if you have to override another messages
Downside:
- It will affect ALL
switch
type columns
Method 2. Create partial for this column
Change yaml configuration for the column to:
status: label: Status type: partial path: column_status
Add file
_column_status.htm
to the according folder incontrollers
folder with content:
<?php if($value) :?> Active <?php else: ?> Closed <?php endif ?>
Ad
source: stackoverflow.com
Related Questions
Ad
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page
Ad