Skip to content

Commit

Permalink
fix(embed): no longer require a plugin with file_uploading provided
Browse files Browse the repository at this point in the history
fixes #7042
  • Loading branch information
jdalsem committed Sep 6, 2019
1 parent 712ba77 commit 3925c64
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions mod/embed/languages/en.php
Expand Up @@ -2,4 +2,5 @@
return array(
'embed:embed' => 'Embed',
'embed:media' => 'Embed content',
'embed:no_support' => 'There is no embeddable content available',
);
6 changes: 1 addition & 5 deletions mod/embed/manifest.xml
Expand Up @@ -6,17 +6,13 @@
<version>3.0</version>
<category>bundled</category>
<category>enhancement</category>
<description>Allows users to easily upload and embed media into text areas. Requires a plugin for uploading files.</description>
<description>Allows users to easily upload and embed media into text areas.</description>
<website>http://www.elgg.org/</website>
<copyright>See COPYRIGHT.txt</copyright>
<license>GNU General Public License version 2</license>
<requires>
<type>elgg_release</type>
<version>3.0</version>
</requires>
<requires>
<type>plugin</type>
<name>file_uploading</name>
</requires>
<activate_on_install>true</activate_on_install>
</plugin_manifest>
14 changes: 6 additions & 8 deletions mod/embed/views/default/embed/layout.php
Expand Up @@ -8,6 +8,11 @@
$menu = elgg_view_menu('embed', $vars);

$selected = elgg_get_config('embed_tab');
if (empty($selected)) {
echo elgg_view('output/longtext', ['value' => elgg_echo('embed:no_support')]);
return;
}

if ($selected->getData('view')) {
$tab = elgg_view($selected->getData('view'), $vars);
} else {
Expand All @@ -25,11 +30,4 @@
'value' => elgg_get_page_owner_guid(),
]);

echo <<<HTML
<div class="embed-wrapper">
$title
$menu
$tab
$container_info
</div>
HTML;
echo elgg_format_element('div', ['class' => 'embed-wrapper'], $title . $menu . $tab . $container_info);
14 changes: 13 additions & 1 deletion mod/embed/views/default/navigation/menu/embed.php
Expand Up @@ -5,8 +5,20 @@
* @uses $vars['menu']['default']
*/

use Elgg\Collections\Collection;

$tabs = [];
foreach ($vars['menu']['default'] as $menu_item) {

$menu = elgg_extract('menu', $vars);
if (!$menu instanceof Collection) {
return;
}

if (empty($menu->count())) {
return;
}

foreach ($menu['default'] as $menu_item) {
$tabs[] = [
'text' => $menu_item->getText(),
'href' => 'embed/' . $menu_item->getName(),
Expand Down

0 comments on commit 3925c64

Please sign in to comment.