Please i need to understand the idea of wagtail root[depth=0] page. Because for me homepages must be on the root level but currently all homepages are on depth=1 level, why and what is the idea to have root level page.
I checked docs etc, but didnt find clear info of this idea.
Also why homepages[depth=1] related to site object and not root[depth=0]?
It's mostly an implementation detail to make Wagtail's internal logic simpler. For example, the Page model has copy and move methods, which take the new parent page as a parameter. Having a fixed, non-editable page at the root level means that there's always a meaningful value we can pass as the parent - if the root node wasn't there, we'd have to implement separate code paths for "move a page to a new parent" versus "move a page to the top level".
However, there's also one place where the root page is directly meaningful to the site admin: it's possible to assign permissions to that page (through the Settings -> Groups area). Since permissions propagate down the page tree, this means that the permission will apply to all pages across all sites. For example, if you want to give a (non-superuser) group the ability to create new homepages, you can do that by giving them 'add' permission on the root page.
Related
I am working on an EpiServer project and the team we are working on it with updated the code in the repository, but has not sent us an updated version of the database. As a result I am not able to load any pages, when I try to do so I get 'TypeMismatchException'. I have tried converting the page types via 'Admin -> Content Type -> Convert Page' but this does not work. Doing 'Root -> New Page' also only gives me the option to use corrupt page types.
What I'd like to do is to create a page programmatically as a child of root but when I call
PageReference parent = PageReference.RootPage;
It tells me the 'ProviderName = null' because I have no page context.
So instead of determining the root page based on the page I'm currently on, I'd like to do the opposite, I'd like to reference the site I'm currently on, and given the site I should be able to reference the root page of that site.
Does anyone know if this is possible?
I've been using wagtail-modeladmin to create custom lists of certain page types. That gives me the ability to edit those pages. But I'd also like to be able to click through somehow to the "normal" admin explorer version of those pages, and be able to view/add child pages to them.
essentially giving myself a column with the little arrows in on the right, just like in the normal wagtail admin page explorer...
OK I know it's bad form to answer your own question, but I've got this working by using a custom method on the model admin object that reverse wagtails admin urls:
class MySpecialPageModelAdmin(ModelAdmin):
def view_children(self, obj):
url = reverse('wagtailadmin_explore', args=[obj.id])
return format_html(f'View Children')
list_display = ('title', 'live', 'view_children')
but actually, I think I'm not going to end up using this, just replacing this particular modeladmin with a direct link to the right place in the explorer.
One page has been moved in the page tree structure. It was a second level child, now it is a third level child. The change has been made in the default language - English.
Before this change the page had already been translated to other languages.
After the change I noticed that the translated versions don't appear in the tree, neither in the old place nor in the new one.
In the database table Composite_Data_Types_IPageStructure seems to define child-parent relations, not depending on the language at all (all pages have the same Id in all languages, right?).
Tables Composite_Data_Types_IPage_Unpublished_<culture-code> still contain the translated pages.
However, for some reason only the default language tree shows all the pages.
How can I fix this?
That page that is the new parent of the moved page hadn't been translated yet. It seems that the CMS does not display a translated child under the not translated parent.
The steps that fixed the problem:
1. Translate the new parent page.
2. Click "Restart server".
The translated child appears in the tree after the server is reloaded (the cache is cleared).
Repeat these steps for every language.
In summary, I am looking for a content-based access control solution, NOT a user role-based solution.
The scenario: Page 1 contains content from various access control levels (i.e. levels a, b, and c).
Currently in Drupal, you can display/hide content based on user role. However, I want to block access to the entire page if the user is not in the highest content level required.
Example: A user with access level a and/or b would be blocked from seeing page 1, but a user with at least level c would be able to see the page and all of the content on it.
The catch being that the per-page access levels must be dynamic to prevent incorrect page tagging as content is added, updated, or removed.
Does a module like this exist already, and if so, what is it?
If this doesn't exist, is there a straightforward way of implementing this?
Server configuration is Drupal 7 with some Open Atrium 2 modules.
I'm not sure on what you mean on access control levels, but lets say they are functions you can call (with returns).
In this case you should implement hook_node_access for controlling access to a node or hook_field_access for controlling access to a field.
https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access/7
You should return 'NODE_ACCESS_DENY' from it if you want to deny acces.
https://api.drupal.org/api/drupal/modules%21field%21field.api.php/function/hook_field_access/7
You should return FALSE if you want to deny access to a field.
On the user page (/user/20 for example) I want to display a view with some related users. Each user has a field of type entity reference that points to a user. The users are related if they point to the same user.
I tried to do this using the Entity Views Attach module, but didn't succeed (although I think it should be possible using it).
Could someone give me some advice on how I could do this?
I would create an block (or eva) view using contextual filters with your reference field that takes the uid from the url (or node's author) as parent.
maybe this other post can help
PR