FluidTYPO3\Flux\Provider\AbstractProvider::trigger PHP Method

trigger() public method

public trigger ( array $row, string $table, string $field, string $extensionKey = NULL ) : boolean
$row array
$table string
$field string
$extensionKey string
return boolean
    public function trigger(array $row, $table, $field, $extensionKey = NULL)
    {
        $providerFieldName = $this->getFieldName($row);
        $providerTableName = $this->tableName;
        $providerExtensionKey = $this->extensionKey;
        $contentObjectType = $this->contentObjectType;
        $listType = $this->listType;
        $rowContainsPlugin = FALSE === empty($row['CType']) && self::CONTENT_OBJECT_TYPE_LIST === $row['CType'];
        $rowIsEmpty = 0 === count($row);
        $matchesContentType = TRUE === empty($contentObjectType) && TRUE === empty($row['CType']) || FALSE === empty($row['CType']) && $row['CType'] === $contentObjectType;
        $matchesPluginType = FALSE === empty($row['list_type']) && $row['list_type'] === $listType;
        $matchesTableName = $providerTableName === $table || NULL === $table;
        $matchesFieldName = $providerFieldName === $field || NULL === $field;
        $matchesExtensionKey = $providerExtensionKey === $extensionKey || NULL === $extensionKey;
        $isFullMatch = $matchesExtensionKey && $matchesTableName && $matchesFieldName && ($matchesContentType || $rowContainsPlugin && $matchesPluginType);
        $isFallbackMatch = $matchesTableName && $matchesFieldName && $rowIsEmpty;
        return $isFullMatch || $isFallbackMatch;
    }

Usage Example

Esempio n. 1
0
 /**
  * @param array $row
  * @param string $table
  * @param string $field
  * @param string $extensionKey
  * @return bool
  */
 public function trigger(array $row, $table, $field, $extensionKey = NULL)
 {
     if ('tt_content' === $table && NULL === $field) {
         // This Provider will bypass checking for matched plugin-
         // and/or content type in the case where $field is NULL.
         // This case is triggered *once* per record from our
         // TCEMain class; subsequent calls all have a $field and
         // will pass through to the basic trigger() method.
         // Note for implementers: if you subclass this ContentProvider
         // in your own extension (which is perfectly valid to do!)
         // please consider if you must override the trigger() method
         // to ensure that your particular Provider only reacts when
         // users save records that your Provider actually supports.
         return TRUE;
     }
     return parent::trigger($row, $table, $field, $extensionKey);
 }
All Usage Examples Of FluidTYPO3\Flux\Provider\AbstractProvider::trigger