rainlab/builder-plugin

identifierValue in plugins\rainlab\builder\components\RecordDetails.php

Closed this issue · 2 comments

Hello!

I am currently trying your components for list and detailpages.
It accured that the $identifierValue in RecordDetails.php is not returning the value in the url but instead the key name.
I followed this tutorial (https://octobercms.com/support/article/ob-12) but the value of $identifierValue is always just the key name and this results in record not found from this method.

    protected function loadRecord()
    {
       /**
        * just testing code
        * print_r($this->identifierValue); // just for testing what value is present here and it prints "slug" instead of the value from the url
        * die();
        */
        if (!strlen($this->identifierValue)) {
            return;
        }

        $modelClassName = $this->property('modelClass');
        if (!strlen($modelClassName) || !class_exists($modelClassName)) {
            throw new SystemException('Invalid model class name');
        }

        $model = new $modelClassName();
        return $model->where($this->modelKeyColumn, '=', $this->identifierValue)->first();
    }

If you need more to replicate the issue, pls let me know

@schillerenrico please post the configuration of the component from the page / layout where you have included the component.

I just found my mistake. The configuration was a good hint. I messed up the identifierValue by using a fixed value... Now its working 👍🏻
image