Skip to content

Suggestion about DataTablesHelper.php and add block name to table function #84

Description

@wash34000

Hello,

Do you thinks that it will possible to add a params to table function (file DataTablesHelper.php) to select the block name where the code will be appear in the layout ?

    public function table(string $id = 'datatable', array $dtOptions = [], array $htmlOptions = [], string $blocName = '') : string
    {
        $htmlOptions = array_merge($htmlOptions,  [
            'id' => $id,
            'class' => 'dataTable ' . ($htmlOptions['class'] ?? ''),
        ]);
        $table = $this->Html->tag('table', '', $htmlOptions);

        $code = $this->draw("#{$id}", $dtOptions);

        if ($blockName != '') {
           return $table.$this->Html->scriptBlock($code, ['block' => $blockName]);
        } else {
           return $table.$this->Html->scriptBlock($code);
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions