I created custom module in Drupal 8. This module should create tab in admin/content. But unfortunately tab does not display in admin/content section. While I can able to access my module. Link to access my module 'localhost/demo/admin/content/book'
Here is my code:-
book.routing.yml
# book.routing.yml snippet
book.admin:
path: '/admin/content/book'
defaults:
_form: '\Drupal\book\Form\bookForm'
_title: 'BOOKS'
requirements:
_permission: 'book access'
book.links.menu.yml
# book.links.menu.yml snippet
book.admin:
route_name: book.admin
title: BOOKS
base_route: system.admin_content
For more information attaching screenshot, where I want tab
Expecting this one
you should rename the file to
book.links.task.yml
because what you want is a "task" of the content instead of a real menu link. Here's a great explanation and guide how to create custom modules:
http://www.sitepoint.com/build-drupal-8-module-routing-controllers-menu-links/
Note that some of his file namings are outdated (e.g. "menu_links"), but the general idea/structure of a module is still well explained.
Related
I migrate from odoo 13 to odoo 14, but when I import all this; My website has an error like :
load could not load template
ValueError: The element '<xpath expr="//*[hasclass('o_footer_copyright_name')]">' could not be located in the parent view
View name: Footer Language Selector
Error context:
view: ir.ui.view(3822,)
view.parent: ir.ui.view(2094,)
Template: 1816
Path: /t/t
An error occurred while rendering template 1816
I didn't edited this view btw.
If anyone has a solution I'm interested!
Thanks by advance !
I experienced the same issue while upgrading from Odoo Enterprise 13 to 14.
Note the following points:
The Release Notes (https://www.odoo.com/odoo-14-release-notes) state:
"Add the language selector in the header and customize the layout."
There is a new view added called 'Footer Language Selector' (Key:
portal.footer_language_selector). This appears to be added while
running the Odoo DB upgrade 13 > 14.
The 'Footer Language Selector' view is not created when setting up a new
Odoo 14 database!
To resolve your issue, you need to disable the 'Footer Language Selector' view. This can be done in one of two ways:
If you are logged in to your Odoo instance, enable Developer Mode, and go to Settings > Technical > User Interface > Views and search for 'Footer Language Selector'. Select the view, and then select the menu option to 'Archive'
If you are not logged in/not able to log in, you need to disable the view in the database directly. Here is the command that will disable the view: UPDATE public.ir_ui_view SET active = false WHERE id = 3822; NOTE: the 'id = 3822' value must match the view number in the error: ir.ui.view(3822,)
I hope this helps you resolve the issue which appears to be a bug introduced by the Odoo DB update tool.
How can we add custom classes to wagtail dashboard buttons like 'View Live', 'Edit' Buttons for contents created. When I browse through the core files I noticed core wagtail hooks for admin page like below (I know we are not supposed to edit the core files)
if page.live and page.url:
yield PageListingButton(
_('View live'),
page.url,
attrs={'target': "_blank", 'rel': 'noopener noreferrer', 'title': _("View live version of '{title}'").format(title=page.get_admin_display_title())},
priority=30
)
If I add 'class':'custom-class' to attrs value then the default class disappears and custom-class appears
What is the right way to do this
Edit (On further investigation)
Using wagtail hooks
I created a new wagtail app to register the hook so that I was able to register the button without altering the core files, but now I have two buttons(Duplicate), but I was expecting to edit the existing button's class attrs values
from wagtail.core import hooks
from wagtail.admin import widgets as wagtailadmin_widgets
from wagtail.admin.widgets import Button, ButtonWithDropdownFromHook, PageListingButton
#hooks.register('register_page_listing_buttons')
def page_listing_buttons(page, page_perms, is_parent=False):
if page.live and page.url:
yield PageListingButton(
('View live'),
page.url,
attrs={'target': "_blank", 'rel': 'noopener noreferrer', 'title': ("View live version of '{title}'").format(title=page.get_admin_display_title())},
priority=30
)
This portion of the documentation should address your need.
In Drupal 7, it was possible with hook_navbar() but now in Drupal 8 I am not sure anymore how to do it. Do you have maybe some exampl?
You need a local tasks menu link yml file, see example in node module
For this you need to create a route in the module.routing.yml file
route_name:
path: 'admin/config/people/ban/settings'
defaults:
_form: '\Drupal\modulename\Form\FormController'
-title: Form Title
requirements:
_permission: 'your permission string'
then you need to create another yml file with the name mymodule.links.menu.yml
add the following code
form_config_link:
title: Configure Form Title
description: 'Configuration Form description'
parent: system.admin_config_people
route_name: route_name //defined above
You need to check system module yml file for parent name
I use DjangoCMS (3.2.3) on Django 1.8.12 along with djangocms-blog (0.7). I would like to link blog-posts
in other posts
on other DjangoCMS pages
The app-hooked blog page is available with CMS' Link plugin. However, I do not see how I could link individual posts.
The only and in my eyes dirty workaround I have found is using the app-hooks URL and hard-coding the post's slug directly behind it. It only works if the post URLs are in "slug-only" mode, i.e. w/o categories etc.
Thanks for any thoughts!
Currently there is no generic way to link objects handled by apphooks in the same way as django CMS pages. Providing a solution in a specific application is not trivial, as you basically needs a custom widget to do this
I just came across djangocms-styledlink. Despite the styling capability this link package allows to configure links to other apps, too. For djangocms-blog I added following lines to the setup:
DJANGOCMS_STYLEDLINK_MODELS = [
{
'type': _('CMS Pages'),
'class_path': 'cms.models.Page',
'manager_method': 'public',
'filter': { 'publisher_is_draft': False },
},
{
'type': _('Blog pages'),
'class_path': 'djangocms_blog.models.Post',
'filter': { 'publish': True },
}
]
It seems that currently djangocms-styledlink only works with python 2.
I am working on a custom markup formatter for Django and I wanted to interface it with MarkItUp.
It is successfully being called when I save the field, which is of type MarkupField, but when I try to preview this field from the Admin interface using the default settings, all I get back in the preview box is plaintext.
I am using the MarkItUp version from here: http://bitbucket.org/carljm/django-markitup/src
Here are my settings:
MARKITUP_FILTER = ('util.wookie.formatter.wookie', {})
JQUERY_URL = 'js/lib/jquery.js'
In urls, I have the following line:
(r'^markitup/', include('markitup.urls')),
Any ideas?
Is something serving the assets from both the MARKITUP_MEDIA_URL the JQUERY_URL locations?