Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow translations to work better when widget is extended (new widget property sourcePath) #119

Closed
kartik-v opened this issue May 31, 2022 · 0 comments

Comments

@kartik-v
Copy link
Owner

kartik-v commented May 31, 2022

New property sourcePath added to WidgetTrait and used in Widget and InputWidget.

    /**
     * @var string directory path to the original widget source. If not set, will default to the working directory for
     * the current widget's class. Setting this property can be useful in specific cases, like when you are extending
     * the Krajee widget with your own custom namespaced class. In that case, set this property to the original Krajee
     * Widget Base path. Yii path alias parsing is supported (using `@` symbols). For example:
     * ~~~
     * // your custom extended widget
     * namespace myapp\widgets;
     * class MyDateRangePicker extends kartik\daterange\DateRangePicker {
     *     // directly set the property to the original Krajee base widget directory
     *     // you can use Yii path aliases
     *     public $sourcePath = '@vendor/kartik-v/yii2-date-range/src';
     * }
     *
     * // Alternatively you can also override this property while rendering the widget
     * // view.php: where widget is rendered
     * use myapp\widgets\MyDateRangePicker;
     *
     * echo MyDateRangePicker::widget([
     *     'name' => 'custom',
     *     'sourcePath' => '@vendor/kartik-v/yii2-date-range/src'
     * ]);
     * ~~~
     */
    public $sourcePath;
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant