mirror of
https://github.com/strapi/strapi.git
synced 2025-12-04 19:13:20 +00:00
25 lines
685 B
JavaScript
25 lines
685 B
JavaScript
import React from 'react';
|
|
import get from 'lodash/get';
|
|
import LocaleListCell from '../components/LocaleListCell/LocaleListCell';
|
|
|
|
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
const isFieldLocalized = get(layout, 'contentType.pluginOptions.i18n.localized', false);
|
|
|
|
if (!isFieldLocalized) {
|
|
return displayedHeaders;
|
|
}
|
|
|
|
return [
|
|
...displayedHeaders,
|
|
{
|
|
key: '__locale_key__',
|
|
fieldSchema: { type: 'string' },
|
|
metadatas: { label: 'Content available in', searchable: false, sortable: false },
|
|
name: 'locales',
|
|
cellFormatter: props => <LocaleListCell {...props} />,
|
|
},
|
|
];
|
|
};
|
|
|
|
export default addColumnToTableHook;
|