Jump to content

Followed items that belong to a non followable Node


LaCollision

Recommended Posts

Hi there,

Small question 🙂

In the followed items section (URL /followed), we have the list of the followed items.

However, when a Content Item is followable (is subclass of \IPS\Content\Followable), this followed items section automatically display the Node the Content Item belongs to, in the left menu of the page.

This is because of the following code, in /core/modules/front/system/followed.php, line 47:

if ( isset( $class::$containerNodeClass ) )
{
	$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$containerNodeClass, 4 ) ) ) ] = $class::$containerNodeClass;
}

 

It means that if a Content Item has the property "$containerNodeClass", then it automatically displays this container node class in the left menu.

However, the container node class is not always followable.

So, I think it would be nice to check if this container node class is followable, still at line 47:

if ( isset( $class::$containerNodeClass ) && is_subclass_of( $class::$containerNodeClass, 'IPS\Content\Followable' ))
{
	$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class::$containerNodeClass, 4 ) ) ) ] = $class::$containerNodeClass;
}

 

What do you think?

 

Thank you!

Link to comment
Share on other sites

2 minutes ago, bfarber said:

I've raised your suggestion internally. At a technical level, you're right, although typically nodes are followable if the content in them is also followable, so it realistically doesn't come up much.

 

Hi,

Great, thank you! This change would be much appreciated (and it's not much to do).

You're right that in the regular Invision Suite, nodes are typically followable if the content in them is also followable. So, making the change would not impact the Suite.

 

But as we develop custom applications, our nodes are not always followable…

For instance: one of the main concerns I had developing a custom app is the fact that a Content Item must belong to a container (see this post).

And as @Adriano Faria and @Sonya* suggested to me, I had to create dummy containers for the Invision Suite to be able to work.

 

And in this case, in the followed items sections, I don't want my dummy containers to appear in its left menu.

Thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...