--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class Code extends Textarea
+{
+ protected $_adminType = 'code';
+ protected $_databaseType = 'text';
+ protected $_translatable = true;
+ protected $_language = 'text';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+
+ public function getDefaultAttributes()
+ {
+ return array_merge(parent::getDefaultAttributes(), ['language' => $this->_language]);
+ }
+}
--- /dev/null
+<!-- textarea -->
+@include('crud::fields.inc.wrapper_start')
+<label>{!! $field['label'] !!}</label>
+@include('crud::fields.inc.translatable_icon')
+<textarea
+ class="code"
+ name="{{ $field['name'] }}"
+ @include('crud::fields.inc.attributes')
+
+ >{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}</textarea>
+
+{{-- HINT --}}
+@if (isset($field['hint']))
+ <p class="help-block">{!! $field['hint'] !!}</p>
+@endif
+@include('crud::fields.inc.wrapper_end')
+
+{{-- ########################################## --}}
+{{-- Extra CSS and JS for this particular field --}}
+{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
+@if ($crud->checkIfFieldIsFirstOfItsType($field))
+textarea.code{
+ font-family: Courier, monospace;
+}
+@endif