Skip to content

Instantly share code, notes, and snippets.

@maddy2101
Last active March 12, 2021 12:08
Show Gist options
  • Select an option

  • Save maddy2101/5668835 to your computer and use it in GitHub Desktop.

Select an option

Save maddy2101/5668835 to your computer and use it in GitHub Desktop.

Revisions

  1. maddy2101 revised this gist Feb 15, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -97,6 +97,6 @@ public function getImages() {
    Fluid View (this is a Partial, providing all images with a link to open it in a lightbox, classic clickenlarge):
    <f:for each="{images}" as="image" >
    <a href="{f:uri.image(src:image.uid,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.uid}" alt="" width='101' height="67" treatIdAsReference="1"/>
    <f:image src="{image.uid}" alt="{image.originalResorce.alternative}" width='101' height="67" treatIdAsReference="1"/>
    </a >
    </f:for >
  2. maddy2101 revised this gist Feb 15, 2014. 1 changed file with 35 additions and 1 deletion.
    36 changes: 35 additions & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,41 @@
    'height' => '100',
    ),
    'createNewRelationLinkTitle' => 'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:tx_yourextension_db_table.add-images'
    )
    ),
    // custom configuration for displaying fields in the overlay/reference table
    // to use the imageoverlayPalette instead of the basicoverlayPalette
    'foreign_types' => array(
    '0' => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    ),
    \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    ),
    \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    ),
    \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    ),
    \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    ),
    \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
    'showitem' => '
    --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
    --palette--;;filePalette'
    )
    ),
    ),
    $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
  3. maddy2101 revised this gist Feb 15, 2014. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,15 @@
    'label' => 'images',
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
    'images',
    array(),
    array(
    'appearance' => array(
    'headerThumbnail' => array(
    'width' => '100',
    'height' => '100',
    ),
    'createNewRelationLinkTitle' => 'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:tx_yourextension_db_table.add-images'
    )
    ),
    $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    ),
  4. maddy2101 revised this gist Feb 15, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,11 @@
    'images' => array(
    'exclude' => 0,
    'label' => 'images',
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagerUtility::getFileFieldTCAConfig('images')
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
    'images',
    array(),
    $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    ),
    ...
    ============================================================================
  5. maddy2101 revised this gist Jun 10, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    'images' => array(
    'exclude' => 0,
    'label' => 'images',
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagerUtility::getFileFieldTCA('images')
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagerUtility::getFileFieldTCAConfig('images')
    ),
    ...
    ============================================================================
  6. maddy2101 revised this gist May 31, 2013. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -45,9 +45,6 @@ public function setImages($images) {
    * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
    */
    public function getImages() {
    if ($this->images instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingStorage) {
    $this->images->_loadRealInstance();
    }
    return $this->images;
    }
    ==============================================================================
  7. maddy2101 revised this gist May 31, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ public function setImages($images) {
    * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
    */
    public function getImages() {
    if ($this->images instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
    if ($this->images instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingStorage) {
    $this->images->_loadRealInstance();
    }
    return $this->images;
  8. maddy2101 revised this gist May 31, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ public function setImages($images) {
    * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
    */
    public function getImages() {
    if ($this->images instanceof LazyLoadingProxy) {
    if ($this->images instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
    $this->images->_loadRealInstance();
    }
    return $this->images;
  9. maddy2101 renamed this gist May 29, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. maddy2101 revised this gist May 29, 2013. 1 changed file with 1 addition and 53 deletions.
    54 changes: 1 addition & 53 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -6,59 +6,7 @@ TCA
    'images' => array(
    'exclude' => 0,
    'label' => 'images',
    'config' => array(
    'type' => 'inline',
    'foreign_table' => 'sys_file_reference',
    'foreign_field' => 'uid_foreign',
    'foreign_sortby' => 'sorting_foreign',
    'foreign_table_field' => 'tablenames',
    'foreign_match_fields' => array(
    'fieldname' => 'image'
    ),
    'foreign_label' => 'uid_local',
    'foreign_selector' => 'uid_local',
    'foreign_selector_fieldTcaOverride' => array(
    'config' => array(
    'appearance' => array(
    'elementBrowserType' => 'file',
    'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    )
    ),
    'filter' => array(
    array(
    'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren, 'parameters' => array(
    'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
    'disallowedFileExtensions' => ''
    )
    )
    ),
    'appearance' => array(
    'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
    'useSortable' => TRUE,
    'headerThumbnail' => array(
    'field' => 'uid_local',
    'width' => '64',
    'height' => '64',
    ),
    'showPossibleLocalizationRecords' => TRUE,
    'showRemovedLocalizationRecords' => TRUE,
    'showSynchronizationLink' => TRUE,
    'enabledControls' => array(
    'info' => FALSE,
    'new' => FALSE,
    'dragdrop' => TRUE,
    'sort' => FALSE,
    'hide' => TRUE,
    'delete' => TRUE,
    'localize' => TRUE,
    ),
    ),
    'behaviour' => array(
    'localizationMode' => 'select',
    'localizeChildrenAtParentLocalization' => TRUE,
    ),
    ),
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagerUtility::getFileFieldTCA('images')
    ),
    ...
    ============================================================================
  11. maddy2101 revised this gist May 29, 2013. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    SQL:
    images int(11) unsigned DEFAULT '0',

    =======================================================
    TCA
    ....
    'images' => array(
    @@ -61,9 +61,8 @@ TCA
    ),
    ),
    ...

    ============================================================================
    Model:

    /**
    * images to use in the gallery
    *
    @@ -103,9 +102,8 @@ public function getImages() {
    }
    return $this->images;
    }

    ==============================================================================
    Fluid View (this is a Partial, providing all images with a link to open it in a lightbox, classic clickenlarge):

    <f:for each="{images}" as="image" >
    <a href="{f:uri.image(src:image.uid,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.uid}" alt="" width='101' height="67" treatIdAsReference="1"/>
  12. maddy2101 revised this gist May 29, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -107,7 +107,7 @@ public function getImages() {
    Fluid View (this is a Partial, providing all images with a link to open it in a lightbox, classic clickenlarge):

    <f:for each="{images}" as="image" >
    <a href="{f:uri.image(src:image.originalResource,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.originalResource}" alt="" width='101' height="67" treatIdAsReference="1"/>
    <a href="{f:uri.image(src:image.uid,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.uid}" alt="" width='101' height="67" treatIdAsReference="1"/>
    </a >
    </f:for >
  13. maddy2101 revised this gist May 29, 2013. 1 changed file with 55 additions and 61 deletions.
    116 changes: 55 additions & 61 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -4,63 +4,62 @@ images int(11) unsigned DEFAULT '0',
    TCA
    ....
    'images' => array(
    'exclude' => 0,
    'label' => 'images',
    'exclude' => 0,
    'label' => 'images',
    'config' => array(
    'type' => 'inline',
    'foreign_table' => 'sys_file_reference',
    'foreign_field' => 'uid_foreign',
    'foreign_sortby' => 'sorting_foreign',
    'foreign_table_field' => 'tablenames',
    'foreign_match_fields' => array(
    'fieldname' => 'image'
    ),
    'foreign_label' => 'uid_local',
    'foreign_selector' => 'uid_local',
    'foreign_selector_fieldTcaOverride' => array(
    'config' => array(
    'type' => 'inline',
    'foreign_table' => 'sys_file_reference',
    'foreign_field' => 'uid_foreign',
    'foreign_sortby' => 'sorting_foreign',
    'foreign_table_field' => 'tablenames',
    'foreign_match_fields' => array(
    'fieldname' => 'image'
    ),
    'foreign_label' => 'uid_local',
    'foreign_selector' => 'uid_local',
    'foreign_selector_fieldTcaOverride' => array(
    'config' => array(
    'appearance' => array(
    'elementBrowserType' => 'file',
    'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    )
    ),
    'filter' => array(
    array(
    'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
    'parameters' => array(
    'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
    'disallowedFileExtensions' => ''
    )
    )
    ),
    'appearance' => array(
    'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
    'useSortable' => TRUE,
    'headerThumbnail' => array(
    'field' => 'uid_local',
    'width' => '64',
    'height' => '64',
    ),
    'showPossibleLocalizationRecords' => TRUE,
    'showRemovedLocalizationRecords' => TRUE,
    'showSynchronizationLink' => TRUE,
    'enabledControls' => array(
    'info' => FALSE,
    'new' => FALSE,
    'dragdrop' => TRUE,
    'sort' => FALSE,
    'hide' => TRUE,
    'delete' => TRUE,
    'localize' => TRUE,
    ),
    ),
    'behaviour' => array(
    'localizationMode' => 'select',
    'localizeChildrenAtParentLocalization' => TRUE,
    ),
    'elementBrowserType' => 'file',
    'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    )
    ),
    'filter' => array(
    array(
    'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren, 'parameters' => array(
    'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
    'disallowedFileExtensions' => ''
    )
    )
    ),
    'appearance' => array(
    'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
    'useSortable' => TRUE,
    'headerThumbnail' => array(
    'field' => 'uid_local',
    'width' => '64',
    'height' => '64',
    ),
    'showPossibleLocalizationRecords' => TRUE,
    'showRemovedLocalizationRecords' => TRUE,
    'showSynchronizationLink' => TRUE,
    'enabledControls' => array(
    'info' => FALSE,
    'new' => FALSE,
    'dragdrop' => TRUE,
    'sort' => FALSE,
    'hide' => TRUE,
    'delete' => TRUE,
    'localize' => TRUE,
    ),
    ),
    'behaviour' => array(
    'localizationMode' => 'select',
    'localizeChildrenAtParentLocalization' => TRUE,
    ),
    ),
    ),
    ...

    Model:
    @@ -102,18 +101,13 @@ public function getImages() {
    if ($this->images instanceof LazyLoadingProxy) {
    $this->images->_loadRealInstance();
    }
    $images = array();
    /** @var \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileReference */
    foreach ($this->images as $fileReference) {
    $images[] = $fileReference->getOriginalResource();
    }
    return $images;
    return $this->images;
    }

    Fluid View (this is a Partial, providing all images with a link to open it in a lightbox, classic clickenlarge):

    <f:for each="{images}" as="image" >
    <a href="{f:uri.image(src:image.uid,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.uid}" alt="" width='101' height="67" treatIdAsReference="1"/>
    <a href="{f:uri.image(src:image.originalResource,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.originalResource}" alt="" width='101' height="67" treatIdAsReference="1"/>
    </a >
    </f:for >
  14. maddy2101 revised this gist May 29, 2013. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    SQL:
    images int(11) unsigned DEFAULT '0',

    TCA
    ....
    'images' => array(
  15. maddy2101 revised this gist May 29, 2013. 1 changed file with 56 additions and 1 deletion.
    57 changes: 56 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -58,4 +58,59 @@ TCA
    ),
    ),
    ),
    ...
    ...

    Model:

    /**
    * images to use in the gallery
    *
    * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
    * @lazy
    */
    protected $images;

    /**
    * __construct
    *
    * @return AbstractObject
    */
    public function __construct() {
    $this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
    }

    /**
    * sets the Images
    *
    * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $images
    *
    * @return void
    */
    public function setImages($images) {
    $this->images = $images;
    }

    /**
    * get the Images
    *
    * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
    */
    public function getImages() {
    if ($this->images instanceof LazyLoadingProxy) {
    $this->images->_loadRealInstance();
    }
    $images = array();
    /** @var \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileReference */
    foreach ($this->images as $fileReference) {
    $images[] = $fileReference->getOriginalResource();
    }
    return $images;
    }

    Fluid View (this is a Partial, providing all images with a link to open it in a lightbox, classic clickenlarge):

    <f:for each="{images}" as="image" >
    <a href="{f:uri.image(src:image.uid,treatIdAsReference:1)}" class="lightbox" rel="gallery">
    <f:image src="{image.uid}" alt="" width='101' height="67" treatIdAsReference="1"/>
    </a >
    </f:for >
  16. maddy2101 created this gist May 29, 2013.
    61 changes: 61 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    TCA
    ....
    'images' => array(
    'exclude' => 0,
    'label' => 'images',
    'config' => array(
    'type' => 'inline',
    'foreign_table' => 'sys_file_reference',
    'foreign_field' => 'uid_foreign',
    'foreign_sortby' => 'sorting_foreign',
    'foreign_table_field' => 'tablenames',
    'foreign_match_fields' => array(
    'fieldname' => 'image'
    ),
    'foreign_label' => 'uid_local',
    'foreign_selector' => 'uid_local',
    'foreign_selector_fieldTcaOverride' => array(
    'config' => array(
    'appearance' => array(
    'elementBrowserType' => 'file',
    'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    )
    )
    ),
    'filter' => array(
    array(
    'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
    'parameters' => array(
    'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
    'disallowedFileExtensions' => ''
    )
    )
    ),
    'appearance' => array(
    'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
    'useSortable' => TRUE,
    'headerThumbnail' => array(
    'field' => 'uid_local',
    'width' => '64',
    'height' => '64',
    ),
    'showPossibleLocalizationRecords' => TRUE,
    'showRemovedLocalizationRecords' => TRUE,
    'showSynchronizationLink' => TRUE,
    'enabledControls' => array(
    'info' => FALSE,
    'new' => FALSE,
    'dragdrop' => TRUE,
    'sort' => FALSE,
    'hide' => TRUE,
    'delete' => TRUE,
    'localize' => TRUE,
    ),
    ),
    'behaviour' => array(
    'localizationMode' => 'select',
    'localizeChildrenAtParentLocalization' => TRUE,
    ),
    ),
    ),
    ...