Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add attribute on generated <script> tag #20087

Closed
shinedira opened this issue Dec 22, 2023 · 3 comments
Closed

add attribute on generated <script> tag #20087

shinedira opened this issue Dec 22, 2023 · 3 comments

Comments

@shinedira
Copy link

shinedira commented Dec 22, 2023

What steps will reproduce the problem?

<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>

    <?= $form->field($model, 'date_posted')->widget(DatePicker::classname()) ?>

    <div class="form-group">
        <?= Html::submitButton('Save') ?>
    </div>

<?php ActiveForm::end(); ?>

and it generated <script> tag for initiation of the widget component

What is the expected result?

but what I want is to add an attribute on the generated <script> tag,
for example <script attribute="here-the-new-attribute">

Additional info

Q A
Yii version 2.0.37
PHP version 7.3.20
Operating system Windows 11
@shinedira shinedira changed the title add attribute on generated tag add attribute on generated <script> tag Dec 22, 2023
@samdark
Copy link
Member

samdark commented Dec 22, 2023

What's your use-case?

@shinedira
Copy link
Author

need an attribute to tag script for content security policy (csp)
<script nonce="key">

What's your use-case?

@skepticspriggan
Copy link
Contributor

I have the same problem while integrating CSP. I am working on a pull request to address this.

skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 23, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 23, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 23, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 25, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 25, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Mar 25, 2024
skepticspriggan added a commit to skepticspriggan/yii2 that referenced this issue Apr 3, 2024
@samdark samdark closed this as completed in bf3ada1 Apr 3, 2024
@samdark samdark added this to the 2.0.50 milestone Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants