Skip to content

Commit

Permalink
ref #106
Browse files Browse the repository at this point in the history
  • Loading branch information
shoulders committed Oct 21, 2020
1 parent 6df9f8e commit 338aee3
Showing 1 changed file with 48 additions and 26 deletions.
74 changes: 48 additions & 26 deletions admin/helpers/qwhelloworld.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,38 @@
/**
* Qwhelloworld component helper.
*
* @param string $submenu The name of the active view.
*
* @return void
*
* @since 1.6
*/
abstract class QwhelloworldHelper extends ContentHelper
{
/**
* Configure the Linkbar.
*
* @return Bool
* @param string $vName The name of the active view.
*
* @return void
*
* @since 1.6
*/

public static function addSubmenu($submenu)
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
Text::_('COM_QWHELLOWORLD_SUBMENU_PROJECTS'),
'index.php?option=com_qwhelloworld',
$submenu == 'projects'
$vName == 'projects'
);

JHtmlSidebar::addEntry(
Text::_('COM_QWHELLOWORLD_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&view=categories&extension=com_qwhelloworld',
$submenu == 'categories'
$vName == 'categories'
);

// Set some global property
$document = Factory::getDocument();
$document->addStyleDeclaration('.icon-48-qwhelloworld ' .
'{background-image: url(../media/com_qwhelloworld/images/tux-48x48.png);}');
if ($submenu == 'categories')
if ($vName == 'categories')
{
$document->setTitle(Text::_('COM_QWHELLOWORLD_ADMINISTRATION_CATEGORIES'));
}
Expand All @@ -61,19 +60,23 @@ public static function addSubmenu($submenu)
JHtmlSidebar::addEntry(
Text::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_qwhelloworld.project',
$submenu == 'fields.fields'
$vName == 'fields.fields'
);

JHtmlSidebar::addEntry(
Text::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_fields&view=groups&context=com_qwhelloworld.project',
$submenu == 'fields.groups'
$vName == 'fields.groups'
);
}
}

/**
* Get the actions
* Gets a list of the actions that can be performed.
*
* @return CMSObject
*
* @since 2.5.4
*/
public static function getActions($component = '', $section = '', $projectId = 0)
{
Expand All @@ -83,7 +86,7 @@ public static function getActions($component = '', $section = '', $projectId = 0
$assetName = 'com_qwhelloworld';
}
else {
$assetName = 'com_qwhelloworld.stream.'.(int) $projectId;
$assetName = 'com_qwhelloworld.project.'.(int) $projectId;
}

$actions = Access::getActions('com_qwhelloworld', 'component');
Expand All @@ -96,29 +99,48 @@ public static function getActions($component = '', $section = '', $projectId = 0
return $result;
}

public static function getContexts()
{
Factory::getLanguage()->load('com_qwhelloworld', JPATH_ADMINISTRATOR);

$contexts = array(
'com_qwhelloworld.project' => Text::_('COM_QWHELLOWORLD_ITEMS'),
'com_qwhelloworld.categories' => Text::_('JCATEGORY')
);

return $contexts;
}

/**
* Returns a valid section for streams. If it is not valid then null
* is returned.
*
* @param string $section The section to get the mapping for
* @param object $item optional item object
*
* @return string|null The new section
*
* @since 3.7.0
*/
public static function validateSection($section, $item)
{
if (Factory::getApplication()->isClient('site') && $section == 'form')
{
return 'project';
}

if ($section != 'project' && $section != 'form')
{
return null;
}

return $section;
}

/**
* Returns valid contexts
*
* @return array
*
* @since 3.7.0
*/
public static function getContexts()
{
Factory::getLanguage()->load('com_qwhelloworld', JPATH_ADMINISTRATOR);

$contexts = array(
'com_qwhelloworld.project' => Text::_('COM_QWHELLOWORLD_ITEMS'),
'com_qwhelloworld.categories' => Text::_('JCATEGORY')
);

return $contexts;
}
}

0 comments on commit 338aee3

Please sign in to comment.