Skip to content

Commit

Permalink
Merge pull request #328 from humhub/fix/add-iframe-attr-to-snippet
Browse files Browse the repository at this point in the history
Fix/add iframe attr to snippet
  • Loading branch information
luke- committed May 20, 2024
2 parents 27933c5 + 1c040dc commit 151d799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

Unreleased
---------------------
- Fix #328: Missing Iframe attributes in snippet

1.10.3 (May 15, 2024)
---------------------
- Fix #321: Fix indexing of template content for search
Expand All @@ -17,7 +21,7 @@ Changelog
1.10.0 (January 6, 2024)
------------------------
- Fix: Highlight admin menu entry when "Template" page is active
- Enh: Added Twig Sandbox Extension and restricted Twig templating features by default
- Enh: Added Twig Sandbox Extension and restricted Twig templating features by default

1.9.6 (December 12, 2023)
-------------------------
Expand Down
1 change: 1 addition & 0 deletions models/CustomContentContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @property string $title
* @property string $icon
* @property string $page_content
* @property string $iframe_attrs
* @property integer $sort_order
* @property integer $admin_only
* @property integer $in_new_window
Expand Down
8 changes: 5 additions & 3 deletions widgets/views/snippet_iframe.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<?php
use humhub\libs\Html;use humhub\modules\custom_pages\widgets\SnippetContent;

use humhub\libs\Html;
use humhub\modules\custom_pages\widgets\SnippetContent;

/* @var $model \humhub\modules\custom_pages\models\CustomContentContainer */
/* @var $canEdit bool */

$iframeId = 'iframesnippet-' . $model->id;

$navigation = (!$canEdit) ? [] : [
'<a href="'.$model->getEditUrl().'"><i class="fa fa-pencil"></i>' . Yii::t('CustomPagesModule.base', 'Edit') . '</a>'
'<a href="' . $model->getEditUrl() . '"><i class="fa fa-pencil"></i>' . Yii::t('CustomPagesModule.base', 'Edit') . '</a>'
];
?>

<?=
SnippetContent::widget([
'model' => $model,
'content' => '<iframe id="' . $iframeId . '" style="border:0px;width:100%;" src="' . \yii\helpers\Html::encode($model->getPageContent()) . '"></iframe>',
'content' => '<iframe id="' . $iframeId . '" style="border:0px;width:100%;" src="' . \yii\helpers\Html::encode($model->getPageContent()) . '"' . ($model->iframe_attrs ? ' ' . $model->iframe_attrs : '') . '></iframe>',
'navigation' => $navigation
]);
?>
Expand Down

0 comments on commit 151d799

Please sign in to comment.