Manual sorting of sys_category - typo3

On my TYPO3 7 site, i'm not able to choose an order to the categories of a page or a news (plugin tx_news). I can only choose what categories that page or news have, using the checkboxes to select them.
Is there any configuration for that?
Alternatively, I may override these fields with my own TCA, but have no ideas on how to get a sorting tree of categories. Any hint?
On my sites running previous TYPO3 versions with tt_news plugin, its category tree allows to change the sorting after selecting the categories.
I coudn't find anything about it on the "select" documentation (https://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Select/Index.html). Looks like MM relations doesn't support sorting.
Does anyone knows how to get it?

Make sure you have the "extended view" checked at the end of the page. You can then sort the sys_category-entries using the up/down arrows.

If you need to sort your categories per item and not globally then a default MM relation will not work as it doesn't support sorting. You're on the right track. Override or extend the TCA, don't specify a MM relation and don't use the tree view rendering. Use a standard select like you would select pages. This should store the values as a comma-list string in the database and so represent the sorting like you would see it the backend.

Related

Display only local categories or tree view in TYPO3 news creation

I have a TYPO3 v7.6.18 multi-site system with tt_news plugin for news.
Each site has its own news section with different categories like:
I would like to be able to choose from these categories, when creating a news item, but in the Categories&Relations (I have hidden the Relations tab, since I don't use it), I get the whole list of categories from almost all the projects (probably all, there is just a limit on how many it shows):
How can I set it to show only the categories for current page (or least a tree view, where I can see, where the categories belong to), because currently it's impossible to tell, what category belongs to which project (since the names overlap).
You can use TCA overrides to customize the foreign_table_where configuration option of the categories field in the tx_news_domain_model_news table:
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['categories']['config']['foreign_table_where'] = ' AND sys_category.pid = ###CURRENT_PID###' . $GLOBALS['TCA']['tx_news_domain_model_news']['columns']['categories']['config']['foreign_table_where'];
Notice that you need to prepend your additional constraint because the existing constraint ends with a ORDER BY.

tx_news parent category required

The following scenario: TYPO3 7.6, news articles (tx_news) with two-tier categories. Selection category is mandatory, but editors have often only selected subcategory. 1., is there a possibility that category level 1 must also be selected? 2., someone has a tip, as I can automate also the parent category can activate afterwards?
I am not sure if it is a good idea that both categories must be checked but it highly depends on your needs. If it is because of potential requests or output in the frontend, it is enough that the child category is checked.
As a solution I would change the rendering of the categories and use a select list instead of the tree and render the parent categories with the value --div--. If the minitems setting is set to 1 as well, the user will be required to select a subcategory as parent categories are then not selectable.

List all "incoming" internal links / references to a TYPO3 element

I need to get a list of elements linking to a specific TYPO3 page or element (all IDs oder pages, that link or refer to a this element). I thought this was at the Info module, but I can't find it.
I have spent hours finding this info on the web and even in my oldschool TYPO3 manual book... nothing, but I know that I once had this list.
Thanks a lot in advance! (version is TYPO3 4.6, I am preparing an upgrade right now)
You could search your database manually to find such links. I will start to give you a list where you could search for.
Find tt_content headers which link to a page, element or any url:
SELECT * FROM tt_content WHERE header_link NOT LIKE '' AND deleted = 0;
In RTE fields, you could manually check.
Go to backend modul 'Configuration', choose '$TCA (Tabel configuration array)' and search for 'RTE'.
Then you schould get all RTE fields, which could have links set to any TYPO3 pages or elements.
Like fx: tt_content.bodytext.config.wizards.RTE...
These fields you could search for any links vis MySQL
SELECT * FROM tt_content WHERE bodytext LIKE '%<link%' OR bodytext LIKE '%<LINK%' AND deleted = 0;
Maybe someone can add more default fields not listed above.
I think you have seen the references of a record normaly seen in the list module.
If you hover your mouse over the count you get a list of origins.
That list is not always up to date and the usability of the origins differs from version to version. Sometimes you can use the origins as direct link to edit the origin record.
Maybe you had an extension which enhances the usage.
In gerneral: if records are used with TYPO3 (TCA group fields which build relations to other records with uid-lists, or mm-records) this is also stored as refrence.
As links are also relations they are not always stored as referenes, espeacially if the link is inside a textfield.

n-n relationships for multiple content types

I'm working on a project based on Laravel 5.3 and Backpack CRUD. My project has about 8 different content types (news, page, portfolio, events, team, video, gallery, jobs).
I need to be able to add tags to every content type (n-n), and every content type has its own specific tags, so tags are NOT shared between the content types.
If I want to use the select_multiple or select2_multiple field type, I would need 8 tables for the content itself, 8 pivot tables, and 8 tables for the tags(!).
Obviously I would like to have just one table for the tags, but if I use the select_multiple or select2_multiple field type, I get all tags in the edit-form of every content type.
So, my question is: Is there an elegant way to filter the results of the select_multiple or select2_multiple field type?
I have created a simple schema with two content types:
http://dbdesigner.net/designer/schema/60412
In this example I want to be able to filter the tag list on content_type_id, when I'm editing the content of news or page. So I just want to see the news tags in the news-edit form, and just the page tags, in the page-edit form.
Or maybe I should just use the select_multiple field type as intended, and accept the 8 tag tables(?)
Any help or advice would be greatly appreciated.
I think a clean way would be to:
create different models for each tag use, so NewsTag, PageTag, PortfolioTag etc. that would only extend the Tag model and use a global scope to filter the results after content_type_id;
use backpack select2_multiple fields with NewsTag, PageTag, PortfolioTag etc; anything you set on the Tag model will be used (including the table attribute, mutators, accessors, etc);
Cheers!

Customizing the Content Report Table Macro

I have been using the content report table macro, which has been working. Ideally, I only want to list content matching certain labels, and lock in an alphabetical sort order and not show the content author.
I have not been successful in figuring out a way to do this just yet.
Is there a way to just edit the source code for that macro and create a "new one"? I'm struggling to find any useful documentation out there.
Any suggestions are appreciated!
I was also interested on doing this some days ago. Unfortunately, the Content Report Table Macro only have very limited parameters which are very strict. However, the way I succeeded to display only certain properties from the pages and present them in a tabular way (in Confluence 5.8) was with the combination of the macros Page Properties and Page Properties Report, both of them linked by a unique label. I'll break it down below.
Outcome:
1. Set up of properties you want to track
Create a page.
Add the Page Properties macro (no need to specify an ID)
Within the macro just add a table with all the properties you need to keep track of, similar to this:
Important, this is what links the two macros together: Add a label to the recently created page.
2. Display properties in main page
Add Page Properties Report macro. Specify label used across all the already created pages. Also specify the space (I just love this part). In here you also add custom fields (some fields from Content Reports are here). In Options you can specify which properties to display (columns to show), also the sorting order (in my case I'm sorting by the property ID that I added to each page).
Note: if you just want to remove the content author this can even be done easier: no need to add any property, just specify the label of your pages and add the fields you need to show and sorting order.
Hope this helps.