Winter CMS resources and help articles

Simple and to the point. Optimized by the community.

Relation recordUrl open in new tab

1
by AIC BV, last modified on March 10th, 2022

If you want the recordUrl to open in a new tab you can do the following:

  1. Add this code to your Controller

    public function relationExtendViewWidget($widget, $field, $model)
    {
    $partials_path = '$/author/plugin/partials/list/';
    $widget->addViewPath($partials_path);
    }
  2. Copy modules/backend/widgets/lists/partials/_list_body_row.htm to your author/plugin/partials/list folder and modify to your taste.

  3. Make sure to add an onClick() event on the 'a' tag

    <a <?= $this->getRecordOnClick($record) ?> href="<?= $url ?>" onClick="window.open(this.href)">
    <?= $this->getColumnValue($record, $column) ?>
    </a>

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?