DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Browser Tutorial TCA-Configuration (en)

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2011-02-05T21:38:34
Classification:browser_tut_tca_en
Description:This is the Tutorial how to configure TCA for the Extension Browser - the Frontend Engine.
Keywords:forAdmins, forDevelopers, forBeginners, forIntermediates, forAdvanced, browser, tutorial, tca, configuration
Author:Dirk Wildt, Die Netzmacher
Email:wildt.at.die-netzmacher.de
Website:http://die-netzmacher.de
Language:en

img-1 img-2 extKey: browser_tut_tca_en img-3

Browser Tutorial TCA-Configuration (en)

This is the Tutorial how to configure TCA for the Extension Browser - the Frontend Engine.

img-4

Version: 3.6.1 - 2011-02-05

Extension Key: browser_tut_tca_en - Tutorials for the extension Browser (extkey: browser)

Language: en

Keywords: forAdmins, forDevelopers, forBeginners, forIntermediates, forAdvanced, browser, tutorial, tca, configuration

Copyright 2011, Dirk Wildt, Die Netzmacher, <wildt.at.die- netzmacher.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

Browser Tutorial TCA-Configuration (en) 1

Introduction 3

What does it do? 3

Further Information 3

Beforehand 4

Frequently reasons for an own configuration 4

Plugin 5

Get data without any pid 5

How to wrap fields automatically? 6

The Browser TCA configuration 7

TypoScript 7

TCA types group, inline and select 7

group 7

inline (no support) 7

select 7

Methods for backend forms (TCA) 8

itemsProcFunctions 8

tx_browser_tca->static_country_zones 8

Reference 10

plugin.tx_browser_pi1.autoconfig.autodiscover 10

What's new in Version 3.6? 11

tx_browser_tca->static_country_zones 11

Helpful suggestions 12

Forum 12

To-Do List 13

Change Log 14

Illustration Index 15

img-5 Illustration 1: Tutorial in PDF

Introduction What does it do? ^^^^^^^^^^^^^^^^

This is a tutorial for the extension Browser (extkey: browser).

It is

a step-by-step introduction for configuring TCA properties in the Browser TypoScript

only.

Beforehand

The Browser investigates the TYPO3 Configuration Array (TCA) to wrap fields automatically.

Example: If the field image is configured as an image in the TCA, the Browser will wrap the value of the field as an image.

But the browser doesn't check any field in every case. In case of image f.e. the browser checks only fields with the labels image or images. This should cover performance only.

Because there are a lot of good reasons to label a field according to your needs, it is possible to configure the TCA properties of the Browser.

Frequently reasons for an own configuration

  • You have trouble with your output: database markers won't wrapped in a way you are expecting it:
    • An image isn't wrapped a s an image
    • A timestamp isn't wrapped in a human readable format.
  • The Browser doesn't find a relation to a foreign table like fe_users.
  • You handle data without any pid like be_users.

Plugin

Get data without any pid

There are some tables with records, which haven't any pid. Tables are for example:

  • be_users
  • static_countries

The browser doesn't handle this data by default.

You can enable the property in the Browser plugin.

Frame1

Modul Web > List

Page Tree Page with the Browser plugin

Edit area: Browser plugin > divider [General]

Relations configuration: configured

Relations: Records without Pid[X] Display records of the root level too

How to wrap fields automatically?

Cover TypoScript

You can configure the rendering of each field of your database with TypoScript, but you don't need it for every field.

Render images and documents automatically

The browser renders some fields automatically like fields with the label "image" as images or fields with the label "document" as documents.

You can enable the automatically rendering for individual labelled fields too. You have to "tell" the Browser, which fields are concerned. The Browser plugin has an interface. See the tab [TCA] in the illustration below.

Frame1

The Browser plugin: tab [plugin]

tab [TCA]

Configuration [Adjusted]

Labels and input fields should be self-explanatory.

img-7 Illustration 4: TCA configuration by TypoScript

The Browser TCA configuration The Browser has a lot of properties for handling TCA issues, which are configured by TypoScript.

TypoScript

If you like to become familiar with the TypoScript properties, please investigate the autoconfig array (see illustration on the right hand and the TypoScript snippet below).

Usually you need to configure the TCA type for relations only (see next section)

plugin.tx_browser_pi1.autoconfig

TCA types group, inline and select

There are three possibilities to get a relation to another table:

  • group
  • inline and
  • select

The Browser respects only "select" by default. The cause is performance only.

plugin.tx_browser_pi1 {

autoconfig {

relations {

TCAconfig {

// [BOOLEAN] Respect the TCA type for relation building

type = 1

type {

// [CSV-STRING] Comma separated list of field types in the TCA,// which are allowed for looking up relations.

csvValue = select

}

}

}

}

}

If you have built a relation by group or inline, you have to configure the Browser.

group

Please extend the TCA type with "group":

plugin.tx_browser_pi1 {

autoconfig {

relations {

TCAconfig.type.csvValue = select , group

}

}

}

inline (no support)

Bad news: the Browser has nay support for the relation type "inline". Sorry.

select

This is the default (see above).

Methods for backend forms (TCA)

The Browser is provided with the first TCA method from version 3.6.1.

itemsProcFunctions

itemsProcFunctions are user defined functions, which generates items for selecting.

tx_browser_tca->static_country_zones

Sometimes you have a database with address data. If you are select a country in a backend form, it would be wonderful, when the displaying of the states (German: Bundesländer, Swiss: Kanton) depends on it.

The Browser supports this dependency for the extension static_info_tables.

Frame1

TCA snippet ext_tables.php

$TCA['tx_org_workshop'] = array (

'ctrl' => array (

...

'requestUpdate' => 'static_countries',

),

);

Comment

Line 4: If the value of the field "static countries" changed, the backend form will be reloaded.

TCA snippet tca.php

$TCA['tx_org_workshop'] = array (

...

'columns' => array (

...

'static_countries' => array (

'exclude' => 1,

'label' => 'Country',

'config' => array (

'type' => 'select',

'size' => 1,

'minitems' => 0,

'maxitems' => 1,

'items' => array(

'0' => array(

'0' => '',

),

),

'foreign_table' => 'static_countries',

),

),

'static_country_zones' => array (

'exclude' => 1,

'label' => 'State',

'config' => array (

'type' => 'select',

'size' => 1,

'minitems' => 0,

'maxitems' => 1,

'foreign_table' => 'static_country_zones',

// WORKFLOW: We don't want any iem by default

'foreign_table_where' => 'AND 0',

// WORKFLOW: We get all needed items by itemsProcFunc

'itemsProcFunc' => 'tx_browser_tca->static_country_zones',

'itemsProcFunc_conf' => array(

// If your TCA field is not called 'static_countries',// you have to configure 'countries_are_in'

//'countries_are_in' => 'static_countries',

),

),

),

...

),

);

Comment

Line 31: We want to prevent the display of the static_country_zones. The method should deliver the items only.

Line 33: We commit the handling of the item list for the select box the Browser method "static_country_zones"

Line 36: If there is a need, to call the field with the country with another label than "static_countries", you have toconfigure this field name. I.e: You are calling the field with the static_countries "country", you haveto set: itemsProcFunc_conf.countries_are_in = 'country"

Reference

See the completely reference in the manual of the Browser:

plugin.tx_browser_pi1.autoconfig.autodiscover

dontDiscoverFields
dontDiscoverFields

Property

dontDiscoverFields

Data type

string

Description

Comma separated list of fields, which shouldn't checked in the TCA.

Example:

plugin.tx_browser_pi1.autoconfig.autoDiscover {
  dontDiscoverFields {
    csvValue = uid, pid
  }
}

Default

uid, pid

items
items

Property

items

Data type

array

Description

Sorry, "item" is a confusing term. Ite

There are wrapping methods for titles, images, captions, image title fields, image alt fields, documents and timestamps.

Example:

plugin.tx_browser_pi1.autoconfig.autoDiscover {
  items {
    title = 1
    title {
      // Configuration array -> See:
    }
    image = 1
    image {
    }
    imageCaption = 1
    imageCaption {
      // Configuration array -> See:
    }
    imageAltText = 1
    imageAltText {
      // Configuration array -> See:
    }
    imageTitleText = 1
    imageTitleText {
      // Configuration array -> See:
    }
    document = 1
    document {
      // Configuration array -> See:
    }
    timestamp = 1
    timestamp {
      // Configuration array -> See:
    }
  }
}

Default

What's new in Version 3.6?

tx_browser_tca->static_country_zones

[3.6.1]

See the section "tx_browser_tca->static_country_zones" on page 8 above.

Helpful suggestions

Forum

If you have helpful suggestions, feel free to publish any question, bug or code snippet on

http://typo3-browser-forum.de/

Posts are welcome in English and German.

To-Do List

Nothing to do.

Change Log

3.6.1: Initial release

Illustration Index

Illustration 1: Tutorial in PDF 3

Illustration 2: Enable records without any pid 5

Illustration 3: The tab [TCA] in the Browser plugin 6

Illustration 4: TCA configuration by TypoScript 7

Illustration 5: Displaying of the state (2) depends on the current country (1) (extension Organiser +Workshop) 8

15