<commit_before><?php
$links = [];
foreach ($actions as $name => $config) {
    $config += ['method' => 'GET'];

    if ((empty($config['url']['controller']) || $this->request->controller === $config['url']['controller']) &&
        (!empty($config['url']['action']) && $this->request->action === $config['url']['action'])
    ) {
        continue;
    }

    $linkOptions = [];
    if (isset($config['options'])) {
        $linkOptions = $config['options'];
    }

    if ($config['method'] === 'DELETE') {
        $linkOptions += [
            'block' => 'action_link_forms',
            'confirm' => __d('crud', 'Are you sure you want to delete record #{0}?', [$singularVar->{$primaryKey}])
        ];
    }

    if ($config['method'] !== 'GET') {
        $linkOptions += [
            'method' => $config['method']
        ];
    }

    if (!empty($config['callback'])) {
        $callback = $config['callback'];
        unset($config['callback']);
        $config['options'] = $linkOptions;
        $links[$name] = $callback($config, !empty($singularVar) ? $singularVar : null, $this);
        continue;
    }

    $url = $config['url'];
    if (!empty($singularVar)) {
        $url[] = $singularVar->{$primaryKey};
    }


    if ($config['method'] !== 'GET') {
        $links[$name] = $this->Form->postLink(
            $config['title'],
            $url,
            $linkOptions
        );
        continue;
    }

    $links[$name] = [
        'title' => $config['title'],
        'url' => $url,
        'options' => $linkOptions,
        'method' => $config['method']
    ];
}
?>

<div class="actions-holder">
    <?php
    // render primary actions at first
    foreach ($actionGroups['primary'] as $action) {
        if (!isset($links[$action])) {
            continue;
        }
        $config = $links[$action];
        $config['options']['class'] = ['btn btn-default'];

        echo $this->element('action-button', ['config' => $config]);
    }
    unset($actionGroups['primary']);

    // render grouped actions
    echo $this->element('action-groups', ['groups' => $actionGroups, 'links' => $links]);
    ?>
</div>
<commit_msg>Fixed broken DELETE action button<commit_after><?php
$links = [];
foreach ($actions as $name => $config) {
    $config += ['method' => 'GET'];

    if ((empty($config['url']['controller']) || $this->request->controller === $config['url']['controller']) &&
        (!empty($config['url']['action']) && $this->request->action === $config['url']['action'])
    ) {
        continue;
    }

    $linkOptions = [];
    if (isset($config['options'])) {
        $linkOptions = $config['options'];
    }

    if ($config['method'] === 'DELETE') {
        $linkOptions += [
            'block' => 'action_link_forms',
            'confirm' => __d('crud', 'Are you sure you want to delete record #{0}?', [$singularVar->{$primaryKey}])
        ];
    }

    if ($config['method'] !== 'GET') {
        $linkOptions += [
            'method' => $config['method']
        ];
    }

    if (!empty($config['callback'])) {
        $callback = $config['callback'];
        unset($config['callback']);
        $config['options'] = $linkOptions;
        $links[$name] = $callback($config, !empty($singularVar) ? $singularVar : null, $this);
        continue;
    }

    $url = $config['url'];
    if (!empty($singularVar)) {
        $url[] = $singularVar->{$primaryKey};
    }

    $links[$name] = [
        'title' => $config['title'],
        'url' => $url,
        'options' => $linkOptions,
        'method' => $config['method']
    ];
}
?>

<div class="actions-holder">
    <?php
    // render primary actions at first
    foreach ($actionGroups['primary'] as $action) {
        if (!isset($links[$action])) {
            continue;
        }
        $config = $links[$action];
        $config['options']['class'] = ['btn btn-default'];

        if ($config['method'] !== 'GET') {
            echo $this->Form->postLink(
                $config['title'],
                $config['url'],
                $config['options']
            );
            continue;
        }

        echo $this->element('action-button', ['config' => $config]);
    }
    unset($actionGroups['primary']);

    // render grouped actions
    echo $this->element('action-groups', ['groups' => $actionGroups, 'links' => $links]);
    ?>
</div>

{'fraction_non_alphanumeric': 0.22102115915363385, 'fraction_numerical': 0.00045998160073597056, 'mean_word_length': 2.4217151848937846, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1763218', 'n_tokens_mistral': 1293, 'n_tokens_neox': 1258, 'n_words': 244}