mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 11:54:10 +00:00 
			
		
		
		
	Add allowedTypes in media type meta
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
		
							parent
							
								
									32c021db37
								
							
						
					
					
						commit
						c4bf0cdb67
					
				@ -86,6 +86,7 @@ const formatAttribute = (key, attribute, { model }) => {
 | 
				
			|||||||
      type: 'media',
 | 
					      type: 'media',
 | 
				
			||||||
      multiple: attribute.collection ? true : false,
 | 
					      multiple: attribute.collection ? true : false,
 | 
				
			||||||
      required: attribute.required ? true : false,
 | 
					      required: attribute.required ? true : false,
 | 
				
			||||||
 | 
					      allowedTypes: attribute.allowedTypes,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
 | 
				
			|||||||
@ -29,9 +29,7 @@ const hasComponent = model => {
 | 
				
			|||||||
const isConfigurable = attribute => _.get(attribute, 'configurable', true);
 | 
					const isConfigurable = attribute => _.get(attribute, 'configurable', true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const isRelation = attribute =>
 | 
					const isRelation = attribute =>
 | 
				
			||||||
  _.has(attribute, 'target') ||
 | 
					  _.has(attribute, 'target') || _.has(attribute, 'model') || _.has(attribute, 'collection');
 | 
				
			||||||
  _.has(attribute, 'model') ||
 | 
					 | 
				
			||||||
  _.has(attribute, 'collection');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Formats a component's attributes
 | 
					 * Formats a component's attributes
 | 
				
			||||||
@ -57,9 +55,7 @@ const formatAttribute = (key, attribute, { model }) => {
 | 
				
			|||||||
  if (_.has(attribute, 'type')) return attribute;
 | 
					  if (_.has(attribute, 'type')) return attribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // format relations
 | 
					  // format relations
 | 
				
			||||||
  const relation = (model.associations || []).find(
 | 
					  const relation = (model.associations || []).find(assoc => assoc.alias === key);
 | 
				
			||||||
    assoc => assoc.alias === key
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
  const { plugin, configurable } = attribute;
 | 
					  const { plugin, configurable } = attribute;
 | 
				
			||||||
  let targetEntity = attribute.model || attribute.collection;
 | 
					  let targetEntity = attribute.model || attribute.collection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -69,6 +65,7 @@ const formatAttribute = (key, attribute, { model }) => {
 | 
				
			|||||||
      multiple: attribute.collection ? true : false,
 | 
					      multiple: attribute.collection ? true : false,
 | 
				
			||||||
      required: attribute.required ? true : false,
 | 
					      required: attribute.required ? true : false,
 | 
				
			||||||
      configurable: configurable === false ? false : undefined,
 | 
					      configurable: configurable === false ? false : undefined,
 | 
				
			||||||
 | 
					      allowedTypes: attribute.allowedTypes,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user