I have to set up a TypoScript-configuration for a header image with the following requirements:
The editor should be able to define a header image for a page using the "edit page-properties->resources->media" dialogue. If a page doesn`t have a header image, the parent pages should be scanned for header images and the first header image found on the way up to the page-tree root should be used.
Editors should also be able to add content elements to a certain "Page Header" section. This content elements can either be slider/menus or images. If a content element of the type "image" or "text with image" is added, only the image itself and no other additional code should be rendered. The content elements added to the page-header section should have priority. So if a page contains a content element in the page-header section and also has an image in the resources->media field, the image from the media-field of that page or any other page on a higher level in the page tree will be ignored and the content element/image from the page-header section will be rendered.
Fallback: if there is no content in the page-header section and also no images can be found in the media field of the page or other pages in it`s rootline, a default image which is defined via a TypoScript constant should be rendered to prevent that the header section will be left empty.