luyadev / luya-module-cms

The LUYA CMS module provides a full functional CMS for adding contents based on blocks.
https://luya.io
MIT License
33 stars 46 forks source link

Ensure the path to the block dir #164

Open boehsermoe opened 5 years ago

boehsermoe commented 5 years ago

In #156 we needed the base path of a block and solved it temporary with reflection class.

Here we need a better solution for it and could solved it with a getBaseBlockPath function which can used for getPreviewImageSource and bootstrap blocks.

nadar commented 5 years ago

@boehsermoe I am just checking all issues, and for now i am not sure what the problem is here? What we have to do? Can you make an example? Thanks.

boehsermoe commented 5 years ago

In getPreviewImageSource the base path of the block will be generate with reflection class. In the bootstrap blocks it is solve with a relative path.

We need a general base function for the blocks to resolve the base path of it. Something like this, but maybe a solution without reflection?

function getBasePath()
{
        $reflector = new \ReflectionClass($this);
        $dirPath = dirname($reflector->getFileName(), 2);

        return $dirPath;
}
nadar commented 5 years ago

so we could maybe also use it for getViewPaht()