public function defineContentTableName(SuperTableField $field): string
    {
        $baseName = 'stc_' . strtolower($field->handle);
        $db = Craft::$app->getDb();
        $i = -1;

        do {
            $i++;

            $parentFieldId = '';

            // Check if this field is inside a Matrix - we need to prefix this content table if so.
            if ($field->context != 'global') {
                $parentFieldContext = explode(':', $field->context);

                if ($parentFieldContext[0] == 'matrixBlockType') {
                    $parentFieldUid = $parentFieldContext[1];
                    $parentFieldId = Db::idByUid('{{%matrixblocktypes}}', $parentFieldUid);
                }
            }
        
            if ($parentFieldId) {
                $baseName = 'stc_' . $parentFieldId . '_' . strtolower($field->handle);
            }

            $name = '{{%' . $baseName . ($i !== 0 ? '_' . $i : '') . '}}';

        } while ($name !== $field->contentTable && $db->tableExists($name));

        return $name;
    }
public function defineContentTableName(SuperTableField $field): string
    {
        $baseName = 'stc_' . strtolower($field->handle);
        $db = Craft::$app->getDb();
        $i = -1;

        do {
            $i++;

            $parentFieldId = '';

            // Check if this field is inside a Matrix - we need to prefix this content table if so.
            if ($field->context != 'global') {
                $parentFieldContext = explode(':', $field->context);

                if ($parentFieldContext[0] == 'matrixBlockType') {
                    $parentFieldUid = $parentFieldContext[1];
                    $parentFieldId = Db::idByUid('{{%matrixblocktypes}}', $parentFieldUid);
                }
            }
        
            if ($parentFieldId) {
                $baseName = 'stc_' . $parentFieldId . '_' . strtolower($field->handle);
            }

            $name = '{{%' . $baseName . ($i !== 0 ? '_' . $i : '') . '}}';

        } while ($name !== $field->contentTable && $db->tableExists($name));

        return $name;
    }
public function defineContentTableName ( SuperTableField $ field ) : string { $ baseName = 'stc_' . strtolower ( $ field -> handle ) ; $ db = Craft :: $ app -> getDb ( ) ; $ i = - 1 ; do { $ i ++ ; $ parentFieldId = '' ; // Check if this field is inside a Matrix - we need to prefix this content table if so. if ( $ field -> context != 'global' ) { $ parentFieldContext = explode ( ':' , $ field -> context ) ; if ( $ parentFieldContext [ 0 ] == 'matrixBlockType' ) { $ parentFieldUid = $ parentFieldContext [ 1 ] ; $ parentFieldId = Db :: idByUid ( '{{%matrixblocktypes}}' , $ parentFieldUid ) ; } } if ( $ parentFieldId ) { $ baseName = 'stc_' . $ parentFieldId . '_' . strtolower ( $ field -> handle ) ; } $ name = '{{%' . $ baseName . ( $ i !== 0 ? '_' . $ i : '' ) . '}}' ; } while ( $ name !== $ field -> contentTable && $ db -> tableExists ( $ name ) ) ; return $ name ; }
Defines a new Super Table content table name.

@param SuperTableField $field
@return string
Defines a new Super Table content table name .