Roles and Permission creation programatically inside module

Roles and Permission creation programatically inside module

I am trying to create drupal 8 roles and permissions programatically. My current approach is to have a module that when install it will generate those set of roles and permissions defined by the module. It would be more like a background Module, where no form is... read more
Roles and Permission creation programatically inside module

How do I migrate from the Taxonomy Access Control module to the Group module?

We have a Drupal 6 site, and we are making use of the Taxonomy Access Control module for access control. We evaluated the migration steps, and even if that module could be ported to Drupal 8, we could use a different approach. We are evaluating the Group module as an... read more
Roles and Permission creation programatically inside module

Adding zip archives to the Document File Type

I have many PDF documents in my site, assigned to the Document File Type by the File Entity Module. I have added a few fields to the content type, thus allowing nice interface in showing all PDF files on the site, with nice filtering. Now I want to include Zip... read more
Roles and Permission creation programatically inside module

Alter views contextual filter field

I have two content types, Brand and Sector. Brand have a sector field which is an Entity reference field. I have views that display the list of Brands and it has a sector contextual filter which displayed as an input field where you have to input a node ID. I was... read more
Roles and Permission creation programatically inside module

Change HTML output of a view

I have a view which displays products. The fields shown are altered via hook, and I want to add <div> and <h3>, when I find an appropriate field value. (I tried with adding style to the field in the UI, but the logic is somehow convoluted, so I would need... read more
Roles and Permission creation programatically inside module

How to set and use direct files folder path in a multisite installation

Drupal 8 multisite install where First site is on a subdomain one.example.com Second site is in a subfolder one.example.com/two How can files folder for both sites to be accessible via URL/files and not URL/sites/domain/files current:... read more
Roles and Permission creation programatically inside module

How to access an entity loaded out of the cache

I am working on a Drupal 8 modules which should push a http response header based on a value stored in an entity or a list of entities. The module was originally done for D7 and now is in porting up to D8. The main problem is that by using the Entity Cache in D8 any... read more
Roles and Permission creation programatically inside module

How can I show/hide a block on specific taxonomy URLs depending on term depth?

I need to show blocks on different url’s. Block1 Should be displayed on: branches/taxonomytermlevel1 But not on branches/taxonomytermlevel1/taxonomytermlevel2 Block2 Should be displayed on branches/taxonomytermlevel1/taxonomytermlevel2 But not on... read more
Error message "responsive-utilities.less" not found

Error message "responsive-utilities.less" not found

I did set-up the sub-theme with less for the Bootstrap theme. Following is the file structure, Installed less using(Instruction followed from here), $ npm install -g less Then ran a following code to activate less, $ lessc styles.less styles.css Then following error... read more
Roles and Permission creation programatically inside module

How do I throw values calculated back to buildForm()?

I am trying to throw back values that are calculated in submitForm() to buildForm(). How do I add more state values into it? /**  * @file  * Contains DrupalresumeFormResumeForm.  */ namespace DrupalresumeForm; use DrupalCoreFormFormBase; use... read more
Roles and Permission creation programatically inside module

Scheduler Module unpublish content

Trying to schedule a content type to be unpublished on a specific date. Using the scheduler module everything is set up seemingly correct. When I run Cron the update fails, Updater Content – Publishing status complete. Results: No updates were performed. 1... read more
Roles and Permission creation programatically inside module

How to send email to submitter in a webform?

I have a webform and i want to send by mail this webform to submitter. For the moment, i created an hidden field with token [current-user:mail] and i chose this field in adress. I think it isn’t very well. Can I do it in hook_form_alter ? if yes, how to do... read more
Roles and Permission creation programatically inside module

custom module to create multiple forms with pop-ups

I am working on a custom module to create a form. Functionality of the module is as follows: The first form has an url, on clicking the url it should show another form as a pop-up. How can i call these forms in the hook menu. Does tools_js has any significance?... read more
Roles and Permission creation programatically inside module

Allow HTML style attribute for filtred HTML

I’m using the Wysiwyg module with CKEditor 3.6.6.2.7696. The HTML attributes is disallowed in HTML text format, so I can’t use font-size and text-align. Any solution please? read more
Roles and Permission creation programatically inside module

Modify custom module’s setting.yml without reinstalling

I have made a simple custom module in Drupal 8, in which I use a settings file (config/install/my_module.settings.yml) I have one entry, let’s say module: key: ‘qsdqsd’ So when I install the module, I can use this entry in my controllers. But if I... read more
Roles and Permission creation programatically inside module

Update a field without changing the node

I need to change a field in a node without altering the ‘changed’ timestamp. I know this was possible in Drupal 7 using field_attach_update(), but that has been removed since then. I could use an update query and change the field directly in the database,... read more
Roles and Permission creation programatically inside module

How to drupal_add_js an external and defer script

I’ve spent quite some time on drupal_add_js and didn’t manage to solve this. How can I load an external JavaScript script which will also have the defer attribute? I want to use this type of syntax:... read more
Roles and Permission creation programatically inside module

How to remove undesired local task tabs

I have a node type ‘faq’. For node type ‘faq’ I need to remove the tab ‘node clone’. For that I have done the following codes. In node_clone.routing.yml I have the following code node_clone.prepopulate_node: path:... read more
Roles and Permission creation programatically inside module

Custom Field is disabled

I have created a D8 module for creating a custom field. I have done it following the given links. https://www.drupal.org/node/2052601 https://www.drupal.org/node/2620968 https://www.drupal.org/node/2620966 I have created an module.info.yml file . Then created a three... read more
Roles and Permission creation programatically inside module

Render block via twig template

I have programmatically created a block. In my module folder I added all suggested templates in a templates folder(mymodule/templates/suggestedtemplatename.html.twig). However the block is not using any of them! I have enabled the theme debugger which gives me all the... read more