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.

DeletionBasedOnRowData

Maybe not all entries within one list should be deletable. Maybe because of a status column, maybe due to the currently logged in user, or maybe just because of the date/time? Whatever the reason, using this interceptor you may decide dynamically which entry should be deletable and which should not. Generally, you need to enable data/bDelete. The interceptor then is capable of identifying certain entries that are prohibited of deletion.

aIf

Array of conditions that are checked against each row. If a row meets these conditions, deletion is disabled. 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 an example in TS format holding tasks (and descriptions) where every task (= row) has a status assigned. We want tasks to be deletable only if they are not yet done. Hence, the DeletionBasedOnRowData interceptor needs to check for the status to be done. In such cases it prohibits deletion - put the other way round: every entry is allowed to be deleted except if they are done.

plugin.tx_mhomsqlio {
    data {
            bDelete = 1
            aField {
                    10 {
                            sColumn = name
                            eClass = TextShort
                            sHeadline = Task
                    }
                    20 {
                            sColumn = desc
                            eClass = TextShort
                            sHeadline = Description
                    }
                    30 {
                            sColumn = status
                            eClass = Enum
                            sHeadline = Status
                    }
            }
    }
    interception {
            Action {
                    10 {
                            sAction = getRows
                            eClass = DeletionBasedOnRowData
                            aIf {
                                    0 = ###status###==done
                            }
                    }
            }
    }
}

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.