Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -11,13 +11,11 @@
|
||||
namespace IPS\Content;
|
||||
|
||||
use DomainException;
|
||||
use IPS\Content\Search\SearchContent;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Db;
|
||||
use IPS\Content\Search\Index;
|
||||
use IPS\Helpers\Form\Text;
|
||||
use IPS\IPS;
|
||||
|
||||
@@ -105,9 +103,7 @@ trait Taggable
|
||||
*/
|
||||
public static function definedTags(): array
|
||||
{
|
||||
$tags = array_values( Tag::getStore() );
|
||||
natcasesort( $tags );
|
||||
return $tags;
|
||||
return array_values( Tag::getStore() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,21 +140,17 @@ trait Taggable
|
||||
{
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$this->tags = array( 'tags' => array(), 'prefix' => NULL );
|
||||
$tagList = Tag::getStore();
|
||||
array_walk( $tagList, function( &$value, $key ) use ( &$tagList ) {
|
||||
$tagList[ $key ] = strtolower( $value );
|
||||
} );
|
||||
|
||||
foreach ( Db::i()->select( '*', 'core_tags', array( 'tag_meta_app=? AND tag_meta_area=? AND tag_meta_id=?', static::$application, static::$module, $this->$idColumn ), 'tag_text' ) as $tag )
|
||||
{
|
||||
$tagText = Settings::i()->tags_force_lower ? mb_strtolower( $tag['tag_text'] ) : $tag['tag_text'];
|
||||
if ( $tag['tag_prefix'] )
|
||||
{
|
||||
$this->tags['prefix'] = $tag['tag_text'];
|
||||
$this->tags['prefix'] = $tagText;
|
||||
}
|
||||
/* Sanity check in case the tag is pending deletion */
|
||||
elseif( in_array( strtolower( $tag['tag_text'] ), $tagList ) )
|
||||
else
|
||||
{
|
||||
$this->tags['tags'][] = $tag['tag_text'];
|
||||
$this->tags['tags'][] = $tagText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,31 +296,15 @@ trait Taggable
|
||||
*/
|
||||
public static function tagsFormField( ?Item $item, Model|string|null $container = null, bool $minimized = FALSE ): Text|NULL
|
||||
{
|
||||
/* Include existing tags in case we're editing */
|
||||
if ( $item )
|
||||
{
|
||||
$source = $item->prefix() ? array_merge( array( 'prefix' => $item->prefix() ), $item->tags() ) : $item->tags();
|
||||
}
|
||||
else
|
||||
{
|
||||
$source = array();
|
||||
}
|
||||
|
||||
/* And get the defined tags */
|
||||
if( static::definedTags() )
|
||||
{
|
||||
$source = array_unique( array_merge( $source, static::definedTags() ) );
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'autocomplete' => array(
|
||||
'unique' => TRUE,
|
||||
'source' => $source,
|
||||
'source' => static::definedTags(),
|
||||
'resultItemTemplate' => 'core.autocomplete.tagsResultItem',
|
||||
'freeChoice' => false,
|
||||
'minimized' => $minimized,
|
||||
'addTokenText' => Member::loggedIn()->language()->get( 'tags_optional' ),
|
||||
'alphabetical' => true
|
||||
'alphabetical' => false
|
||||
) );
|
||||
|
||||
if ( Settings::i()->tags_force_lower )
|
||||
|
||||
Reference in new issue
Block a user