Questions tagged [8]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
0
votes
2answers
276 views

How do I add a region to the Color module?

I have a menu I would like to be able to style with the Color module. I have found many examples for the Drupal 7 Color module and they have led me to believe that if I just add a line to the 'fields'...
0
votes
0answers
248 views

Is it possible to create an action with derivatives?

Is it possible to create an action in Drupal 8 and point it at a deriver class to generate them automatically? For example with Custom Publishing Options I have a ConfigurableActionBase action that ...
0
votes
1answer
136 views

Public URLs have web/ prefix while admins do not, how to remove 'web' prefix?

I've setup Drupal 8 using https://www.lullabot.com/articles/goodbye-drush-make-hello-composer, but when I visit the site, all the links begin with web/ which means they break. If I remove web/ then ...
0
votes
1answer
71 views

Get menu tail arguments of node route

I saw in this post that D8 does not support the passing of extra menu arguments. Several posts on DA gives workable solutions, but they don't fit this use case. The contrib module I am porting ...
0
votes
0answers
43 views

how to get current bloc config from hook_theme in drupal 8?

i have created a plugin block and call the hook theme on build() $output[] = [ '#theme' => 'amu_news' ]; from this hook_theme function amu_news_theme($existing, $type, $theme, $path) { i would ...
0
votes
0answers
452 views

feed drupal 8 custom block with json decode content

i have created a block and try to feed it with WS request function amu_news_preprocess_block(&$variables) { if ($variables['elements']['#configuration']['id'] == 'amu_news_block') { $...
0
votes
1answer
226 views

How to create static breadcrumb

I've created a breadcumb using this and I've created one. But I would like to create breadcrumb for each page. I've 3 forms, above the form I need to set the progress of the form in the form of ...
0
votes
1answer
731 views

How to Implement Modal AJAX Form Pagination

With the new Drupal8 Modal API I've been able to get a pretty powerful form going. The form essentially does a POST to an API and displays some search results, which the user can filter. I want to ...
0
votes
1answer
53 views

How can I make sidebar_first narrower?

I try to make the sidebar_first narrower in a Bootstrap 3 theme in Drupal 8. There is no numbered class like col-sm-4 here that I could change and thus ask the devs. What is the right approach to take?...
0
votes
0answers
312 views

Print diferent site logo depending on the language

I have two logo. One logo for ENG and one logo for another language. How to print diferent logo on page depending on the language? Does I need to put some if function who would checks language or ...
0
votes
1answer
54 views

Description of entity type properties

Description of entity type properties in code is very poor and I cannot find alternative resources. Could anyone explain those properties? For example: "data_table" is described as: The name of ...
0
votes
1answer
923 views

How to programmatically create entity with certain language applied to fields?

I am programmatically creating some content during profile installation and since Drupal uses "en" langcode during this period I am getting the language from config and it is working fine. The issue ...
0
votes
0answers
75 views

Should I check in sites/default/files?

I installed a fresh D8 and was going for the usual setup of sending code and config to repo, and db sync (from a backup dump or sync from remote). Now when I reproduce the site given the code, config, ...
0
votes
1answer
688 views

“Page not found” on custom module

I did a custom module, but i can't see the page with the URL : Page not found. I can install the module and activiate, but i can't go on the page. This is the code : hello_world.hello_world: ...
0
votes
0answers
445 views

How do I add inline-css during hook_css_alter()?

I have a use-case where I need to dynamically attach inline-CSS (and JS) at runtime. In hook_css_alter() I cannot see how to attach it and I keep ending up with: Exception: Invalid CSS asset type. ...
0
votes
1answer
591 views

Getting a menu delivered via REST

I am trying to get a menu via REST and I've created a new module and rest resource plugin that allows for GET on /entity/restmenu/{menu_name}. I can successfully return this example json using this ...
0
votes
1answer
216 views

Site shows themeless and blockless front page

I've installed a brand new Drupal 8 site (http://www.edcint.co.nz/tmp/drupal8_problem_new.PNG) with next to no configuration, default theme etc. I then ran Drupal Update against a Drupal 7 site (http:/...
0
votes
1answer
38 views

When I am logged-in the page doesn't look the same as when I am logged-off

Do I need to include something in the code or in settings. I have a problem which is that pages don't look the same when I am login or not. Like on photo down. Some help or suggestion? This is my ...
0
votes
1answer
83 views

Crypt::hmacBase64() versus CsrfTokenGenerator::get() and CsrfTokenGenerator::validate()

In a module I am writing, I need to add a hidden field in the registration form, similarly to what the Honeypot module does. $form['honeypot_time'] = [ '#type' => 'hidden', '#title' => t('...
0
votes
0answers
310 views

Views/Twig/token error when trying to enter a custom URL

I'm creating a view that shows a list of "articles" with a contextual filter, "organization", to be shown as a block in the organization detail page. I configured the filter so that it grabs the ...
0
votes
1answer
407 views

Request::create is not working in EventSubscriber service class

Drupal 8 doesn't allows changing the current page in hook_init as we could do it in drupal 7 using following way : $_GET['q'] = '/my-url'; But according to documentation we can do it using following ...
0
votes
1answer
59 views

How do I change the image style for avatars displayed in comments

I'd like to use a custom image style for the comment avatars, but I don't know where the setting in Drupal is to change it. I thought if I changed the user image style at admin/config/people/accounts/...
0
votes
0answers
312 views

How to determine form id match in form alter?

In Drupal 8, I want to alter taxonomy vocab and term add/edit forms. Vocab is easy enough, but the form id for term forms seems to have this pattern: taxonomy_term_(vocab name)_form What can I ...
0
votes
2answers
463 views

Drupal 8 serialize selected fields using Serialization

I have a requirement in a project having 350 fields. But when I use views facing a lot performance issues. So in place of reading all the data from individual tables can I use serialization as ...
0
votes
1answer
453 views

/admin/* pages “The website encountered an unexpected error”

After two clean installs of Drupal 8.0.2 without issues on my server (Debian 7.1 / PHP 5.6.17 / MySQL 5.5.31) I can log in and out fine and view my user profile page, but that's it. Any /admin/* ...
0
votes
0answers
273 views

Reuse Block's visibility settings mechanism for custom entity

I'm on Drupal 8. I'm writing a module where I want to have custom entity which will reuse Block's visibility mechanism. I don't want custom block type, I don't want my custom entities to appear as ...
0
votes
0answers
274 views

Inserting Font Awesome HTML into user profile fields with Twig

I have created user profile fields for Twitter, LinkedIn and GitHub that are just plain Link Fields. I would like to add the relevant Font Awesome icon HTML to each of the fields so that the icon ...
0
votes
1answer
40 views

How to display menu block but deny adding a new instance?

I have a menu which has a block provided by the system automatically. This menu has links that come from a module which defines the menu(config). This menu block can be seen(ie. the block is visible) ...
0
votes
1answer
4k views

Drupal 8 route not found

I keep having a 404 error no matter what I change on my routing file. I've created a module in modules\custom which have : An info file in modules\custom\first_module\first_module.info.yml: name: ...
0
votes
0answers
163 views

Add element to the “Add new comment” link

I'm using a Bootstrap theme and would like to add a glyphicon to the "Add new comment" link so that it comes out something like this: <a href="..."><span class="glyphicon glyphicon-comment"&...
0
votes
3answers
663 views

Looping through results of entityQuery

I have the following piece of code: public function index() { $uids = \Drupal::entityQuery('user')->execute(); $users = \Drupal::entityManager()->getStorage('user')->loadMultiple(...
0
votes
1answer
109 views

How to delete a path when uninstall a module?

this is for Drupal 8: in my hook_install function, i have following code: MenuLinkContent::create([ 'title' => 'Location', 'link' => ['uri' => 'route:locator.filters'], ...
0
votes
1answer
426 views

Reflection error on my first module development

I'm using Drupal 8.0.1. Just I'm started to develop a custom module to simply show hello world text in /first path. Here is my code. FirstController.php [It is in the path sites/all/modules/...
0
votes
1answer
237 views

How to set configuration value for drush site install?

I have set a central translations directory(sites/all/translations) for my multisite installation profile so that each site does not have to download translations that were already downloaded. I have ...
0
votes
0answers
122 views

Is it possible to bypass default 404 behaviour for ParamConverter with null values?

When upcasting route parameters drupal will automatically generate 404 page if ParamConverterInterface::convert() service returns null. Is it possible to override this behaviour and allow null values? ...
0
votes
0answers
113 views

Is there a base form for fieldable entity settings?

I've build custom entity by extending ContentEntityBase class. It's very similar to the entity from content_entitity_example. I'd like to allow users to manage fields display the same way they can do ...
0
votes
1answer
103 views

Router can't find route in LanguageNegotiation plugin route name

I'm having to write a new LanguageNegotiation plugin for an API because the language is not the first part of the URL (it's the third). But D8 refuses to recognise the route to the plugin for the ...
0
votes
1answer
996 views

tabledrag submit - $form_state missing values

I have built a draggable table using this tutorial (halfway down page is the Drupal 8 code): https://www.drupal.org/node/1876710 In the submit function I would like to look through all the rows and ...
0
votes
0answers
317 views

How to pass #cache information in field formatter to parent element?

I have a entity reference field formatter that provides #cache tags even for entities that are not displayed since I want to flush the render cache of the entity that has this field attached when the ...
0
votes
1answer
117 views

Include content on module install of a custom block

I'm using Features for creating a custom module that installs and places blocks on my site, but Features doesn't export content and in this case the block contents will be needed. I'm trying figure ...
0
votes
0answers
52 views

Custom API paths

How can I add custom path to API requests? Say mysite.com/{api}/user/login.json Is there an option to do this?
0
votes
1answer
2k views

Bootstrap sub-theme override CSS

I just set up an new Drupal 8 website. I was used to use CSS injector on Drupal 7, but since the module is not ready yet, and I thought I'd better start with subthemes, I tried to create a new ...
0
votes
2answers
880 views

“The website encountered an unexpected error. Please try again later.” error show on cache clear

My Drupal 8 site is working fine but when I am clearing the cache then my site display below errors. The website encountered an unexpected error. Please try again later. Please suggest me ...
0
votes
1answer
172 views

Changing published revision

I'm trying to published revision for a node, while saving. Currently D8 manage revisions, but the last revision is always the "published" revision. I'm using hook_entity_presave, but I can't find a ...
0
votes
1answer
473 views

Get user ID for database insert [closed]

I have a form inserting into a database in Drupal 8. I would like to insert the user id. I have the following code: $userCurrent = \Drupal::currentUser(); $uname = (int)User::load($userCurrent->id(...
0
votes
0answers
178 views

Attaching a library to the header only as needed

I'm building a new module. For some reason the jQuery only works when the jQuery library is attached to the header instead of the default footer. While building the module I was attaching the ...
0
votes
1answer
371 views

Export and Import Taxonomies and Extra Fields

I created extra field in Login Form, I Installed even Extra Module (address) and create Taxonomies Now I want to Export these configurations to another Drupal. This Drupal is the Clone of the main ...
0
votes
1answer
501 views

Error while accessing admin section

I am facing the following error while trying to access Admin section in Drupal 8 (WAMP Server). I tried to install the Update manager module and from then I am facing this error. I am unable to access ...
0
votes
1answer
857 views

Attaching a JS library to every page

I'd like to attach a javascript library to every page call. I created a directory for my module called flot_d8 I created an info file, lot_d8.info.yml. My understanding is, the libraries section ...
0
votes
1answer
1k views

How to render the 'actions' section of a form in twig template?

given a form that is built like the following: public function buildForm(array $form, FormStateInterface $form_state) { $form['#theme'] = 'mymodule_testForm'; $form['actions']['#type'] = '...