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.

RewriteEditLinkBasedOnRowData

Sometimes it's useful to 'abuse' the edit link as it is a nice usability feature to just click onto a row. Thus you might want to link to a certain page/file/url depending on the current row when the user clicks onto it. To achieve that you have to

  • enable editing (data/bEdit)
  • set a manual edit link (data/sEditLink)
  • tell the SQL Frontend to use that edit link (data/bOnEditLinkToPage)

Now, if you want to have different links depending the row, this is the right interceptor for you. Why would you want that? Well, let's imagine a FileDirectory data handler where directories should link to the same page in order to display this folder's contents whereas files shall link to themselves so that they open directly.

aIf

Array of conditions that are checked against each row. If a row meets these conditions the edit link is rewritten according to sEditLinkNew. This is an array consisting of single conditions where each condition has to take one of the following formats:

  • variable name only (example: uid) ckecks if this variable is set within sIfSource
  • variable==value (example: username==mario) checks if variable equals the value
  • variable!=value (example: username!=mario, also username!=) checks if variable does not equal value (you may also use empty as value)
  • variable<value checks if numeric variable is lower than value (and accordingly are the following)
  • variable>value
  • variable<=value
  • variable>=value

Both variable and value may consist of markers just like in dbal/sWhereGet. Furthermore you may use markers in the format ###substring/3/2:my_column### where my_column is a column name from that row and the numbers behind substring are the numbers applies to PHP's substr function (just like in interception/CreateId).

Here's a full example in TS format checking the entries from a FileDirectory dbal handler for files and directories:

plugin.tx_mhomsqlio {
    dbal {
            bGetSubDirectoryViaParam = 1
            eType = FileDirectory
            sDatabase = fileadmin
            sTable =
            aSubDirectoryParam {
                    sSource = GP
                    sField = dir
            }
    }
    data {
            bEdit = 1
            eDisplay = Table
            bMultiple =
            bOnEditLinkToPage = 1
            sEditLink = ?id=123&dir=###parent######directory###
            aField {
                    1 {
                            sColumn = parent
                            bHidden = 1
                    }
                    2 {
                            sColumn = directory
                            bHidden = 1
                    }
                    10 {
                            sColumn = name
                            eClass = TextShort
                            sHeadline = Name
                    }
                    20 {
                            sColumn = type
                            eClass = TextShort
                            sHeadline = Type
                            bAutofilter = 1
                    }
                    30 {
                            sColumn = tstamp_creation
                            eClass = Timestamp
                            sHeadline = Creation
                            sFormat = Y-m-d H:i
                    }
            }
    }
    interception {
            Action {
                    10 {
                            sAction = getRows
                            eClass = RewriteEditLinkBasedOnRowData
                            aIf {
                                    0 = ###type###==file
                            }
                            sEditLinkNew = fileadmin/###substring/13:_sEditLink######name###
                    }
            }
    }
}

sIfConnect

String (either and or or). Specifies if just one or all conditions in aIf have to apply in order to rewrite the link. Default is and.

sEditLinkNew

String. The newly created link for rows where the if checks apply. Use well-known markers here as well. Links for rows where the checks don't apply stay as they are.