Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -99,6 +99,16 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
* @brief [Node] Description suffix. If specified, will look for a language key with "{$titleLangPrefix}_{$id}_{$descriptionLangSuffix}" as the key
|
||||
*/
|
||||
public static $descriptionLangSuffix = '_desc';
|
||||
|
||||
/**
|
||||
* @breif Used by the dataLayer, overwritten by \IPS\cms\Application
|
||||
*/
|
||||
public static $contentArea = 'pages_database';
|
||||
|
||||
/**
|
||||
* @breif Used by the dataLayer, overwritten by \IPS\cms\Application
|
||||
*/
|
||||
public static $containerType = 'pages_database_category';
|
||||
|
||||
/**
|
||||
* @brief [Node] ACP Restrictions
|
||||
@@ -1155,18 +1165,26 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
protected function get__title()
|
||||
{
|
||||
/* If the DB is in a page, and we're not using categories, then return the page title, not the category title for continuity */
|
||||
if ( ! \IPS\cms\Databases::load( $this->database_id )->use_categories )
|
||||
$database = \IPS\cms\Databases::load( $this->database_id );
|
||||
if ( ! $database->use_categories )
|
||||
{
|
||||
if ( ! $this->_catTitle )
|
||||
{
|
||||
try
|
||||
if ( $database->use_as_page_title )
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::loadByDatabaseId( $this->database_id );
|
||||
$this->_catTitle = $page->_title;
|
||||
$this->_catTitle = $database->_title;
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
else
|
||||
{
|
||||
$this->_catTitle = parent::get__title();
|
||||
try
|
||||
{
|
||||
$page = \IPS\cms\Pages\Page::loadByDatabaseId( $this->database_id );
|
||||
$this->_catTitle = $page->_title;
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$this->_catTitle = parent::get__title();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1606,11 +1624,12 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
|
||||
foreach( $this->children() as $child )
|
||||
{
|
||||
$childLastPost = $child->lastPost();
|
||||
|
||||
if( !$result OR $childLastPost['date'] > $result['date'] )
|
||||
if ( $childLastPost = $child->lastPost() )
|
||||
{
|
||||
$result = $childLastPost;
|
||||
if ( !$result or $childLastPost['date'] > $result['date'] )
|
||||
{
|
||||
$result = $childLastPost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1854,4 +1873,32 @@ class _Categories extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
return $node->database_id == static::$customDatabaseId;
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the properties that can be added to the datalayer for this key
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDataLayerProperties()
|
||||
{
|
||||
if ( empty( $this->_dataLayerProperties ) )
|
||||
{
|
||||
$db = $this->database();
|
||||
|
||||
if ( $db->use_categories )
|
||||
{
|
||||
$properties = parent::getDataLayerProperties();
|
||||
$properties['content_area'] = static::$contentArea;
|
||||
$properties['container_type'] = static::$containerType;
|
||||
}
|
||||
else
|
||||
{
|
||||
$properties = $db->getDataLayerProperties();
|
||||
}
|
||||
|
||||
$this->_dataLayerProperties = $properties;
|
||||
}
|
||||
|
||||
return $this->_dataLayerProperties;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user