[TYPO3-dev] Access pictures added with foreign_table in plugin view

Dominik J. dominik1991jahn at gmail.com
Thu Nov 6 14:56:06 CET 2014


Hello,

I am currently developing an extension which displays pictures on a page. I used Flexform to create the plugin configuration form:

<?xml version="1.0" encoding="UTF-8" ?>
<T3DataStructure>
  <meta type="array">
    <langChildren>0</langChildren>
    <langDisable>1</langDisable>
  </meta>
  <sheets>
  	<sDEF>
  	  <ROOT>
  	  	<TCEforms>
  	  		<sheetTitle>Pictures</sheetTitle>
  	  	</TCEforms>
  	  	
	    <type>array</type>
	    <el>
	      <settings.pictures>
	        <TCEforms>
	          <exclude>1</exclude>
	          <label>Select the pictures you want to use for the background changer.</label>
	          <config>
	            <type>inline</type>
	            
	            <appearance>
	            	<headerThumbnail>
	            		<field>uid_local</field>
	            		<height>45c</height>
	            		<width>45</width>
	            	</headerThumbnail>
	            	<useSortable>1</useSortable>
	            	<enabledControls>
	            		<new>0</new>
	            	</enabledControls>
	            </appearance>
	            
	            <foreign_table>sys_file_reference</foreign_table>
	            <foreign_table_field>tablenames</foreign_table_field>
	            <foreign_field>uid_foreign</foreign_field>
	            <foreign_label>uid_local</foreign_label>
	            <foreign_selector>uid_local</foreign_selector>
	            
	            <!-- Deactivate text fields (title, desc,...) -->
	            <foreign_types type="array">
	            	<numIndex index="2">
	            		<showitem></showitem>
	            	</numIndex>
	            </foreign_types>
	            
	            <foreign_match_fields>
	            	<fieldname>image</fieldname>
	            </foreign_match_fields>
	            
	            <!-- Only FILES of type GIF/JPG/PNG are allowed -->
	            <foreign_selector_fieldTcaOverride>
	            	<config>
	            		<appearance>
	            			<elementBrowserAllowed>gif,jpg,jpeg,png</elementBrowserAllowed>
	            			<elementBrowserType>file</elementBrowserType>
	            		</appearance>
	            	</config>
	            </foreign_selector_fieldTcaOverride>
	            
	          </config>
	        </TCEforms>
	      </settings.pictures>
	    </el>
	  </ROOT>
  	</sDEF>
  	<sSettings>
  		<ROOT>
  			<TCEforms>
  				<sheetTitle>Settings</sheetTitle>
  			</TCEforms>
  			
  			<type>array</type>
  			<el>
  				<settings.duration>
  					<TCEforms>
  						<exclude>1</exclude>
  						<label>Duration (in milliseconds)</label>
  						<config>
  							<type>input</type>
  							<size>5</size>
  							<max>5</max>
  							<eval>int</eval>
  						</config>
  					</TCEforms>
  				</settings.duration>
  				
  				<!--settings.effect>
  					<TCEforms>
  						<exclude>1</exclude>
  						<label>Effect</label>
  					</TCEforms>
  				</settings.effect-->
  			</el>
  		</ROOT>
  	</sSettings>
  	
  </sheets>
</T3DataStructure>

Now there's two problems:

1) (And that's strange) The first time using this form I was able to assign pictures. Then I re-installed the extension and created a new container for the plugin. When I add a picture now (which used to work perfectly fine!) they don't even have the "Info"-icon. When I save, I get the following error:

#1381590731: Metadata can only be retrieved for indexed files. 

The only way to fix it is to open PMA and set the foreign_uid-field to the new dataset manually. Like I said, it worked before!

2) This is the main problem: I am trying to access my pictures with $this->settings['images'] in my controller action, but all it returns is the number of pictures assigned. How do I get the pictures that I assigned in the backend?

I appreciate any help! I really need this extension to work (and I also can't use other ready-made extensions which do the same thing as the one I'm trying to make)



More information about the TYPO3-dev mailing list