/** * Helper function to replace standard fields with multi lingual equivalents * @param array $fields * @param Model $model * @return array */ protected function processFormMLFields($fields, $model) { $translatable = array_flip($model->getTranslatableAttributes()); /* * Special: A custom field "markup_html" is used for Content templates. */ if ($model instanceof Content && array_key_exists('markup', $translatable)) { $translatable['markup_html'] = true; } foreach ($fields as $name => $config) { if (!array_key_exists($name, $translatable)) { continue; } $type = array_get($config, 'type', 'text'); if ($type == 'text') { $fields[$name]['type'] = 'mltext'; } elseif ($type == 'textarea') { $fields[$name]['type'] = 'mltextarea'; } elseif ($type == 'richeditor') { $fields[$name]['type'] = 'mlricheditor'; } elseif ($type == 'markdown') { $fields[$name]['type'] = 'mlmarkdowneditor'; } elseif ($type == 'repeater') { $fields[$name]['type'] = 'mlrepeater'; } } return $fields; }