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.

EXT: mth_feedit

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Morten Hansen
Changed:2006-05-31T00:21:06
Author:Morten Tranberg Hansen
Email:mth@daimi.au.dk
Info 3:
Info 4:

EXT: mth_feedit

Extension Key: mth_feedit

Copyright 2005, Morten Tranberg Hansen, <mth@daimi.au.dk>

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.com

Table of Contents

EXT: mth_feedit 1

Introduction 1

What does it do? 1

Users manual 1

Quick start: 1

Configuration 2

Reference 2

Known problems 2

To-Do list 2

Introduction

What does it do?

This is an API for creating and editing records in forntend based on fe_adminLib.

mth_feedit is generating a template for you, witch it passes to fe_adminLib. So it lets fe_adminLib handle the data evaluation, saving and updating, and thats why all the configuration proberties for fe_adminLib is also availiable for mth_feedit.

Features: If the extension rtehtmlarea is installed mth_feedit will use this to generate rte-textfields, and if rlmp_dateselectlib is installed mth_feedit will use this extension to generate a nice dateselecter with input fields evaluated as 'date' and 'datetime'.

The RTE content is transformed according to the TS Config in Page TS RTE.default.FE

Users manual

IMPORTANT NOTE: For examples of how to use this API see extensions 'news_feedit' or 'joboffers_feedit'These two extensions makes use of flexform_ds.cml and setFlexFormVariables from the res/ directory, which you might find useful to :)

Extensions using this API need to be USER functions, not USER_INT functions.

Quick start:

This section will give you a short overview about the basic setup requirements for mth_feedit to work with your extension.

If you want to use mth_feedit from your extension the you should first make sure that the class is availiable. This is done by:

require_once(t3lib_extMgm::extPath('mth_feedit').'class.tx_mthfeedit.php');

In the top of your extension class.

The next an final thing you'll have to do is to make an instance of the tx_mthfeedit class and call the ini function, like this:

$mthfeedit = t3lib_div::makeInstance('tx_mthfeedit');
$content = $mthfeedit->init($this,$conf);

If you pass the right configuration for mth_feedit in $conf (see next section), mth_feedit will do the job for you.

Coding features:

Overriding functions

As you properly already know mth_feedit is build on top fe_adminLib. mth_feedit takes care of creating the templates for you, and fe_adminLib handles the dataparsing and communication with the database. The templates mth_feedit generates is divided into some subparts: required, email, edit, editmenu, create, delete, setfixed. If you want to generate your own templates for one of these classes ,its possible to override each of the functions in mth_feedit there is generating a template class in your plugin class. mth_feedit simply checks the caller for these functions, and if it exists it will call them instead of its own. (see function getDefaultTemplate in mth_feedit source)

Configuration

Reference

mth_feedit is build on top of fe_adminLib, so it takes all the configuration from that one. See TSREF section on fe_adminLib.

ALL PROPERTIES FROM fe_adminLib

Property

ALL PROPERTIES FROM fe_adminLib

Data type

Description

mth_feedit can take all proberties from fe_adminLib (see TSREF).

Examples:

table = tt_news

The 'table' proberty from fe_adminLib defines the table to edit records from.

create.fields = title, text, author, date
edit.fields = title, text, author, date

The 'fields' proberty from fe_adminLib difines witch fields trom the table there is allowed to be changed.

pid = 1

The 'pid' proberty from fe_adminLib difines the page where the records is and should be saved

Extra features :

- For property overrideValues on edit and create, and for property defaultValues on create. If you have a field with evaluation type 'date' or datetime, and you set the defaultValue (or overrideValue) for that field to 'now+30' this value will be transformed into currenttime+30days (it is possible to use minus as well).

Default

show_fields

Property

show_fields

Data type

list

Description

Defines witch fields from the 'fields' proberties there should be shown in the frontend.

NOTE: The order of the fields in the list is the order of how the fields will be showed.

Extra features:

- If option divide2tabs is set it is possible to divide the frontend form into tabs. To choose how this division should be it is possible to insert divider fields for each tabs in the show_fields list. The grammar of these is '--div--;tabLabel', where tabLabel is a key in the language file of your plugin.

Example:

create.fields = --div--;name, firstname, lastname, -div--;address, street, town, country

This will result in a form like:

| Your Name | Your Address |

Firstname: ___________

Lastname: ___________

And:

| Your Name| Your Address |

Street: ___________

Town: ___________

Country: __________

Default

divide2tabs

Property

divide2tabs

Data type

boolean

Description

If set, it is possible to divide the frontend form into tabs.

These tabs shall be defined in the show_fields list, else no tabs will be shown. (see option show_fields)

Default

required_marker

Property

required_marker

Data type

String

Description

The marker there is displayed in front of required fields.

Default

*

delete.preview

Property

delete.preview

Data type

boolean

Description

Decides id there should be a preview mode before delete of a record.

NOTE: This option is close related to the 'delete' option from fe_adminLib whitch decides if it should be possible to delete a record

Default

1

create.preview.dontDisplayEmptyFields

Property

create.preview.dontDisplayEmptyFields

and

edit.preview.dontDisplayEmptyFields

Data type

boolean

Description

It set empty fields will not be displayed in preview on the web or in emails.

NOTE: If empty fields is not removed with this the label no_value from locallang is displayed when fields is empty (this label is not saved to the DB, only displayed on the web and in emails).

Default

fe_cruser_id

Property

fe_cruser_id

Data type

string

Description

This points to the field in the table where fe_adminLib will save the feuser owner of the record.

NOTE: If set, this will overwrite the following field in TCA

$GLOBALS['TCA'][$theTable]['ctrl']['fe_cruser_id']

Example (from news_feedit):

fe_cruser_id = tx_newsfeedit_fe_cruser_id

Default

fe_crgroup_id

Property

fe_crgroup_id

Data type

string

Description

This points to the field in the table where fe_adminLib will save the fegroup there are allowed to edit the record.

NOTE: If set, this will overwrite the following field in TCA

$GLOBALS['TCA'][$theTable]['ctrl']['fe_crgroup_id']

Example (from news_feedit):

fe_crgroup_id = tx_newsfeedit_fe_crgroup_id

Default

requireLogin

Property

requireLogin

Data type

boolean

Description

If set, a feuser has to be logged in to create or edit a record.

Default

no_header

Property

no_header

Data type

boolean

Description

If set, mth_feedit will not display automatic generated h1 headers for the form.

Default

text_in_top_of_form

Property

text_in_top_of_form

Data type

string/stdWrap

Description

Text shown in top of every form generated by mthfeedit.

If the form needs som general explanation for the users, you should put it here.

Default

text_in_top_of_preview

Property

text_in_top_of_preview

Data type

string/stdWrap

Description

Text shown in top of every preview generated by mthfeedit.

If the preview needs som general explanation for the users, you should put it here.

Default

keep_piVars

Property

keep_piVars

Data type

list

Description

A comma seperated list of the piVars from the caller of mth_feedit to include in the forms generated by mth_feedit.

Example:

plugin.tx_daimievent_pi1.mthfeedit {
  keep_piVars = uid
}

The example will add the value of the piVar 'uid' in the plugin tx_daimievent_pi1 to the forms generated by mth_feedit as a hidden input field.

Default

help

Property

help

Data type

boolean

Description

If set, and context sensitive help is availiable, a little icon with help will be displayed together with the fields.

See help.file under here.

Default

help.file

Property

help.file

Data type

Description

The is the locallang csh file with the labels for the tabel.

If no file is defined, no help text will be shown.

Example:

plugin.tx_joboffersfeedit_pi1.mthfeedit {
help = 1
help.file = EXT:ab_minijoboffers/locallang_csh_jobs.php
}

Default

help.type_keys

Property

help.type_keys

Data type

list

Description

List of type keys from csh array for each field to display in the help window.

Known supported values are:

description,details,syntax,seeAlso

See the TYPO3 Core Doc: Inside TYPO3, for more informations.

Default

description

help.window.style

Property

help.window.style

&&

help.window.height

&&

help.window.width

Data type

string

Description

This is visual options for the little help window (displayed when clicking the help icons, see option help).

The style is the the stylesheet of the window, the height is the height of the window and the width is the width of the window :)

Example:

plugin.tx_newsfeedit_pi1.mthfeedit {
  help.window {
    style (
      .tx-newsfeedit-pi1-help-header {
        font-weight:bold;
      }
    )
    width = 450
    height = 155
  }
}

Default

height = 40

width = 300

[tsref: mth_feedit]

((generated))
Example

Here is an example of how to use the stuff from the reference (taken from the extension news_feedit):

plugin.tx_newsfeedit_pi1.mthfeedit {
  allowedGroups = 1
  pid = 9

  infomail = 1
  email.from = FROM@EMAIL.COM
  email.fromName = FROM NAME
  email.admin = ADMIN@EMAIL.COM
  email.field = FIELD FROM RECORD WHERE USERS EMAIL SHOULD BE FOUND.

  help = 1
  help {
    file = EXT:tt_news/locallang_csh_ttnews.php
    window {
      style (
        .tx-newsfeedit-pi1-help-body {
          background-color:#eeeeee;
          font-size:small;
        }
        .tx-newsfeedit-pi1-help-header {
          font-weight:bold;
        }
      )
      width = 450
      height = 155
     }
  }
}

Known problems

- Let me know, if you find some

To-Do list

- Nothing right now

img-1 EXT: mth_feedit - 4