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
1answer
129 views

Can I invoke a template for print media?

I have a node type that is usually viewed as a web page but the client requires that occasionally it is also printed out in hard copy. There is quite a lot I can do with css and media queries for ...
3
votes
0answers
2k views

What are the correct steps to run a site as HTTPS? [closed]

There is some information on https://www.drupal.org/https-information about installing the Secure Pages module to force SSL. This gives me a redirect loop on the login pages. When I try without the ...
4
votes
1answer
12k views

How do I use a preprocess function for a node template?

I'm trying to preprocess my variable array in drupal 8, But it's not working well.I'm checked with the Bartik theme also, But getting the same error here. When I'm trying to print the variable array ...
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
2k views

Changing text-format for body field

I've installed Drupal 8 in a minimal installation; I've enabled CKeditor and created a text-format called "Full". I've also created a role named as "Administrator" and gave it all permissions ...
1
vote
0answers
68 views

How do I render a field collection on a node twice with two different field formatters?

With Display Suite, I want to render a field collection twice (or more) with different field formatters? What's the best way for this? - dynamic field (need more code for only duplicate a field...) - ...
1
vote
0answers
67 views

How to create an entity handler that accepts arguments?

I've created a module and entity using Drupal Console. It defines a canonical route like this: entity.score.canonical: path: '/admin/score/{score}' defaults: # Calls the view controller, ...
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
2answers
324 views

Where is the jquery.cycle.all.js file?

So i have install views_slideshow_cycle module, and it always shows "cycle" is not a function. after some googling, I found out I have to install jquery_cycle. In views_slideshow_cycle.libraries.yml ...
0
votes
1answer
557 views

Change teaser image size

I've noticed that the article images are sized to a width of 220px to be displayed in the teaser on the frontpage in Drupal 8. I'm wondering how to change that to 300px, for example. I created an ...
1
vote
1answer
562 views

How to debug ajax in form?

I have a form that uses ajax submit "method", the ajax submit handler returns ajax response with complete form(the form has ajax wrapper outside of itself so no issue there) and it is not working for ...
0
votes
2answers
1k views

Unable to rebuild a form in submit handler

I don't have much experience in drupal development. So for the purpose of learning, i have made a custom module and trying to implement various functionalities in drupal 8 module development. I want ...
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
65 views

Referencing Entity

Is there no current way to get a referencing entity from a view? When clicking on relationship it only shows content referenced from the field, not from the referencing entity.
9
votes
1answer
5k views

How do clean_class and clean_id work?

I am new to Drupal 8 and Twig syntax. I am not able to understand how its working filter clean_class "region|clean_class"? What is clean_class here? I have added following code in my page.html.twig ...
1
vote
1answer
175 views

Use node custom field to choose my posts background

I'm building my first Drupal 8 theme and I'd like to add the possibility to change the page background header when editing a post. I've added a custom field in my post type to provide an image to ...
1
vote
0answers
77 views

How do I access/style the field content in a block?

So I created a block view showing a Unformatted list of text and image fields. Now I would like to style the output. I can create a twig file for that block. But how can I iterate through the content?...
0
votes
1answer
1k views

Check if block is visible

I'm on Drupal 8, I'm using \Drupal::entityQuery('block') to get the list of blocks. Now I want to determine if the block is visible for: Current Page (Content Type) Current User (Role) Current ...
0
votes
1answer
3k views

Adding a new NOT NULL field to a table causes an error

When attempting to add a new column to a table within an update hook, the error Null value not allowed: 1138 Invalid use of NULL value occurred, the definition was changed to allow NULL, and the value ...
2
votes
1answer
883 views

Author Fields into a content type template

I'm trying to load some of the information from the author into a node--article.html.twig. So I can provide some information like bio, social media,etc. Similar to this... I can easily get the ...
8
votes
1answer
11k views

Get the public path directory

I want to save file programmatically in public path, and I want to know how can I get Public Directory path in Drupal 8. In Drupal 7, I would use the following code. drupal_realpath(...
2
votes
2answers
990 views

How to extends %module_x/templates/xyz.html.twig?

My module has a template which would like to extend another module's template. Is there any shortcut like we have in Symfony2? {% extends 'path_to_module_x:templates/template-x.html.twig' %}
5
votes
3answers
3k views

How do I prevent a Node from being deleted?

I want to make some checks and, under certain circumstances, prevent a node from being deleted. My module makes checks in HOOK_form_BASE_FORM_ID_alter() when the node is being created, but I cannot ...
0
votes
3answers
54 views

How do I find “where-used” / many-to-one related entities?

A field in my Content Type A references a Content Type B. I'd like to find, in each instance of Content Type B, a list of all the As that reference it at a particular point in time. [Update]: I ...
0
votes
1answer
152 views

Trigger table update when changes are made inside of baseFieldDefinitions

I have a entity that has allready been enabled and the baseFieldDefinitions have created the fields in the database. But now i want to add a single field, and the obvious solution in dev is just to ...
0
votes
1answer
584 views

Use value from buildForm() in submitForm()

My buildForm() method queries the database and returns data which is used to calculate default values for the form. How can I use these values in submitForm() without querying the database again?
0
votes
1answer
87 views

How can I detect what control caused AJAX callback?

I have a form containing a table, which displays rows from a database table, and has a couple of editable fields, which is all working fine. I now want to make one of fields trigger an AJAX callback ...
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 ...
4
votes
2answers
263 views

Why the core migrate modules won't be enough?

I've seen that Drupal 8 comes with 2 core migration modules; These are "Migrate", and "Migrate Drupal". My question: if we want to migrate SQL from a Drupal 7 site to our brand new Drupal 8 site, why ...
0
votes
2answers
507 views

How do I create a route to a raw text file

I'm working on a Drupal 8 module, and I would like to include a couple of text files, each of simulated json data, as examples. How would I include these files in my module and create a route in the ...
1
vote
0answers
143 views

Logo settings in sub-theme not working

Followed the step to create a subtheme of bootstrap theme. Now, I am not able to see new logo updated, logo is overridden by default logo of bootstrap. 1) Downloaded Bootstrap project (8.x-3.x-dev). ...
0
votes
1answer
107 views

Drupal Upgrade module: SQL table prefixes and upgrading from Drupal 7 to Drupal 8

When I ought to do an upgrade to my site from Drupal 7 to Drupal 8, and I go to localhost/site/upgrade in my D8 site, I am being asked about table prefixes in my site's SQL DB... Indeed, all the ...
1
vote
1answer
55 views

Is it possible to POST more than one article at once?

How do I POST two or more articles at once? Something like follows: { "_links":{ "type":{ "href":"http://drupal8/rest/type/node/article" } }, "title":[{"value":"Title 1"} ], "title":[{"value":"Title ...
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?
2
votes
2answers
222 views

Generating URL to taxonomy term (tag)

I am trying to insert tag url and page title in breadcrumb path. With page title everything is Ok, however I can't find any info how to get tags, or how to generate url for them. I think I am getting ...
1
vote
1answer
772 views

Loading taxonomy term custom field data

I have a vocabulary "holiday_types" with taxonomy terms "ski" and "beach". I have a custom field on these taxonomy terms "field_activityid" which relates to a legacy system. I want to load all these ...
1
vote
1answer
475 views

Installed drush 8, got Parse error [duplicate]

Got Drush 8 installed alright, but when I try to drush up my Drupal 8.0.0 site I get a Parse error: syntax error, unexpected '[' in /is/htdocs/.../.composer/vendor/drush/drush/includes/output.inc on ...
1
vote
2answers
567 views

How to automatically update entity that is created programatically?

Using Entity API, I can create entities easily like this: // SomeEntity class extends ContentEntityBase $entity = SomeEntity::create(['my_id' => 'id123']); $entity->save(); Works fine as long ...
5
votes
2answers
1k views

Using Views in Complex Pages

I would like to use Views to create content for custom content type pages. This seems to be consistent with the use of Views in the Admin pages of Drupal 8. I'm running into problems integrating ...
7
votes
1answer
138 views

Is there a good reason to prefer one method of installing over another?

Starting to play around with drupal 8. My first method of installing was installing drush8 (as mentioned in https://www.drupal.org/documentation/install/download): Get drush8: composer require ...
7
votes
1answer
2k views

Embed controls 8 #table element?

I'm using the Drupal 8 #table element to populate a table on my form, and it's working great for displaying static data. foreach ($entries = getData() as $entry) { $row = array_map('Drupal\...
3
votes
2answers
1k views

Override html.twig.html within custom module

According to this Drupal 7 answer, I'm looking for a Drupal 8 solution to simply print the page content within a custom html.twig.html. namespace Drupal\custom_module\Controller; use Drupal\Core\...
-1
votes
2answers
55 views

Twig C module not enabled causing issues with blocks?

I installed Drupal 8 on shared hosting and am having a problem in which blocks are not visible after I've placed them in a region. The blocks that came preinstalled with the themes are visible, but ...
0
votes
2answers
308 views

how can i remove the login form from the home page

I'm trying to remove the login form from the front page, but i see both frontpage and user/login page are using the same template file: page--front.html.twig. Is there a way to use two different ...
0
votes
1answer
60 views

Working on Drupal and Drush with teammates

I'm currently working on a website using Drupal 8, with 3 other members in my team. We use git as a versioning system, and we very often work at the same time on different branches. Here is the ...
0
votes
1answer
127 views

Intercept data of a field of a node Drupal 8

How can I intercept the data of a field when the user add's a node? Below is the use case: The user can input a address in a field, when the user submits the node. Drupal should make a rest request ...
1
vote
3answers
465 views

Multi-media files not showing [closed]

Uploaded multi-media files to: public_html/sites/default/files no error messages permissions: 0775 files do not appear (in Content, as do files uploaded through the media editor) Switching from ...
2
votes
0answers
551 views

View Database Connector Module not working [closed]

I am using the Views Database Connector module in drupal 8 to display the data from external database. I have also set the both database setting in setting.php, but still I am unable to see the VDC ...
0
votes
2answers
121 views

How does the events dispatcher map to map_save to a callback function?

MigrateEvents.php contains an event definition like this: /** * Name of the event fired when saving to a migration's map. * * This event allows modules to perform an action whenever the ...
2
votes
1answer
88 views

Installation fails due to clean URLs [closed]

I have a Drupal 8.0.1 installation running under Apache 3.4 from /var/www. During installation, I cannot seem to pass the requirements for clean URLs. I've read through answers I've found on Drupal....