mistermoper
  • Member for 7 years, 4 months
  • Last seen more than a week ago
How can I read config schema from a config entity?
Accepted answer
3 votes

Found, it can be done by using config.typed service: $typed_config_manager = \Drupal::service('config.typed'); $node_type_definition = $typed_config_manager->getDefinition('node.type.*');

View answer
Which hook to use to give a user a role after purchasing something in Commerce 2?
Accepted answer
3 votes

In Drupal 8 Commerce is using Event dispatcher instead of hooks. In this case, you should subscribe into the event named commerce_order.order.assign, the hook invoked then a order is assigned to a ...

View answer
How to show a block on specific pages using the Node ID instead of an URL?
Accepted answer
3 votes

If you just want use the node id you can use node/[id]. Example: node/1 It will works even you are using a path alias, because that route is allways avaiable for any node.

View answer
How do I grant to roles dynamically created permissions?
Accepted answer
2 votes

After granting the permissions, you should call the save() method to make the code work. if ($anonymous_role = Role::load($anonymous_rid)) { $anonymous_role->grantPermission($permission); $...

View answer
My submit function for the node form doesn't execute
Accepted answer
2 votes

In node forms the submit callbacks from #submit are not executed. Instead, there are executed submit from #submit property of submit form element. You should add the submit in this way: $form['...

View answer
When setting up the Drupal 7 database (mySql/mariadb) what database user accounts should be created?
Accepted answer
2 votes

You just need one user allowed to create, drop tables, and mysql basic operations (INSERT, SELECT, UPDATE, DELTE, ALTER, INDEX...). In drupal installation tutorial you have more info.

View answer
How can I load a javascript file into a Drupal 7 page using the Code per Node module?
2 votes

Code per node module is intented to use to have a custom JS for each node. The JS code must be placed inline, in the node add / edit form. You have this tutorial to see how it works. If you want to ...

View answer
Firefox is caching ajax form values from previous submit after if I press the browser back button
2 votes

It seems chrome makes a refresh of the page and firefox a cache. Seeing this question the reasons are answered here You can try disabling caches using http headers: https://stackoverflow.com/...

View answer
Form state redirect to node path plus fragment
2 votes

You must add 'fragment' in third argument of setRedirect method, $options (@see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormState.php/function/FormState%3A%3AsetRedirect/...

View answer
How to bulk update select list fields?
2 votes

You have multiple options: You can use code that iterates over all nodes and changes the value of the field (you will need some module to execute the code, for example devel). Other option is to use ...

View answer
Doing a post to create a node using Drupal services endpoint with Postman app
Accepted answer
1 votes

In that petition you are calling the path user.login, but in services is user/login, with a slash. Also, maybe you are not preceding the path with the base name of your api (normally is /api). So ...

View answer
Redirect when submit Feedback form
1 votes

You have to add a submit function if you dont have and set the url you want redirect in $form_state['redirect']. function my_custom_form_submit($form, &$form_state) { $form_state['redirect'] = '...

View answer
Cannot get AJAX callback values to save
Accepted answer
1 votes

That code is overriding the fields structure. That fields have a specific structure and that code is changing it completely, so in submit the values are not recognized. I recommend you use devel ...

View answer
What linux user accounts should be created prior to Drupal 7 install?
Accepted answer
1 votes

With your own user is enough. If you want know how setup permissions check securing file permissions drupal community doc. It's referenced in this related issue. In that specific case (setting up ...

View answer
Can't get Emoijone ckeditor plugin to appear on WSYISYG editor
Accepted answer
1 votes

You need to add annotation for ckeditor plugin (more info about annotations based plugins here). Youtube plugin is using this: /** * Defines the "Youtube Button" plugin. * * @CKEditorPlugin( * ...

View answer
Dompdf returns PDF on Controller function but not on Submit Form function
1 votes

By default after form submit drupal makes a redirect, if there is no redirect defined intentionally allways will go to current url. To prevent this, you need call to disableRedirect() method from ...

View answer
Set permision to create nodes of certain content type programatically
1 votes

You cant implement hook node_access in a custom module and deny access to node add page to the node/add specific path. Here you have a sample: /** * Implements hook_node_access(). */ ...

View answer
How do I use an absolute URL to set as breadcrumb link?
0 votes

Using PHP code you can build absolute urls with the url function. Example: $url = url('/category.html', ['absolute' => TRUE]);

View answer
routing.yml for a custom form not working
0 votes

You don't need the first slash in your path: path: '/srevent/listform' Change for this: path: 'srevent/listform' Clear caches after that. That can be the problem. I recommend following the form ...

View answer
How to customize validation functions for some field?
0 votes

As @ivan-jaros says, you can use entity validation constraints to add new validations to a field. In the hook he mentions you can also get the current validations and remove what you don't need. You ...

View answer
Migrate row data into text formatted long multiple
0 votes

There is a plugin named iterator which allows iterate a list of associative fields to a compound field. Example: field_formatted: plugin: iterator source: - fieldA - fieldB ...

View answer
Split commerce cart to multiple orders per product
0 votes

As you now,by default drupal add to cart form add all products to the same order. Looking at the code of commerce_cart.module, the base and unique behaviour of commerce_cart module, it doesn't works ...

View answer
How to do push data to datalayer after Ajax callback?
0 votes

I had the same problem. Events were only sent first time and then never. I solved it purging completely cache, and fixing my google tag.

View answer
Is there an easy way to prepopulate webform field default values from profile2 field values?
0 votes

In version 4.x webforms has token support and you can add fields from profile2. For example, if you have a profile called chef and a field called (field_check_age), you should use this token: [...

View answer
How do I use the login for an external application?
0 votes

You can install in your drupal site a contrib module which allow you to create an API which can access another modules. You can use Services module which implements route to allow users login across ...

View answer
Creating a page to display several content types
0 votes

You can use Panels and Views to make it. With Panels you can create a new page with the regions you need, and with Views you can create blocks which can list nodes. So you create Views of each ...

View answer
How to add custom metatags in drupal 7?
0 votes

You can also implement hook_metatag_info in a custom module, define your metatag and then you can configure it with UI. You can see this implementation from metatag module, by example http://www....

View answer