.. index:: Templates; Item and list partials .. _templates-item-and-list-partials: ====================== Item and list partials ====================== The profile item and the profile list are built from small partials. An integrator changes one aspect of them by putting one file of a few lines into the configured partial root path, instead of copying a whole template and maintaining it against every later correction. The entry points stay :file:`Profile/Item.html`, :file:`Profile/List/ItemList.html`, :file:`Profile/List/Pagination.html` and :file:`Profile/List/AlphabetPagination.html`. The first two delegate to the partials below, with unchanged arguments. The page navigation is a leaf that gained a class and the argument `activeListArguments`. The letter navigation gained both as well, and `alphabetFilterLetters` next to them; a project copy of either keeps working and renders the links it rendered before - see :ref:`the letter navigation ` and :ref:`what the navigation links carry ` below. An existing copy of the item or the list body keeps working - and stops profiting from the partials below, because a copy does not render them. .. _templates-item-partials: The item ======== :file:`Partials/Profile/Item.html` is rendered by the list, list-and-detail, card, selected-profiles and selected-contracts elements, and by the contacts element of `EXT:academic_contacts4pages`. It renders: .. list-table:: :header-rows: 1 * - Partial - Renders - Class * - :file:`Profile/Item/DetailLink.html` - The address of the detail view, as text - none, it renders no element * - :file:`Profile/Item/Name.html` - The academic title and the names, as text - `ace-name`, next to `ace-title` on the heading * - :file:`Profile/Item/Contracts.html` - The contract block, through :file:`Profile/Contract/Item.html` - none, the list element belongs to that partial * - :file:`Profile/Item/Image.html` - The image, through the shared partial of `EXT:academic_base` - `ace-image`, and `ace-picture` on its :html:``, both from the shared partial .. _templates-contract-selection: Which contracts an item renders ------------------------------- :file:`Profile/Contract/Item.html` renders the one contract a caller passes as `contract` - the selected contracts element and `EXT:academic_contacts4pages` do. Otherwise it renders the contracts the element's options select (see :ref:`configuration-contract-display`), through the ViewHelper :html:``. The detail view's :file:`Profile/PublicProfile/Position.html` and :file:`Profile/PublicProfile/Contact.html` use it with their block of :file:`Settings.yaml` instead: .. code-block:: html :caption: EXT:my_sitepackage/Resources/Private/Partials/Profile/Contract/Item.html

{contract.position}

{contract.position}

Keep the `contract` branch in a copy: without it, the selected contracts element and `EXT:academic_contacts4pages` would show the profile's contracts instead of the chosen one. .. code-block:: html :caption: The detail view, one block ... `settings` are the plugin settings, `detailBlock` a block of `publicProfile.details`; a passed block wins. Without either, every contract is returned. The ViewHelper also limits the page cache lifetime while a validity option applies, which is why a template should call it rather than filter :html:`{profile.contracts}` itself: a copy that loops over :html:`{profile.contracts}` keeps working, and ignores the options. .. _templates-function-type-name: The name of a function type --------------------------- :file:`Profile/Contract/FunctionTypeName.html` renders the name of a function type for a profile's gender: the female name for ``ms``, the male name for ``mr``, and the general name otherwise or where the gendered name is empty. It takes the arguments `functionType` and `gender`. The position line of the detail view renders it, and so does :file:`Profile/Contract/Field.html` for the field ``contracts.functionType`` of the fields to show. For that, :file:`Profile/Contract/Item.html` hands the profile's gender to the field partial as `gender`. A project copy of :file:`Profile/Contract/Item.html` that does not pass it shows the general name. .. _templates-item-partials-text: Two of them render text, not markup ----------------------------------- :file:`Profile/Item/Name.html` and :file:`Profile/Item/DetailLink.html` produce a **value**. The item hands it to :file:`Profile/Header.html` or :file:`Profile/SectionHeader.html`, which put it inside their heading element - and escape it there, once, on the way out. An override of either therefore renders the profile values raw: .. code-block:: html :caption: EXT:my_sitepackage/Resources/Private/Partials/Profile/Item/Name.html {profile.lastName}, {profile.firstName} Without :html:`` the value is escaped twice, and a name such as `O'Neill` reaches the browser as the markup `O'Neill`, which a visitor reads as `O'Neill`. Markup written in one of these two partials arrives as literal text for the same reason - the heading element is what the header partials own. .. warning:: These two partials render unescaped text, so they are only safe where something else escapes them: as an argument of a partial that writes them into an element, which is what :file:`Profile/Item.html` does. Never render one of them in an output position of a template - :html:`{f:render(partial: 'Profile/Item/Name', ...)}` written into markup would emit the stored profile values unescaped. Every other partial on this page renders markup and is written as any Fluid partial is. .. _templates-item-partials-detail-page: Passing the detail page ----------------------- :file:`Profile/Item/DetailLink.html` builds the address from `plugin.tx_academicpersons.detailPid`, or stays on the current page for the list-and-detail element, which shows the detail view itself. While `plugin.tx_academicpersons.detailLink` is `none`, it renders nothing for every other element and the name is shown as text, see :ref:`configuration-detail-link`. An override of the partial follows that setting only when it checks it as well. A template that renders an item without those plugin settings passes the page instead. A passed page wins over both branches, the list-and-detail one included, and links whatever `plugin.tx_academicpersons.detailLink` says: .. code-block:: html .. _templates-list-partials: The list ======== :file:`Partials/Profile/List/ItemList.html` renders: .. list-table:: :header-rows: 1 * - Partial - Renders - Class * - :file:`Profile/List/ResultCount.html` - Nothing - none, it renders no element * - :file:`Profile/List/GroupHeader.html` - The heading above one group of a grouped list - `ace-group-header`, next to `ace-title` on the heading * - :file:`Profile/ViewMode/.html` - The profiles, in the :ref:`view mode ` of the element - once per group of a grouped list - depends on the mode * - :file:`Profile/List/Pagination.html` - The page navigation - `ace-pagination`, on the :html:`