菜单

flexform配置reload显示不同配置项

2010年10月19日 - typo3

主要用到displayCond这个标签:

<mode>
<TCEforms>
<label>LLL:EXT:cfa_mooflow/locallang_db.xml:cfa_mooflow.pi_flexform.mode</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<items type=”array”>
<numIndex index=”0″ type=”array”>
<numIndex index=”0″>LLL:EXT:cfa_mooflow/locallang_db.xml:cfa_mooflow.pi_flexform.mode.0</numIndex>
<numIndex index=”1″>MANUAL</numIndex>
</numIndex>
<numIndex index=”1″ type=”array”>
<numIndex index=”0″>LLL:EXT:cfa_mooflow/locallang_db.xml:cfa_mooflow.pi_flexform.mode.1</numIndex>
<numIndex index=”1″>DIRECTORY</numIndex>
</numIndex>
</items>
</config>
</TCEforms>
</mode>

<defaultmode>
<TCEforms>
<displayCond>FIELD:mode:=:MANUAL</displayCond>
<label>LLL:EXT:cfa_mooflow/locallang_db.xml:cfa_mooflow.pi_flexform.images</label>
<config>
<type>group</type>
<internal_type>file</internal_type>
<allowed>jpg,gif,png</allowed>
<max_size>100000</max_size>
<uploadfolder>uploads/tx_cfamooflow/</uploadfolder>
<maxitems>100</maxitems>
<size>10</size>
<selectedListStyle>Width:280px</selectedListStyle>
</config>
</TCEforms>
</defaultmode>

详细信息:

Contains a condition rule for whether to display the field or not.

A rule is a string divided into several parts by “:” (colons).

The first part is the rule-type and the subsequent parts will depend on the rule type.

Currently these rule values can be used:

  1. FIELD : This evaluates based on another fields value in the record.
    1. Part 1 is the fieldname
    2. Part 2 is the evaluation type. These are the possible options:
      1. REQ : Requires the field to have a  “true” value. False values are “” (blank string) and 0 (zero) or if the field does not exist at all. All else is true.For the REQ evaluation type Part3 of the rules string must be the string “true” or “false”. If “true” then the rules returns “true” if the evaluation is true. If “false” then the rules returns “true” if the evaluation is false.
      2. > / < / >= / <= : Evaluates if the field value is greater than, less than the value in “Part 3”
      3. = / != : Evaluates if the field value is equal to value in “Part 3” (or not, if the negation flag, “!” is prefixed)
      4. IN / !IN : Evaluates if the field value is in the comma list equal to value in “Part 3” (or not, if the negation flag, “!” is prefixed)
      5. – / !- : Evaluates if the field value is in the range specified by value in “Part 3” ([min] – [max]) (or not, if the negation flag, “!” is prefixed)
  2. EXT : This evaluates based on current status of extensions.
    1. Part 1 is the extension key
    2. Part 2 is the evaluation type:
      1. LOADED : Requires the extension to be loaded if Part3 is “true” and reversed if Part3 is “false”.
  3. REC : This evaluates based on the current record (doesn’t make sense for flexform fields)
    1. Part 1 is the type.
      1. NEW : Requires the record to be new if Part2 is “true” and reversed if Part2 is “false”.
  4. HIDE_L10N_SIBLINGS : (FlexForms only) This evaluates based on whether the field is a value for the default language or an alternative language. Works only for <langChildren>=1, otherwise it has no effect.
    1. Part 1: Keywords: “except_admin” = will still show field to admin users
  5. HIDE_FOR_NON_ADMINS: This will hide the field for all non-admin users while admins can see it. Useful for FlexForm container fields which are not supposed to be edited directly via the FlexForm but rather through some other interface (TemplaVoilà’s Page module for instance).
  6. VERSION:
    1. Part 1 is the type:
      1. IS : Part 2 is “true” or “false”: If true, the field is shown only if the record is a version (pid == -1)

For FlexForm elements the fields are tags on same level. If <langChildren> is enabled, then the value of other fields on same level is taken from the same language.

The field-values of the FlexForm-parent record are prefixed with “parentRec.”. These fields can be used like every other field (since TYPO3 4.3).

Example:

This example will require the field named “tx_templavoila_ds” to be true, otherwise the field for which this rule is set will not be displayed:

'displayCond' => 'FIELD:tx_templavoila_ds:REQ:true',

This example requires the extension “static_info_tables” to be loaded, otherwise the field is not displayed (this is useful if the field makes a look-up on a table coming from another extension!):

'displayCond' => 'EXT:static_info_tables:LOADED:true',

This example would require the header-field of the FlexForm-parent record to be true, otherwise the FlexForm field is not displayed (works only within FlexForm datastructure definitions):

<displayCond>FIELD:parentRec.header:REQ:true</displayCond>

标签:

发表评论

电子邮件地址不会被公开。 必填项已用*标注