There is currently no mechanism to require existing users to use TFA; if you use "authenticated user" with "Roles required to have set up TFA", then new users cannot set up TFA and existing users without TFA will not be able to log in.

TFA doesn't provide any mechanism for this, so I wrote a module that provides Rules integration and created a basic rule that would do it.

https://www.drupal.org/project/tfa_rules

Instructions on setting up basic TFA on a site:

Download and install Two-Factor Authentication, TFA Basic Plugins, Rules and TFA Rules

drush dl tfa tfa_basic rules tfa_rules

Enable.

drush -y en tfa tfa_basic rules rules_admin tfa_rules

Configure TFA: /admin/config/people/tfa

[X] Enable TFA
Default validation plugin: TOTP
[Save configuration]

Configure permissions: /admin/people/permissions

Set up TFA for account

[X] authenticated user

[Save permissions]

Visit /admin/config/workflow/rules to configure the rule.

Testing:

Log out
Create a user
Login
User will be redirected to the security page to set up TFA.


Commerce- Show a base price (MSRP) and a discount (the real price)

Use the Commerce Price Savings Formatter module.

  This module is an extension of Drupal Commerce that provides a display
  formatter for the Commerce Price field which shows the amount of
  savings when a discount is applied.


Listing module under one custom module heading

You can print any form using drupal_get_form

drupal_get_form($form_id)

And to print a form

<?php print drupal_render(drupal_get_form($form_id)); ?>

You can find form id using hook_form_alter

Eg :

function YOURMODULENAME_form_alter(&$form, &$form_state, $form_id) {
  echo $form_id;
}

To redirect users after submission you can use drupal_redirect_form

  Redirects the user to a URL after a form has been processed.

To get all modules list you can use module_list

  Returns a list of currently active modules.


Ok for a non-programmer (my last course was literally 2 decades ago) I feel pretty good at about this one, but invite folks to provide better solutions. :-)

To solve the problem described above, I utilized a little jquery javascript via js injector (into the head section) and added the following:

!function( $ ){
$(function () {

$("div#page_key_features").appendTo("div#right_panel_overlay_content");

});
}( window.jQuery )

From there, within the block that I will add to the Mobile Menu right overlay panel, I added the following HTML:

&nbsp;

Then via CKEditor (source) within the body of the page I added the following HTML:

This content is invisible in the body content of the page, but becomes   visible within the mobile menu block called "right_overlay_panel_content". This means I can edit content using ckeditor, then add the "display:none" style to the outter div to hide in the body of the page, but display it when the user triggers the right overlay panel.  I can change the content on every page if I choose.

NOTE: I had to use nested divs. This allows me to hide the content of the right overlay panel within the body of the page, then display it when the user clicks the trigger showing the panel.

Now I can add custom, per page content to the Mobile Menu right overlay panel.

Here's the JS Fiddle for anyone who wants to use/tweak my little solution.


Search API Solr: How to index fulltext fields with and without stemming?

Good question, and also a topic that should probably be brought up as a feature request for both Apache Solr Integration and Search API Solr at some point. Searching both stemmed and unstemmed content can often lead to significantly better results.

For Search API Solr, there's no way to do this without modifying the schema.xml bundled with the module. But you're probably already aware of that since you're using stemming and the bundled schema does not have stemming enabled by default.

The key to doing this without lots copyField definitions is to use a combination of dynamicField and copyField. You'll also need two different fieldType definitions, one for unstemmed and one for stemmed text.

Try these steps:

Duplicate the entire definition for <fieldType name="text"> as
<fieldType name="stemmed_text"> and uncomment the
SnowballPorterFilterFactory filter.
Add a dynamicField definition using this new fieldType. The data
does not need to be stored, only indexed.
Example: <dynamicField name="stemmed_*" type="stemmed_text" termVectors="true" stored="false" />
Add a wildcard copyField definition that copies all text fields into
corresponding stemmed text fields.
Example: <copyField source="t_*" dest="stemmed_*" />
Reindex.
Add "qf" params to the Solr query for all stemmed fields you want to
search. You can do this via hook_search_api_solr_query_alter(). If
you want all text fields, you can look for field names prefixed with
"t_".

Bonus: Sometimes it helps to boost matches against the unstemmed field in order to make more exact results appear first. You can add boost factors to the field names in the qf param.

Bonus #2: The pf param ("phrase field") is another good way to boost exact matches. This lets you give priority to results where terms are in the same order as what the user entered.

Apache Solr Integration module:

For those using apachesolr.module, matching against both stemmed/unstemmed can be done without changing schema.xml. The bundled schema includes lots of dynamicFields and is quite flexible. By default, searchable fields are stemmed. You can simply copy content fields to unstemmed dynamicFields in hook_apachesolr_index_documents_alter() and then add "qf" params for those fields via hook_apachesolr_query_alter().


I need help grouping links under one title

I'm assuming that each of these items are nodes, that have a field referring to the group they're a part of. In your view settings, look for 'FORMAT'. I'm guessing you're using an unformatted list. If you click 'Settings' next to that you should see a 'Grouping Field Nr.1' dropdown box. There you can choose what field to group all the items by and it will automatically group your results with the group title at the top. You have to make sure that you have the group field listed in fields section first.


I figured this out. It's able to see the settings.php file but instead of the right database credentials it was showing this:

$db_url = 'mysqli://mynamedrupal:xxxxxxxxxxx@localhost/myname-drupal-6';

That's goofy! I'm not even using Drupal 6! There wasn't any updated version of this later in the file; this was the only database connection info. It makes sense that this was in here, since it was originally a D6 site that I upgraded, but it's unusual that it worked so long without an updated array of DB connection info.

So I pasted this in from another D7 install and changed the un/pw accordingly:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'myname-drupal',
      'username' => 'myname',
      'password' => 'xxxxxxxxx',
      'host' => 'server.host.com',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

I can't say for sure if this works because now I'm having different, unrelated problems. But I think this solved this particular issue, as far as I can tell, and now I'm on to troubleshooting the next thing. w00t.


Features + user permissions: what are the pros and cons of all in one versus separate?

In terms of the user experience, listing the permission along with the feature is the better option. You will need to be searching a very long list if your permissions are complex and extensive.

The even more compelling reason to keep the feature and permissions together is for exporting. If you only plan to export a particular feature, it takes a long with it dependencies from a bunch of other modules.


Setting up the ideal multiple repository Drupal Site version control with a DVCS

A general workflow when it comes to Drupal is to clone the core repository and use it as the base for your local repository. Then, you'd create a separate branch specifically for your custom site, so as not to disturb the core branches.

Next, you'd add each module you'd want to use as a submodule off of this branch: this allows you to track specific versions of modules while still having the flexibility to easily upgrade them in the future.

Then, you'd set up an exclusion plan for user-generated content and your settings file. Generally, this would include:

sites/SITENAME/files
sites/SITENAME/settings.php

Finally, when you want to upgrade third-party content:

With core, you'd pull the latest changes and rebase your custom branch
With contrib, you'd navigate to the specific module's directory, pull the latest changes, and commit the new submodule hash to your custom branch.

The problem is, this works really, really well... if you use git. As Drupal has standardized on git, it's just a matter of linking to the correct drupal.org repositories and pulling when necessary.

If you're using a different VCS, submodules aren't really going to help unless you want to spend the time to convert each and every drupal.org repo for the modules you're using to whatever VCS you want to use. That's a lot of work, especially for a one-off project.

Alternatively, you could follow the above workflow, but instead of setting up a repo for each and every contrib module, you could set up one private repository called contrib, and manually add updates to contrib there. This way, you can keep contrib code separate, but you spare yourself having to maintain potentially dozens of custom repositories that do nothing other than duplicate drupal.org repositories.


Create module with custom entity and CRUD

The main purpose of content types/entity bundles is to allow users to configure/create subtypes/bundles of your entity type and add configurable fields to them.

If you want to have two different things, just create two different entity types. Each will have its own table then and its own set of fields. Completely separated.

If you want to have a single entity type/table with different sets of additional fields, then you can for example use entity bundles and just don't expose a UI for them, buy removing all forms, routes and the field_ui_base_route. Then the only way to add per-bundle fields would be through the API/Code.

Or you implement it all yourself using bundleFieldDefinitions(), hook_entity_field_storage_info() and so on. But that would require quite a bit of code as you need to take care of installing the field storage definitions and so on.


If I understand you correctly, then I believe the solution I used for a similar task is this - http://drupal.org/node/578620#comment-2750454.

Hope it helps,
Shushu


Possible to build Relation Type between two specific Content Types?

This was a question of interpretation of what I could see. What I couldn't see was that the Relation Type had been created, and I did not know how the "relations" were populated. Watching Johann Falk's screencast another time showed me how to do this.


Superfish themable hooks not getting called

As in my image

Make sure these are checked or the theme hooks wont work, and they need to be checked even though, it says default:enabled.


It is not possible to create a select element in an ajax callback, because the form builder needs to know about it.

Move all code from ajax callback to buildFrom(). Make this code conditional on form_state.

Your callback contains only:

return $form['deployment_wrapper'];


The argument settings have not been removed; they have been renamed, and in the actual development snapshot they are called Contextual Filters.


How to anonymize IP logging by google analytics?

You can do that using the google analytics module. Enable the module and go to /admin/config/system/googleanalytics, there put your ga id in the textfield then there is a Privacy vertical tab. In that tab there is this checkbox which says Anonymize visitors IP address


How do I create a flag so each user gets to set one flag on one instance of a content type?

Here is how I eventually solved this

Create a rule that does the following actions.

Loop through a list of all content that the flagging user has flagged (with the specified flag.)
Unflag ALL of the nodes in this list
Re-flag the node that triggered the event (F\flagged-node)


Fixed! Issue #2917263 There is no way of turning off the preview message


I would take a look at the Context module with this add-on: Context Useragent


The Field Permissions is so the field shows up, they can see it, when they are editing the node.

The problem here looks to be that they don't have permission to edit the content type node.

Ex:

Allow to Edit Own Articles
Allow to Edit All Articles


How do assign a role to user after add to cart in ubercart in drupal 7?

Try to do this using Rules.

Add a new rule on event complete checkout.
Give your required conditions.
Add Assign role to user as action.

For your scenario you can do it using multiple rules.

Hope this will help you.


How to hide specific pages from users, but not the content?

You could use the Rules module to get this to work, by using the "Drupal is initializing" event. That will ensure that the rule gets triggered BEFORE the actual content is shown.

The links that you want to "intercept", should be formatted in some type of regular expression, which you then use as your Rules Condition. So that you have a rule that corresponds to "before showing the actual content of something that matches a specific path ...". After you get that part to work, your Rules Action should specify the actual redirect to be performed.

Sample rule

Refer to the "Option 1" part of my answer to the question about "How to restrict access to a node via node/12 and allow access via a path like content/sometitle?", which contains this rule in export format:

{ "rules_check_url" : {
    "LABEL" : "Disallow node/* access",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "node\/\\d+$",
          "operation" : "regex"
        }
      }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "Sorry, URLs like [site:current-page:url] are not allowed around here ...",
          "type" : "error"
        }
      },
      { "redirect" : { "url" : "no_access" } }
    ]
  }
}

Here are some suggested tunings of the above sample, to make it work for your case also:

machine name and label.
replace the node/* by your path(s) (in the regular expression).
possibly you may want to add an extra Rules Condition to only perform the Rules Actions for selected user roles (eg: only for user who are not administrators).
replace the path in the action part of the rule by your target path, and check if you do want some type of error message to be shown (if not remove that part of the action).


You can use the option Specify validation criteria of the Contextual filter to restrict your Views display to one or more Vocabularies, as you've heard before.
Then clone the display and do the same for different combinations of Vocabularies. You can change the path of each new page to avoid conflicts between different Views and calling multiple queries.
I don't know how Taxonomy display module works, I'm not sure if it improves performance, maybe you end up with the same performance metrics in your custom solution. The nodes still have to be matched with taxonomy in another database table, no matter which options you choose. I'm not a SQL expert, maybe someone else will be able to enlighten about the performance and how it affect Taxonomy term queries.


Drupal 8 : Add Product SKU as search filter for Orders view of the Commerce module

Ok you all most did it !

first in the view  you need to add the "Order item referenced from order_items" relationship

in your view ->advanced RELATIONSHIPS...

after this you can then add the "Product variation" relationship.

with the 2 relationships added to the view you can now add the exposed filter you require.


stream wrapper public /private not found Error

I had this problem too after some coding with file_save_data. And i solve it after clearing the cache and resaving the path in the file system configuration at admin/config/media/file-system.

My problem comes from an add field of file type, programmatically in an update.


Blocking IP Address In Drupal 7 Via Code

There isn't in core; system_block_ip_action() is about as close it you'll get, but that blocks the current IP.

Such a function would be trivial to implement though:

function block_ip($ip) {
  if (!(bool)db_query("SELECT 1 FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchField()) {
    db_insert('blocked_ips')->fields(array('ip' => $ip))->execute();
  }
}


Show hook_form on specific content type Drupal 7 Programmaticaly

You need to create a block that's content contains following code:

$form = drupal_get_form('YOUR_FORM_ID');
print drupal_render($form);

Set the block visiblity only on content type 'outside' & place this block in any region as per your suits.


Allow user to change term, for views and taxonomy

You've done everything right. However, there's a kind of a usability problem with Views, Blocks and Exposed Filters. You can include the exposed filters within the views block by editing the View, then changing "Use AJAX" to yes. Specifically:

Advanced > Other > Use AJAX: Yes


Edit Block body content directly in database

block_custom table is what you are looking for.

Regards


If your events are nodes, write them into XML or CSV file. Then, you will be able to use Feeds module to import them in one file upload.

Next time ask the person that makes papers / pdf for you to also send you digital source data she's using.


How to completely remove Drupal from system to start over!

This is easiest using Drush http://drupal.org/project/drush

drush user-password username --password="new_password"


admin approval required for specific roles registered using profile2_regpath

You may be able to use Rules to accomplish this. Create a new Rule that is triggered when a user account is created. Then add a condition that checks what the role of the user is. And finally, an action that activates the user account. I think that would work - although I'm not sure if those triggers/conditions/actions exist. They probably do. :-)


Why drupal_realpath('public://') returns an incorrect path?

drupal_realpath() has been deprecated and shouldn't be used; since you have a stream wrapper URI you should be able to get the correct path like this:

$uri = 'public://';
if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) {
  $path = $wrapper->realpath();
}

Also make sure that your public path is correct in the UI (at admin/config/media/file-system)


Cron Tasks not running in background, causing pages to take forever to load

Part of the settings on /admin/config/system/cron are for the Automated Cron module, which adds them via automated_cron_form_system_cron_settings_alter(). The form field it adds has the following description.

More information about setting up scheduled tasks can be found by reading the cron tutorial on drupal.org.

If you follow that link, you will read the following sentences. (Emphasis is mine.)

The automated cron module has the disadvantage that it is triggered by a request, and the unlucky user who sends the request may experience a fairly long delay. For this reason, the automated cron is typically used by smaller sites that are unable to create a cron job manually, e.g. using the Linux crontab. If crontab is desired, Drupal console command may be used to simplify the configuration (rather than curling the long URL show in /admin/config/system/cron. Here is an example crontab entry:
30 * * * * web_user /var/www/html/vendor/bin/drupal --root=/var/www/html/docroot cron:execute > /dev/null 2>&1

Essentially, what you are experiencing is how the Automated Cron module work, but that isn't the only way to run cron tasks for Drupal.
You could also pass the URL shown on on /admin/config/system/cron after To run cron from outside the site, go to to wget or curl. This requires that you have access to, for example, cPanel for the site, which allows to set cron tasks.


Just  putting my comments in as answer...

https://drupal.org/node/2106647

How to make custom content type as product in ubercart drupal 7?

You have to create content type as product. Thanks


How can I configure the Mail System module to use Swift Mailer for registration emails?

The trick was to make sure the 'Respect provided e-mail format' option is unchecked in the message settings. Then I added a plugin to force HTML output for these email, as per this suggestion and used that for my Formatter and Sender in the mail system settings.


Should anyone else have this problem, the correct answer is:

{
    "node": {
        "field_restaurant_location": {
            "und": [
                {
                    "country": "us",
                    "latitude": "-26.2041",
                    "locpick": {
                        "user_latitude": "-26.2041",
                        "user_longitude": "28.0473"
                    },
                    "longitude": "28.0473"
                }
            ]
        },
        "title": "Restaurant from JSON API",
        "type": "restaurant"
    }
}


How to change the html of threaded comments?

Could you give a little more info on what you are trying to do?

If you want to add your view for displaying comments to a specific thread, please take a look at using panel from contrib (https://drupal.org/project/panels).

This module allows you to add views (and other components as well) to specific pages, other panels (when using mini panels) etc...


users see all replies to a message sent by admin [Privatemsg module]

This is by module design and works as expected.

If you add multiple recipients to a message, Privatemsg treats it as a "conference" discussion and notifies everyone in the group when someone replies.

If you want to keep the conversation only between you and a particular user, you must send it only to that particular user.

What you need to do is to hook into the submit function of the form and instead of generating messages for all recipients at once, loop through them and do that for each separately.

You should not modify source code, as that might make it work incosistently and will create maintenance problems for you later on.

What I suggest is to create a custom module, add your submit callback for privatemsg_new() form and process the messages separately. Check out privatemsg_new_submit() function in the source. Also make sure the default privatemsg submit handler does not get executed - just unset it form the $form['actions']['submit']['#submit'] array.


How to get Webform Radio Option Value as a token value for email template?

You need to append the :raw suffix to the token and change [webform_submission:values:radioButtonName] to [webform_submission:values:radioButtonName:raw].


When you alter a node editing form, the fields you add are part of the node and can be accessed using the $node argument of hook_nodeapi. Save your data when $op == 'insert' and $op == 'update'.

If you do not want your fields to become part of the node, write a form submit handler and add its name to the $form['#submit'] array. The submit handler should remove all your fields from $form_state['values'] (in addition to whatever was intended when adding the field to the form).


Display new tag to the newly added content

You can do it easily by adding new field Node: Has new content in views, it will show NEW status when a new node is added.


Define a resource of Service module, But 'access callback' cannot work

Is your access callback in the same file? If not, you'd have to add: "access callback file" to your definition, and point to it.

I'd also clear cache within Drupal, as I've seen drush cc all not always clear all caches.

Also, I'd name-space your access callback function, as it could be conflicting with something else in the system. _message_access is a pretty generic name. You should rename it to: _baidu_push_services_message_access().

Otherwise, your syntax looks correct.

Or, if you solved your issue, perhaps post it in here, to help others.


Content Strategy: Similar but unique content

I would agree with beth's post earlier, use a taxonomy to group all the different content types you are working with.  For example, create a taxonomy vocabulary named "Conference".  For EACH of the content types used to store information about the conference, add a field:
Label: Conference
Type: Term reference
Form element to edit the data: Autocomplete term widget (tagging)

Now, when you are filling in the details using your different content types, tag your content with the conference name.  Later you can filter display of that information by filtering on the taxonomy term.


Flood control module in addition to the modules mentioned in this duplicate question

From module page

  This project is intended to add an administration interface for hidden flood control variables in Drupal 7, like the login attempt limiters and any future hidden variables.


How do you rename the machine name of a content type?

I disagree with most of the comments above simply stating: don't change the bundle machine name. These don't answer the poster's question.
This was a simple task in Drupal 7; but due to the added complexities in Drupal 8 it was decided to attempt to remove this ability. See this issue for history:
#2172843 Remove ability to update entity bundle machine names.
That being said, if you do a database search/replace on the machine name this should do what you are looking for - BUT beware, some of those machine names are embedded in serialized data (e.g. key_value table) and you will need to modify the json string size if the machine name you are replacing is a different length than the new name.


How to check in a Rules Condition if an Ubercart product is out of order?

As per the UC issue about "Stock transaction should be more flexible through Rules" (from 6 years ago, status "needs work" ...), it seems that at this time trying to use the Rules module for such "out of order" situations may not be a good idea.

You may want to try to use the Ubercart Out of stock Notification module instead. Some details about it (from its project page):

  Out of stock notification for
  Ubercart.

  It uses ajax and jquery and asks the server for available stock and
  replaces the 'Add to cart' button with some configurable HTML.

  ...

  It also provides server-side validation so this module can prevent the
  addition of out of stock items even if JS is disabled or if the user
  clicks on an "Add to cart" button too quickly.


Commenting option for each paragraph of a node body

Have you looked at modules that may provide similar functionality like:

https://drupal.org/project/annotator
https://drupal.org/project/annotate

Other links:

https://groups.drupal.org/node/72748
https://github.com/patrickmj/Open-Review
https://groups.drupal.org/node/10875

They may not solve the problem you have but they may have code solutions that can help you go down the correct track


what is the difference between hook_insert and hook_node_insert

The difference is stated in the hook_insert documentation:

  This hook is invoked only on the module that defines the node's
  content type (use hook_node_insert() to act on all node insertions).

This hook is only fired on the module that defines its own content type for nodes of that content type, so you only should use it in this case for your own content types.


Error message after using Internalization

This warning issued from file and directory permission.
This issues maybe useful for you.
link1
link2


Mimemail or HTMLMail both look like they support Rules.


Easily add term to vocabulary with long list of terms

For better UI management of taxonomy terms try Taxonomy Manager

This module provides a powerful interface for managing taxonomies. A vocabulary gets displayed in a dynamic tree view, where parent terms can be expanded to list their nested child terms or can be collapsed.

The Taxonomy Manager has following operations and key features:

 - dynamic treeview
 - mass deleting
 - mass adding of new terms
 - moving of terms in hierarchies
 - merging of terms (using the Term merge module in 7.x)
 - fast weight changing with up and down arrows (and AJAX saving)
 - AJAX powered term editing form
 - simple search interface
 - CSV Export of terms
 - i18n support for multilingual vocabularies (per language terms)
 - Double Tree interface for moving terms in hierarchies, adding new
   translations and switching terms between different vocabularies


getpreventdefault is deprecated - Caroussel stopped working

try to use Jquery version 1.7.1, or 1.8

If this doesn't work you can try that function this way:

$(document).on('click', function (e) {
    if (e.originalEvent.defaultPrevented) return;
    // continue
});

If everything was working before, maybe is some other js script added and it is getting the error but the console is not showing it properly


Code for view, and module name in path besides node id

In that same block of code, can do an arg() check.

$node = menu_get_object();
$menu_image = 'arrow_home.png';
if (!empty($node)) {
  $images = array(2 => 'arrow_home.png', 3 => 'arrow_formazione.png', 4 => 'arrow_workshop.png', 5 => 'arrow_raccontabito.png');
  $menu_image = isset($images[$node->nid]) ? $images[$node->nid] : $menu_image;
}
if (arg(1) == 'gallery') {
  $menu_image = 'arrow_gallery.png';
}
elseif (arg(1) == 'contact') {
  $menu_image = 'arrow_contact.png';
}

Note: This will only work as long as the URL structure stays the same.

Also, this code depends on where you are preprocessing the image. If you are using template_preprocess_node() the above will not work because those two pages, even though they are located at the node path, are not nodes.


How do I include a JavaScript file and pass the value of a PHP variable with a single function call?

How to combine it togather?

You don't - Javascript files and settings are two completely different things. Anything you add to the settings will be available on the global Drupal object, which will be available by the time the code in your JS file is invoked.

Your code should be:

drupal_add_js(array('variableName' => 'value'), 'setting');
drupal_add_js(path_to_theme().'/js/backgroundConfig.js');

Or the other way round, it really doesn't matter.


You need to have the "Administer profiles" permission.

Then you will have a "Delete profile" button at the bottom of the profile page when editing.

You can also access the profile at: /profile-<profile_type>/<uid>/delete and go right to the deletion confirmation box. Note that the path is compose of the word 'profile' then a hypen then the name of the profile type you created, so in your example it would be: /profile-C/<uid>

HTH.


How can I find image style SRC from within twig template in view?

Why I can't use {{ file_url(node.field_image.0.entity.uri.value) }} in
  my custom view

Simply because your view does not have access to the node variable object.

You can use Image URL Formatter module. Then add your image field and for formatter select Image URL.


How is your override requirement? Is it for all the views or for a certain views?

For certain views:
In that views admin page : go to Advanced -> Theme: Click on Information

you will see the active templates for 'Display output' in bold (views-view.tpl.php) and rest available theme suggestions for overridden (comma separated).

Now copy views-view.tpl.php from views contrib module theme folder and put it in your site theme folder, rename it to one of the name suggestion available in views. Make changes to your template.

Clear cache and check.


Drush 6 does not support Drupal 8.  You must use drush 7.0-rc1 with Drupal 8 beta 9, or drush master head with Drupal 8 head.

UPDATE: Drush 7 no longer supports Drupal 8; now, use Drush 8 with Drupal 8.


Entity Update Failing: How can I clean this up?

Update: it seems that you need to run cron to complete the field purging process drupal goes through.

Also you may be getting some errors when the fields you are deleting have data in them . entup does not attemp to drop fields with data in them and you have to do it yourself. You have 2 options:

Go to each field in the content type and delete them manually.
Write an update hook that delete the fields before you run entup. In other words, you run drush updb then you run drush entup provided you have implemented an update hook that deletes the fields. Something like this (code not tested):

function my_module_update_8001() {
   $entity_type = 'node'; // or user or wherever the field appears
   $bundle_name = "article"; // or whereever the field appears
   $field_machine_names = array('field_one', 'field_two');
   foreach($field_machine_names as $field_machine_name) {
    $field = \Drupal::entityManager()->getStorage('field_config')->load($entity_type.$bundle_name.$field_machine_name);
    $field->delete();

  }
}

In addition, make sure that you run cron frequently because that's when drupal does garbage collection and deleted field data get purged.


When does the user interface translation gets updated?

The check for updates is being called on the cron job 'Interface Translation'
If you disable the cron job or disable the "check for updates" on the page you mentioned, there will not be an automatic update on cron runs.

The other methods you name are manually methods.

There is one more method in Core UI, if you translate the interface text manually on the admin/config/regional/translate page.

It also depends on the settings "Import behavior" on the admin/config/regional/translate/settings page. If the import gets updated.

This is what I know is available in Core UI.

You can of course have other contributed modules as Drush or Drupal Console to update your translations.
Or even Composer see https://github.com/drupal-composer/drupal-l10n


Updating the block region/pages settings for a NEW views block during an implementation of hook_update_N

This can be resolved by using db_merge instead of db_update, which effectively updates if it exists else creates the entry.

An alternative line of enquiry would be to look at using one of the new hooks available in the features module. In theory 'hook_post_features_rebuild()' would reactively move the block after the features been rebuilt, and therefore the blocks been created.

http://drupal.org/node/1782492


Per the official the FAQ about SA-CORE-2018-002:

  I manage a Drupal 6 site, is a fix available?

  Yes, Drupal 6 is also affected and the Drupal 6 Long Term Support project has patches available.

The issue for this is [core] Add D6LTS patch for SA-CORE-2018-002.  The issue has a patch from a security team member and further information.

2018-03-30 update:

Per a security team member in a recent comment:

  Please just upgrade Drupal core rather than patching!

  Note also the D6lts patch and corresponding github releases for that
  and Pressflow 6 were updated to fix a subtle flaw in the released
  security fix that was affecting a couple contrib modules including
  Organic Groups (og) for Drupal 6.

  https://github.com/d6lts/drupal/releases/tag/6.43

  https://github.com/pressflow/6/releases/tag/pressflow-6.43.124


Prevent access to or redirect /user page

You can probably use access_filter to prevent access to a specific URL.

It can setup filters that will allow you to deny access to specific URL based on IP (or all IPs) and specify where to redirect anyone who is trying to access that URL.


How to create a single page with a jump select menu?

Views provides a "jump menu" display, you could just use that.


How to alter and rewritte current path programmatically in Drupal 8?

I was able to achieve what I wanted to do by using PathProcessor service.

Here is my services.yml
  mymodule.path_processor:
    class: Drupal\mymodule\PathProcessor\PathProcessor
    arguments: ['@language_manager', '@config.factory', '@path.alias_manager']
    tags:
      - { name: path_processor_inbound, priority: 200 }

And my code in my PathProcessor.php class :

/**
 * Processes the inbound path using path alias lookups.
 */
class PathProcessorCustom implements InboundPathProcessorInterface, OutboundPathProcessorInterface {

    protected $language_manager;
    protected $configFactory;
    protected $aliasManager;

    public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, AliasManagerInterface $alias_manager) {
        $this->languageManager = $language_manager;
        $this->configFactory = $config_factory;
        $this->aliasManager = $alias_manager;
    }

    public function processInbound($path, Request $request) {
        if (!strpos($path, '/admin/')) {
            $path = $this->removeISOCode($path);
        }

        return $path;
    }

    public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
        if (!strpos($path, '/admin/')) {
            $path = $this->insertISOCode($path);
        }

        return $path;
    }

    protected function removeISOCode($path) {
        $langcode = $this->languageManager->getDefaultLanguage()->getId();
        $isocodes = $this->getISOCodeMapping();
        $path_items = explode('/', $path);
        if (isset($path_items[1]) && strlen($path_items[1]) == 2 && in_array($path_items[1], $isocodes[$langcode])) {
            $config_negotiation_url = $this->configFactory->get('language.negotiation')->get('url');
            if (!in_array($path_items[1], $config_negotiation_url['prefixes'])) {
                array_splice($path_items, 1, 1);
                if (count($path_items) == 1) {
                    $config_system_site = $this->configFactory->get('system.site')->get('page');
                    $path = $config_system_site['front'];
                }
                else {
                    $path = implode('/', $path_items);
                    $path = $this->aliasManager->getPathByAlias($path, 'en');
                }
            }
        }

        return $path;
    }

    protected function insertISOCode($path) {
        $path_items = explode('/', $path);
        if (isset($path_items[1]) && strlen($path_items[1]) == 2 && $path_items[1] == 'gb') {
            $config_negotiation_url = $this->configFactory->get('language.negotiation')->get('url');
            if(!in_array($path_items[1], $config_negotiation_url['prefixes'])) {
                $path_items[1] = $language;
            }
        }

        $path = implode('/', $path_items);

        return $path;
    }

    protected function getISOCodeMapping() {
        return [
            'en' => ['gb', 'us'],
            'fr' => ['fr', 'be']
        ];
    }

}

What I do is I decompose URL and remove what I know I don't need and map the URL to an actual content URL. Otherwise, redirect to the default 404.


Best way to store not publicly viewable data?

The simplest way to do this is to put the two fields "skill name" and "rating" in a field collection:

Field collection

But I would suggest to use the new module Paragraphs. This will extent Drupal's flexibility to design content types for structured data a lot:

Paragraphs

Edit:

Changed module name (thanks to @Berdir).


I had some similiar issue.

Problem was that drupal was cosuming 100% of cpu usage, sometimes making the execution of some queries to take to long and reaching the max timeout on LOCK_TIMEOUT

If you have acccess to command line, check proccess, cpu usages, sql usage and so on

Hope it helps

There are some threads about drupal sites cosuming 100% of cpu (Kind of old but i had this problem recently), take a look

See this thread for a bit of debuging


Yes. Under the Rewrite results > Override the output of this field with custom text option, one of the Twig tokens you can use is {{ $FIELD_NAME__value }} (e.g. {{ body__value }}). This will have views render the field in its raw, pre-filtered, format.


How can I place content in page_top in D7 since it is hidden in regions?

In the .info file of your theme you can add regions.

The template files that control your page layout are going to display that region.
Usually page.tpl.php will have the regions called upon for display.  So if you add a region to the .info file you will need to add the region in the page.tpl.php file as well.

Great article here... a little dated.. but still works.
http://yuriybabenko.com/blog/creating-new-drupal-regions


Product color from select list in Commerce Kickstart 2

That's exactly what variations are for...

You have a product (a t-shirt) with a variety of different options (colours), hence you need different variations of the product to identify what colour of t-shirt has actually been sold.

Kickstart already has that exact functionality built right in; if you install the demo content and browse to "/tops/guy-short-sleeve-tee" you should see it:


how i can create pages dynamically on users any action?

this is how one can do so.
First make a content type (also can use Basic Page type).
Then the below code will make pages(nodes of the content type) dynamically.

<?php
// Construct the new node object.
$node = new stdClass();

// Your script will probably pull this information from a database.
$node->title = "My imported node";
$node->body = "The body of my imported node.\n\nAdditional Information";
$node->type = 'mynewpage';   // Your specified content type
$node->created = time();
$node->changed = $node->created;
$node->status = 1;
$node->promote = 1;
$node->sticky = 0;
$node->format = 1;       // Filtered HTML
$node->uid = 1;          // UID of content owner
$node->language = 'en';
// If known, the taxonomy TID values can be added as an array.
$node->taxonomy = array(2,3,1,);

node_save($node);
?>

if you need to create nodes at root of Drupal directory you also need to include these lines in start of the code

// Bootstrap Drupal
require 'includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


You can print the node

Title as

  {{ label }}

Body

  {{ content.body }}

Try this,

  {{ content.body| raw }}

It will be used to remove the markup in the content.


In the Drupal Examples project you can find the ajax_example module with a similar form with dependent fields.

http://drupal.org/project/examples


How to add a custom views filter handler for a specific field?

This require a little effort so I will only put here the main parts and a reference to an article that I used to create a custom Views filter in Drupal 8.

First you need to declare the filter inside the hook_views_data_alter() implementation:

$data['node_field_data']['nodes_titles'] = array(
  'title' => t('Node titles'),
  'filter' => array(
    'title' => t('Node titles'),
    'help' => t('Specify a list of titles a node can have.'),
    'field' => 'title',
    'id' => 'd8views_node_titles'
  ),
)

Since we are filtering on the title column, we are extending on the node_field_data table but with the title column as the real field to be used. Additionally, this time we are creating a plugin to handle the filtering identified as d8views_node_titles. Now it follows to create this class:

src/Plugin/views/filter/NodeTitles.php:

    /**
     * @file
     * Definition of Drupal\d8views\Plugin\views\filter\NodeTitles.
     */

    namespace Drupal\d8views\Plugin\views\filter;

    use Drupal\views\Plugin\views\display\DisplayPluginBase;
    use Drupal\views\Plugin\views\filter\InOperator;
    use Drupal\views\ViewExecutable;

    /**
     * Filters by given list of node title options.
     *
     * @ingroup views_filter_handlers
     *
     * @ViewsFilter("d8views_node_titles")
     */
    class NodeTitles extends InOperator {

      /**
       * {@inheritdoc}
       */
      public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
        parent::init($view, $display, $options);
        $this->valueTitle = t('Allowed node titles');
        $this->definition['options callback'] = array($this, 'generateOptions');
      }

      /**
       * Override the query so that no filtering takes place if the user doesn't
       * select any options.
       */
      public function query() {
        if (!empty($this->value)) {
          parent::query();
        }
      }

      /**
       * Skip validation if no options have been chosen so we can use it as a
       * non-filter.
       */
      public function validate() {
        if (!empty($this->value)) {
          parent::validate();
        }
      }

      /**
       * Helper function that generates the options.
       * @return array
       */
      public function generateOptions() {
        // Array keys are used to compare with the table field values.
        return array(
          'my title' => 'my title',
          'another title' => 'another title',
        );
      }

    }

Inside the plugin, you need to override three methods, as explained in Creating a custom Views filter in Drupal 8. Here is a quote from it:

  Inside init(), we specify the title of the set of filter options and the callback that generates the values for options. This callback has to be a callable and in this case we opted for the generateOptions() method on this class. The latter just returns an array of options to be presented for the users, the keys of which being used in the query alteration. Alternatively, we could have also directly created the options inside the init() method by filling up the $this->valueOptions property with our available titles. Using a callback is cleaner though as you can perform various logic in there responsible for delivering the necessary node titles.

  The point of overriding the query() and validate() methods was to prevent a query and validation from happening in case the user created the filter without selecting any title. This way the filter has no effect on the results rather than returning 0 results. It's a simple preference meant to illustrate how you can override various functionality to tailor your plugins to fit your needs.


How to speed up Drupal 7 calls to _theme_process_registry?

I found there is already an issue related to this on drupal.org: Performance: optimize building theme registry by using get_defined_functions() instead of function_exists()


Search API isn't returning results with words in the title

I had to turn on the setting Search on parts of a word on the Server's page in order to get it to work. Now it searches titles. I'm not sure why it doesnt search titles with that unchecked.


There should not be a space after "[all]" ...
Change:
stylesheets[all] [] = styles.css
to:
stylesheets[all][] = styles.css


how i can reset the page num to 1 when i change to another exposed filter option?

Create new filter group in the "Filter Criteria" section of view and add move both the exposed filters in the new group and than apply the "OR" operator between them as below:


How does Drupal.org's packaging script works?

The projects on drupal.org are managed by the Project project, which also contains the scripts for this. Some drupal.org specific code (for example the zip. and tar.gz packaging implementations) are also in the Drupal.org customizations project.


How can I prepopulate a field's value when creating a new entity

After adding dependency injection of a requestStack, this works.

/**
 * @var Symfony\Component\HttpFoundation\RequestStack
 */
protected $requestStack;

/**
 * Constructor.
 *
 * @param Symfony\Component\HttpFoundation\RequestStack $request_stack
 */
public function __construct(RequestStack $request_stack) {
  $this->requestStack = $request_stack;
}

/**
 * {@inheritdoc}
 */
public static function create(ContainerInterface $container) {
  return new static(
    $container->get('request_stack')
  );
}

public function buildForm(array $form, FormStateInterface $form_state)
  /* @var $entity \Drupal\my_module\Entity\Foo */
  $target_id = $this->requestStack->getCurrentRequest()->query->get('target_id');
  $this->entity->set('bar_id', $target_id);
  $form = parent::buildForm($form, $form_state);
  $entity = $this->entity;

  return $form;
}


How do I write to location field in an Entity?

This works, but (here's the trick), only if you enable the location_entity module, which ships with location.

$location = array(
  'latitude' => $latitude,
  'street'   => $street,
  // etc, other elements added here ...
);

$ew->field_location->set($location);
$ew->save();

May no one else lose as much time on this ever again.


The combination of Relationships and Contextual filters to make it work isn't random, it actually follows your requirements just as you've written them, you only need to add them to your Views configuration the way you describe.

How Views types work

You want a list of nodes, that is why you create a Content Views Display. Content Views display information that is stored on nodes. When a node has an Entity reference field, that field stores only the information about what entity that is, usually the entity ID. For example, when referencing files what is stored in the Entity file reference field is the FID. The node (the node's table in the database) doesn't store anything more about that field.

The entity that is being referenced may have fields of its own. These fields are stored with the entity data (in the database they are stored in the related "entity table"). Simply put; nodes have their own tables of data, other entities have their own separate tables of data. The connections between nodes and other entities can be done through small "bridges" that are Entity reference fields that store only the connection between two IDs.

When you create Views of a certain type, you're basically choosing which entity database table to pull information from. To overly simplify for clarity: If you want to list nodes, views set nodes table and you can only show data stored in nodes, if you want to list documents, views set files table and you can only show data stored in files.

How to show referenced data in Views

But what if you want to show more information about the related entities, like in your case? You need to add Relationships towards the related entities. Relationships make other database tables data available into your Views!

Once you add some related entity Relationship to your Views you will see new options appear under Fields and Filters, options related to the referenced entity, options you didn't have before you added the Relationship.

And that is what you need to do to your Content Views. Your content references some Files and you want files data to be available in your content views. If you wanted to list content that shares the same file reference you would then add another Relationship, the "backwards" Relationship pointing towards the content that uses the file field we added the Relationship to, and add a Contextual filter that uses that second "backwards" Relationship.

How to show data that is referenced by referenced data

But in your case, there is one extra layer of connection, and you need to add 2 more Relationships. You're not matching the referenced files, you're matching the taxonomy terms that are referenced from files that are referenced from content:

Page > File > Term < Other Files < Other Pages

Here are the steps for your case:

Create Content Views Block Display listing Page nodes
Add Relationship towards your "Linked Document" field, you can require it since you won't have nodes with empty document field in the results
Add another Relationship Taxonomy term referenced from field_document, it will use the first Relationship automatically, you can require it since that field won't be empty either, so you won't be excluding any nodes you don't need to if you require it

So far we've been going in the direction from nodes to their referenced files, to terms referenced from those files.

Now we have all that information in Views, we can start matching "backwards" to get term siblings and file second cousins.
Add the third Relationship Taxonomy term using field_document_tag and make it use the second Relationship. You can require it
Add the fourth Relationship Content using field_document and make it use the third Relationship, you can require it

This fourth Relationship is pointing to nodes that reference files that refrence terms that are referenced from files that are referenced from nodes listed in this Views.
Now we can add a Contextual ID filter from Content Category, and configure it:
Make it use the fourth Relationship (the only one available)
When the filter value is NOT available
Provide default value
Content ID from URL
When the filter value IS available or a default is provided
Specify validation criteria
Content
Basic Page
Hide View if the argument doesn't validate, or some other options that makes sense to you.
Place the Block on Basic pages, adjust the Node from URL and other Block options.

Remove the current node from the list

The node you're currently viewing will also be listed. To Exclude it add the second Contextual ID filter:
    When the filter value is NOT available
    Provide default value
    Content ID from URL
    More
    Exlude


Show links only to sub menus items, not to parent menu

Use Menu item container module, containers have no URL path associated with them. So they are not links, just regular text

  By default, the Drupal menu system only allows you to add menu items
  that are links. With this module, you can add menu items that are
  simply containers, and not links.

also look into Special menu items and Menu Firstchild modules.


How to get the super user in a functional test?

Looking into BrowserTestBase I accidentally found $this->rootUser->name and $this->rootUser->pass_raw last week. These are being used in installParameters(). I have not tested it, but I suppose you should be able to use those in other functions as well.

rootUser appears to be a full AccountInterface object, so getName() and other methods should work as well..


Administrator can add content for other users?

The author of content is driven by a field in the Authoring Information Tab on the content's edit screen. You can set this field to be any user, and that user will be considered the Owner of the content for permissions purposes. By default this field gets populated with the current user.


Pre-populating a CCK field item with values from another field

$result = db_query('SELECT `vid`, `field_level_label_value` FROM `drupal_content_type_meas_areas`;');
while ($item = db_fetch_object($result)) {
$items[] = $item->field_level_label_value;
}
return $items;

I figured it out -- removing the $item->vid bit as $items' array key results in the proper values.

Oh Drupal, so subtle in its frustrations! :D


Store Products and Store Orders issues of Commerce_marketplace module

If you go to user/%/store(or by clicking the stores tab in your user page), you will be able to see the stores of the particular user. On clicking the store name, you will be re-directed to a page commerce_store/store/%storeid.
In this page, there will be diffrerent tabs View, Edit, Delete, "Storename"'s products, Memebers and Sales tab.

On clicking the tab "Storename"'s products, you will be able to see the products added to your store.

Also please double check that you have enabled correct permissions.

One thing though, admin will not be able to see the products of another user via the above method. He will have to naviagate to structure->Entity type -> commerce store ->store and click on a particular store name to view that store's details.

Let me know how that goes.


Tokens causing incorrect text substitutions

It appears to me that the explanation for your issue might be because of any of the following reasons

Reason 1:

It could be related to what is described in  https://www.drupal.org/node/390482, which states:

  The tokens available depends on what modules you have enabled on your Drupal site.

So could it be that you (accidently) disabled a module recently, which was actually the module related to the token that you now have an issue with?

Also, some more related considerations, based on what I read at comment #3 in the issue queue on D.O:

What does that "00" in the "7,500" actually refer to? I want to better understand which module(s) are related to it.
What result do you get if you (temporary) enable all of your currently disabled modules? FYI: if you only enabled the module that is causing this issue, and not uninstalled it, the problem might be resolved, at least for now. And then you can think of how to best resolved it permanently.

Reason 2:

When you define a custom token, for "Text format" (under the "Content" box): verify what the text format is you use there. And also verify what the text format is of where you are trying to USE that custom token (as in the original question: in the block), or in your Webform, Email etc.

Because maybe something is wrong in the way you're using/mixing text formats. Refer to How to use the Custom Tokens module, especially to this part of it (bold markup added here):

  note that "Custom Token" sends what you put in the "Content" box to the page. It doesn't evaluate it first and then send it. Therefore, if your custom tokens include other tokens and/or PHP code, then the "Body" box in which you place your tokens must use the same text format that you used to define them, so that the other tokens and/or PHP get evaluated.

The question here might be a minor variation of the scenario described in that community page ...

Other reasons worth verifying:

Maybe the field "type" got changed somehow, and that is what's causing it?
Something similar within the content type settings?
Could it be related to something about some missing "permissions" (for those cases where there is this issue)?

Curious to hear if either of these 2 reasons are actually also a solution for what this question is about.


geolocation_views: show combined data in tooltip

You're incredibly close. What you need to do is incorporate the objects related to the place into the place view itself.

You do this by means of a Relationship. You can find that, when you're editing the view, in the right-hand Advanced column. When you click Add, you'll see something like Entity Reference: Referenced Entity, A bridge to the Content entity that is referenced via your relate field.

This puts the JOIN in the FROM clause of the underlying SQL query.


Custom checkout pane for order comments not saving

This was fixed by passing ['order_notes'] into $values.

 /**
   * {@inheritdoc}
   */
  public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form) {
    $values = $form_state->getValue($pane_form['#parents']);
    $this->order->set('field_order_notes', $values['order_notes']);
  }


Simpletest on select field loaded by ajax

You should set the $path parameter to NULL when submitting to the same form. Otherwise drupalPost / drupalPostAJAX will first retrieve the page again, and thus generating a new form instead of rebuilding the current one.

The following test should do what you want:

// First retrieve the page once
$this->drupalGet('mymodule/mypath');

// Set $path to NULL on subsequent requests to the same form
$edit = array('system[foo]' => 1);
$this->drupalPostAJAX(NULL, $edit, 'system[foo]');

$edit = array('system[bar]' => 2);
$this->drupalPost(NULL, $edit, t('Submit'));

The test case succeeds when performed on the following form:

function mymodule_myform($form, &$form_state) {
  $foo_options = array('A', 'B', 'C');
  $foo_default = isset($form_state['values']['system']['foo']) ? $form_state['values']['system']['foo'] : NULL;

  $form['system']['#tree'] = TRUE;

  $form['system']['foo'] = array(
    '#type' => 'select',
    '#options' => $foo_options,
    '#default_value' => $foo_default,
    '#ajax' => array(
      'callback' => 'mymodule_myform_ajax_callback',
      'wrapper' => 'bar-div',
      'method' => 'replace',
    ),
  );

  $bar_choices = array(
    0 => array('aaa', 'bbb', 'ccc'),
    1 => array('ddd', 'eee', 'fff'),
    2 => array('ggg', 'hhh', 'iii'),
  );
  $form['system']['bar'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
    '#type' => 'select',
    '#options' => isset($bar_choices[$foo_default]) ? $bar_choices[$foo_default] : array(),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}

function mymodule_myform_ajax_callback($form, $form_state) {
  return $form['system']['bar'];
}


How to do Question and answers with email notification in drupal 7

Well, this can be achieved using Rules module.

Also refer to this question - https://stackoverflow.com/questions/4463011/drupal-rules-sending-an-email-address-to-a-user-reference


Disable editing of a node after it has been published

Yes, you can define dynamic rules in a custom module. See hook_node_access

Here's a sample implementation:

/**
 * Implements hook_node_access().
 */
function MYMODULE_node_access($node, $op, $account) {
  if (
    // The $node argument can be either a $node object or a machine name of
    // node's content type. It is called multiple times during a page load
    // so it is enough if you perform the check once you get the object.
    is_object($node) && $node->type == 'story' &&
    // Operation on which you want to act: "create", "delete", "update", "view".
    $op == 'update'
  ) {
    // Check if the node is published.
    if ($node->field_published[LANGUAGE_NONE][0]['value'] == 1) {
      return NODE_ACCESS_DENY;
    }
  }
}


The short answer is that subqueries is not possible with db_select(), and pagers are only created through the query builder, either SelectQuery or EntityFieldQuery.

So you can't the above query and utilize Drupal's pager system, you would have to manage the pager yourself if you want the above query, or rewrite the query into several queries.


What is the best way to allow user Edit one Form?

If your question is primarily about how to allow the user to edit a form (as the title suggests), then I think the way to go is

Create a new role at /admin/people/permissions/roles and call is something like 'editor'.
Then go into the permissions page at /admin/people/permissions and give the new role 'Edit any content' permissions under the 'Node' section for each of the content types you have.

If you're simply wondering whether all those content types are OK, I'd say that having 10 content types for a Drupal site is not that crazy or unusual.  Of course, if you're just trying to distinguish the pages from each other in some way, sometimes tagging/taxonomy is better than putting them in different content types, but that depends on what you're trying to achieve.  If they legitimately have different fields/structure, than you're OK to have 10 content types.

Does that answer your questions or were you getting at something else?


Get relationships between tables when no foreign keys are present

You have 3 possible options, but you most likely want to start with #2 and combine it with #3.

Use php to print out the Entity Metadata Wrapper for various nodes objects of different types.
Use the Devel Module and view the Node object
Use Views

If the Entity definitions were properly implemented (a huge IF) it is possible to print out the relationships using entity_metadata_wrapper from php.  You can even write it out to a file from command line using Drush but this will take some advanced skills.  However, this typically results in tens of thousands of lines, an overwhelming amount of information, with many circular references.

Using the Devel Module will be much easier as you can simply click down into what the Node object is presenting.  This may not show all the fields if they aren't filled out so you will want to create a test Node of each type with data in each field. If filled properly this may help relate structures when looking at the raw MySQL data as well.

Using Views, Drupal's built in query builder, will help you either understand the schema or just export it by adding the Views Data Export module. You will want to start from a perspective of particular Node type (a content type).  Each Node type will show fields it can access and you should be able to build the queries from there.  You may need to add Relationships (joins) to get all the data depending on how the developers built the system, its hard to say. Drupal will limit you to only the tables that are defined with Relationships.

You can see the MySQL Queries you are building at the bottom of the page if Show the SQL Queries is enabled in the Views settings tab (/admin/structure/views/settings).


form_alter to change value of default in dropdown list

First you need to find out where the element that you're trying to manipulate is within the form array. The best way to do that is to install the Devel module and use the dpm() function to inspect the $form variable:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'my_form') {
    dpm($form);
  }
}

When you see the variable outputted to the message you can drill down until you find the particular element. Note the keys of the element's parents in the array as you'll need them too.

If this is a node form and the taxonomy list is provided by a term reference field the actual form element will be found somewhere like this:

$form['field_field_name']['und'][0]['tid']

Using that example your form alter would look like this:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'my_form') {
    $form['field_field_name']['und'][0]['tid']['#options'][0] = '- Choose City -';
  }
}

Again you'll have to confirm using dpm() whether 0 is the right array key for the default select option that you're changing.


How can I get a list of the roles in a system, via the REST API?

Create a custom service resource, (you'll have to create your own access callback and access callback file, unless you want to use DrupalGap which is tailored to the link mentioned here)
Then in your callback, try something like this:

return user_roles();


I highly, highly suggest not installing these things directly to the operating system. It will just be more problematic instead of using a contained, virtual environment.

Instead, I advise using virtual environments (Vagrant/Docker). I use DrupalVM for development. For PostgreSQL you can see this thread for info on how to get it up and going.

Here is a Docker flavored VM with instructions on PostgreSQL support.

The linked drupal.org page you mentioned is four years old. I wouldn't follow it.


This really depends on the amount of data, how you have access to it and what you want to do with it in Drupal.

If you simply want to display it and if you have direct access to the MS-SQL database, have a look at the sqlsrv module, which provides a Database driver that allows to directly connect to MS-SQL databases. You can then set up the database configuration in your settings file and easily connect to it and fetch your data. To avoid performance issues, you can cache the result with the cache_get()/cache_set() functions if you need to.

That is probably your easiest solution, especially if you want to be certain that your price lists are always up to date (remember to set the cache expiration correctly).

When querying the data directly, you don't need to create nodes or another data structure, you expose them directly by implement hook_menu() and so on.

Alternatively, when importing the data into your site (could be useful if you want to integrate it more tightly with your site, like site search, views, ..), you might want to look into the Migrate project. It has both support for external databases and XML so that's not relevant. To store the data, you could set up content types with fields and then map that to your external data. What fields you want to use depends on the structure of your price lists. If they are simple key/value lists, you could look into Properties* and if it is more complex, maybe something like TableField would be useful.

Disclaimer: I developed Properties and am also (somewhat) maintaining it.


Caching pages for anonymous users prevents other cache logic?

The page cache just takes whatever is generated by the current page, stuffs it into a large string and stores it into the cache. As long as that cache entry is then valid, it is returned and no other code is invoked.

Once the page cache is expired, the page will be regenerated completely and any other element will either be loaded from a specific cache or rebuilt.

If it's important that certain information is kept up to date, all you need to do is make sure that the cache expiration time of the page cache is the same or lower as the one of the relevant block/page/whatever.

There is a concept, called ESI, that basically allows to define placeholders in a page cache string that can be replaced with separate request. However, Drupal 7 doesn't really allow that yet (Drupal 8 will hopefully improve this) but this is for things that actually are different based on the user, for example if you have a site that is the same for all users except a single block that is user-specific. Not for something like a weather block that is the same for all users and valid for 5 minutes.


Migrate files from directory to Drupal using Migrate

If you are now using migrate_extras to set media as destination, you can take a look to the following links:

An useful example to import images using media as destination
A thread on drupal.org that deals a question very similar to yours


Use a contextual filter value in a view referencing a node name/path rather than id

I'm not sure, but it could be something like

  [term:vocabulary]/[term:name]


How do I add classes to read-more link and add-comment link on node for bootstrap 3

You were very close except at the end of your first line you had a "." instead of a ";".

function meetu_preprocess_node(&$variables) {
  $variables['content']['links']['node']['#links']['node-readmore']['attributes']['class'][] = 'btn btn-primary';
  $variables['content']['links']['node']['#links']['comment-add']['attributes']['class'][] = 'btn btn-primary';
}


import multi-value from csv into entity reference field from a field collection

Solution: using the same feeds importer's configuration but instead of importing with the standalone form, it worked once it was moved to a content type form. If a content type is selected a source is imported by creating a node of that content type.


Yes, you can look for the Secure Password Hashes module.

This module stores password hashes securely.
The default password hashes in Drupal 6 (and before) are rather insecure. MD5 is easy to crack, should an attacker find a database dump or gain access to your database. This module implements secure password hashes using the phpass password hashing method - multiple rounds of hashing and salting that make reversing the hash significantly more difficult to break by brute-force attack. This is the same approach that is used for Drupal 7.


How to print number of blocks in a region in Drupal 6

The following query returns the number of blocks in the left region of the current theme.
Replace left with your region name.

$current_theme = variable_get('theme_default', '');
$number_of_blocks = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme='%s' AND region='%s'", $current_theme, 'left'));


Trying to make gallery with views in Drupal 7

This question could use a bit of clarification.

  Using views I made a tab menu page that will appear on only the Series content type

What does the view currently display if not all the pictures associated to the series? Just every single pictures that exists in the database? Or doesn't display anything? If it displays every single picture existing, then you need to add a "Contextual filter" to the view, choose the field that you use to reference the series. And choose "Provide a default value" and choose "Content ID from URL" option.

For display I would use HTML List type of views, and use image presets (core) to display the thumbnails and use lightbox2 (contrib) module to display the large image.


Ubercart vs Drupal commerce for french ecommerce site

Check this article which compares Ubercart & Commerce modules. Winner is commerce module for most advanced features and simplicity.

Commerce module is written from scratch to solve usability and other issues in Ubercart. Commerce module will be obvious choice for E-commerce portal.

As far as i know there is no out of the box module for Carte bleau payment gateway. But, if you know the module development you can write one and contribute to community using commerce payment gateway API. This will help you.

Best of luck :-)


Is there way to display thumbnail gallery using external links to images?

It might be it is the Link Image Formatter module that you are after.

It is a image formatter for a Link field. The modules you mentioned can then be used to construct your gallery (Views, Imagecache External, Views Responsive Grid).

You could also rewrite the field output in Views by using the "token" and wrapping it in the needed HTML to display it as an image, something like:

<img src="[link]">

Make sure you get a plain version of the image URL, so you better check without rewriting first.

Note that using Imagecache External will result in images being stored on your own server. It doesn't free you from copyright issues as with embedded external images (hotlinking). That means you could alternatively use FileField Sources.

An extension module of the last one, Remote File Source, might avoid transfer of the image file on your server. I haven't tested that. You are likely to miss out on Image Styles in that case (e.g. to resize or cache images locally).


Provide an interface to edit only one field of a content type?

There is a new module by Earl Miles, the creator of Views, that does this in Drupal 7 called the Field API Pane Editor.  Unfortunately, because this is a new solution for D7 and Earl Miles tends not to reinvent the wheel, I don't think there is any existing module that you can download for this use case in D6.


Is there an equivalent of view modes for form editing?

1 - Panels/Page Manager
If you're using Panels and Page Manager (part of Chaos Tools) then you can break up the node/add form by enabling/overriding the node_edit page manager handler and creating a Panels layout to show the individual fields.
Just set a variant to only react on creation of your particular content type, and then arrange the form fields as you wish. This will let you split out any form fields, as well as provide a General form pane that will add any fields that you've missed out.
IMPORTANT NOTE COURTESY OF LETHARION
Something I didn't realise due to the fact that I always put the general form on the page, is that if you DON'T output ALL fields, then "form api will interpret it as "the user deleted the content of those fields" and will send back empty values. This could result in the loss of existing data, so be careful.

2 - Solely Fields/Field contrib
You could also try Field Permissions if the form is permissions based, or use a Field group with some collapsed fieldsets or tabs etc to initially hide the fields if they are not permission based.


For the purpose of creating content, how do block_view and the page callback defined in the menu hook relate?

hook_block_view() and hook_menu() aren't related at all, they're two completely independent concepts.

hook_block_view() is for defining blocks, which can be assigned to regions within the page template.

Items defined in hook_menu() are pages, for which a page callback is required to build up the content for that page.

I guess the slight confusion is that in Drupal 7 the page content is automatically assigned to a block in the main system region. Whatever you return from your page callback function for a menu item will be assigned to that main system block when you access the defined page.

A block is not accessible through a URL; it is a contextual piece of information that you add to different pages/regions when you need to. Think of the shopping cart in an e-commerce site as a perfect example of a block.

A menu item defines a page that is accessible through a URL, and may well contain any number of blocks within it.


In Drupal 8, how to automatically create a term in a specific vocabulary from the field present in node/add page?

Thanks to a colleague, I found the setting I had to use.

Go to - SITE/admin/structure/types/manage/article/fields/node.article.field_vocab_a_tag
Check - Create referenced entities if they don't already exist


Does an ajax callback work within a Views style plugin?

From what I understand seeing the AJAX docs, I think you're not supposed to return an AjaxResponse object. You're supposed to return a renderable array from the Ajax callback.

Sample Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['test'] = [
    '#title' => t('TEST!'),
    '#type' => 'select',
    '#options' => [
      '' => t('None'),
      'foo' => t('Bar'),
    ],
    '#ajax' => [
      'event' => 'change',
      'wrapper' => 'ajax-output-container',
      // Since views style options forms are complex, they're built by
      // Drupal in a different way. To bypass this problem we need to
      // provide the full path to the Ajax callback.
      'callback' => __CLASS__ . '::testCallback',
    ],
    '#prefix' => '

',
    '#default_value' => '',
  ];
}

/**
 * This is the AJAX callback.
 *
 * It generates the output for the AJAX request. The output REPLACES
 * the "wrapper" you define in #ajax.
 */
public function testCallback(array $form, FormStateInterface $form_state) {
  // This element will replace the DIV#foo you have in your #prefix.
  $elem = [
    '#type' => 'markup',
    '#markup' => '
Is it not working!>
',
  ];
  return $elem;
}

Debugging

Make sure that on page load, you're getting a div with the correct ID in your field prefix. You can put some default text in the prefix so that you can see it on page load?
If HTML tags are being stripped from your #prefix markup for some reason, then try injecting a separate item in the form with #markup.


Using Migrate API to select items from a JSON array

First, use a selector like this:

-
  name: position
  label: 'Position'
  selector: position

Then use this for the first value:

field_description:
  plugin: extract
  source: position
  index:
    - coordinates
    - 0

And this for the second value:

field_description:
  plugin: extract
  source: position
  index:
    - coordinates
    - 1


Twitter Widget profile script outputting white screen?

I've used the twitter widgets in blocks almost exactly (eg, different theme settings and users) like the above, and shoving a cut and paste of your code above works fine in a static .htm, so, I'd check your php and other console/error logs to see what drupal is upset about. First idea is an input filter is bolloxing it up.


delete scheduled tasks fails when task identifier is account:uid

If you go to /admin/config/workflow/rules/schedule you will see a table of your scheduled components. One of the columns in that table is the task identifier - that's the string you will have to use to delete the scheduled task. You didn't post any details related to the scheduling, so I don't know what you used as a task identifier. The task identifier is necessary because one component may be queued to execute many many times, each time with a different identifier. The component name is not unique. The task identifier is.


How can I get the language name of the current node?

I didn't find anything there available for clickers. I could suggest the following alternative:

Activate the "Display Suite Format" module
Create Display Suite "Code field" with following content:

<?php
  return t(locale_language_name($entity->language));
?>

Don't forget to activate the "Display Suite code" text format for this code field.
Add this code field to your content type's display!

Hope this helps!


Export taxonomy using https://drupal.org/project/taxonomy_csv

Then use excelent https://drupal.org/project/feeds module and create node importer and map fields accoridingly.


If you're using the Rules module, here's a simple rules export for the purpose.

Event: node_presave
Condition: authenticated user
Action: unpublish node

You could change the role condition to suit your site user config.

e.g: Add the role condition "Adminstrator" and click the "Negate" checkbox for "NOT Administrator role" condition.

You could also, for example, add a Rules action to show a message under "System > Show a message on the site" after unpublishing the node.

Exported Rule:

{ "rules_unpublish_updated_content" : {
    "LABEL" : "Unpublish updated content",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_presave" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "2" : "2" } },
          "operation" : "OR"
        }
      }
    ],
    "DO" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
  }
}

You can import the Rule at:

/admin/config/workflow/rules/reaction/import


How to include CSS from a vendor directory?

It's probably best to copy it, yes. Drupal isn't set up to serve any assets from the vendor/ folder, and actively prevents it by default with an .htaccess file. Also, all assets are normally handled via "libraries", which are defined by a module and whose JS/CSS files must be in the module folder.

You could change the .htaccess and insert a direct style element with /vendor/.../xyz.css into the page, but at that point it's probably a lot cleaner and more secure to copy it.

If it changes often and you want to avoid manually copying/committing it every time, you might look at automating this with a build script (eg. with webpack).


Conditional code in preprocess_page function?

I think this will work for you. Note:

It doesn't check the node type.
It adds the variable has_background_image on any page that has $vars['node'] available in hook_preprocess_page, and only on those pages.
$has_background_image will be true if the field isn't empty (that's the only check).

.

function MYMODULE_preprocess_page(&$vars) {

  $field_name = 'field_background_image';

  if (!empty($vars['node'])) {

    $node = $vars['node'];
    $items = field_get_items('node', $node, $field_name);

    $vars['has_background_image'] = $items ? TRUE : FALSE;
  }
}


get user profile picture at registration

There is a development version of the Register with Picture module.


Alternative for the core statistics module that also includes pages created using Views?

Have a look at the Visitors module. Here are some reports you get from it:

  View pages that have recently been visited.
  View pages that have been hit frequently.
  View pages count per month, day of month, day of week, hour.
  ...

Especially these reports should be what you're looking for (it includes hits for paths corresponding to a view):

Top pages (table with columns Title, Path and nr of Hits). Here is an example of this report:

Recent hits (table with columns Date of visit, Title, Path and User ID of the visitor). Here is an example of this report:

If you follow any of the "details" links in the example above, you'll get something that looks as in this example:

Checkout the above (source) links to get an idea of which data are available.

The demo site contains some sample reports (charts) available to anonymous users also. Any visits to a Views related path will be reported in the Recent hits module. This demo site also shows some additional blocks with reports also created by the Visitors module module.

You may also want to look at the visitors_schema to get an idea of the data that actually get logged (recorded) by this module.

In case it's not a perfect fit, it's probably a very good starting point for some custom reporting. Either via a custom module that would simply have to query the data maintained by the Visitors module. Or via a straight forward custom report created with the Forena module.

Disclosure: I'm the maintainer of the Visitors module,
and co-maintainer of the Forena module,
I hope this does not violate the site's policy on self-promotion.


Return data from WebformHandler to Controller

I don't know why you want to pass the data to the controller, you can do anything with the data in the webformhandler code. or you can pass the data using the namespace declared on the controller. please check the following code.
Inside the controller file place the below code that I have added new function to handle the webform data.

namespace Drupal\xxx\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\xxx\Plugin\WebformHandler;

/**
 * Class SearchFlightsController.
 */
class XxXController extends ControllerBase {

  /**
   * xXx.
   *
   * @return array
   *   Return search parameters string.
   */
  public function xXx() {

    return [
      '#theme' => 'xxx',
      '#search_query' => $this->t('Test Value'),
    ];

  }

  public function getwebform($formdata){
      /** place your code what want to do with $formdata*/
  }

}

//After that inside the webformhandler code write the following code
 /** take the data from webform and save in an array variable $formdata then pass to the function defined inside the controller */

use Drupal\xxx\Controller\XxXController;
$webfrmdata = new  XxXController;
$webfrmdata->getwebform($formdata);

I have not tested but hope this code can help you


Two modules you can try both of which integrate with user badges but will need a little more customization to get it right. Try the user_picture_block module:

  Create just one block with the logged on user's picture, if he/she has one. In addition, User titles, points and badges are also displayed, if there are any.

Also, there is the author_pane module which also has built-in integration with user_badges:


Drupal usually stores dates as Unix timestamps, not regular date strings. Have a look at your field_data_field_tarikh_tamat_passport table to confirm which data format you're working with. If it's a timestamp, update your query to use UNIX_TIMESTAMP() instead of CURDATE().


Zurb vs. Bootstrap themes: About performance

The Drupal Bootstrap is just a wrapper for the Bootstrap Framework. When you download that, the compressed size increases by about 200 Kb.  However, I don't think size is a good metric for theme performance.

Foundation has a very limited number of UI elements, it just gives you the foundation to build your own theme upon. Bootstrap provides almost every UI element you can think of. If you want to design your own CSS carefully, to give your site a personal design, go with Foundation.  If you just want to do rapid prototyping or to have  a responsive site up quickly and with little effort, go with Bootstrap.

As for performance, I haven't spotted any clear differences between these in the context of Drupal. Btw.: I don't think the Drupal versions should differ from those on other platforms, as most of the code is the same for all platforms. The Drupal versions are just wrapped to fit into Drupal's theme system.


I created a line item using hook_uc_line_item() then added the line item in the hook_uc_order().

Final products looks something like:

/*
 * Implement hook_uc_line_item()
 */
function my_module_uc_line_item() {

  $items[] = array(
    'id' => 'handling_fee',
    'title' => t('Handling Fee'),
    'weight' => 5,
    'stored' => TRUE,
    'calculated' => TRUE,
    'display_only' => FALSE,
  );
  return $items;
}

/**
 * Implement hook_uc_order()
 */
function my_module_uc_order($op, $order, $arg2) {

  // This is the handling fee. Add only if the user is a professional and there
  // are shippable products in the cart.
  if  ($op == 'save') {
    global $user;

    if (in_array('professional', array_values($user->roles))) {

      // Determine if the fee is needed. If their are shippable items in the cart.
      $needs_fee = FALSE;
      foreach ($order->products as $pid => $product) {
        if ($product->shippable) {
          $needs_fee = TRUE;
        }
      }

      $line_items = uc_order_load_line_items($order);

      // Determine if the fee has already been applied.
      $has_fee = FALSE;
      foreach ($line_items as $key => $line_item) {
        if ($line_item['type'] == 'handling_fee') {
          $has_fee = $line_item['line_item_id'];
        }
      }

      // If the cart does not already have the fee and their are shippable items
      // add them.
      if ($has_fee === FALSE && $needs_fee) {
        uc_order_line_item_add($order->order_id, 'handling_fee', "Handling Fee", 9.95 , 5, null);
      }
      // If it has a fee and does not need one delete the fee line item.
      elseif ($has_fee !== FALSE && !$needs_fee) {
        uc_order_delete_line_item($has_fee);
      }
    }
  }
}


I managed to find the answer from an identical question at How to use [submission:values] in Email template in Webforms.

Using the webform-submissions.tpl.php template I changed the output structure from:

NameName value

to:

Name

Name Value

Using the code below:

<?php
if ($format == 'html') {
    $output = drupal_render_children($renderable);
    $output = preg_replace('//', '
', $output);
    $output = str_replace(' ', ':

', $output);
    $output = str_replace('
', '

', $output);
    print $output;
}
?>

Now the styling in my Outlook emails look much better :)


You might be looking for Node Block module.

With this module you can make your block fieldable, like your content-types.

  This module allows you to specify content type(s) as being a block.
  This allows the content managers of the site to edit the block text
  and title without having to access the block administration page.
  Users only need edit access to that node in order to edit it.

Check out this quick Demo Video


How to get value from form field in rule?

You have to use - %value[key] means - enter filed key name, for example: %value['first_name']. You will find this key name by following steps:

Go to webform -> Form components -> edit -> you can find the entered "field key" value.


How do I use .htaccess to trigger mod_rewrites before D7's Clean URLs take over?

Personally, I would see if the Redirect module works for your needs.  Is it basically a UI interface for making 301 redirects.  Off the top of my head, though, I don't recall if it will work with patterns.

If that doesn't work, then your best bet is to put them in the .htaccess right after the

# RewriteBase /

line.

Just remember that mod_rewrite will continue to process rules unless you use the L flag.  You also want to explicitly give the response code with the R flag.  Something like this should work

# RewriteBase /

RewriteRule ^some/path/(.*) /other/place/$1 [R=301,L]
RewriteRule ^another/hierarchy/(.*) /different/thing/$1 [R=301,L]

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

Keep in mind that rewrites can be frustratingly hard to debug, but logging can help.  Also make sure you are using rewrites and not redirects.  Mixing mod_rewrite and mod_alias in same .htaccess will cause all sorts of grief because of process order.


Custom Theming Bootsrap Carousel with Paragraph Type

Unless you need some very specific logic, I wouldn't use preprocessing, but use Drupal's template suggestions and Twig instead.

I always use Slick over CDN, adjust for your own needs if necessary. All filenames are relative to the base directory of your theme or module. Replace UPPERCASE_WORDS with corresponding machine names.

Create a library for your carousel:

MYTHEME.libaries.yml

carousel:
  version: 1.0.0
  js:
    https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js: {type: external, minified: true, defer: true, async: true}
    js/my_carousel.js: {}
  css:
    layout:
      https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick-theme.min.css: {type: external, minified: true}
      css/my_carousel.css: {}

js/my_carousel.js

behaviors are the drupalesque counterpart to jQuery's .ready() handler (e.g. even if your carousel is loaded inside a view with ajaxified paging, it will still trigger .slick() after every paging).

(function ($, Drupal) {
  Drupal.behaviors.myCarousel = {
    attach: function (context, settings) {
      $('[data-slick]', context).once('myCarousel').slick();
    }
  };
}(jQuery, Drupal));

templates/paragraph--CAROUSELCONTAINER.twig.html

The container template would be the place where you alter your slick options, e.g. if you have a integer field "Autoplay speed" on your container paragraph, you could add to my_carousel_options using paragraph.field_autoplay_speed.0.value

{% set my_carousel_options = '"autoplay": true' %}
{{ attach_library('MYTHEME/carousel') }}

  {{ content.FIELD_CONTAINING_SLIDES }}

templates/paragraph--CAROUSELSLIDE.twig.html

Here you can decide what to render on each individual slide

{# maybe you also need an additional wrapper
 around each invidiual slide #}

  {{ content.MY_IMAGE_FIELD }}
  {{ content.MY_TITLE_FIELD }}
  {{ content.MY_DESCRIPTION_FIELD }}

If necessary you can further adjust the HTML markup of your slide subfields using something like templates/field--paragraph--MY-DESCRIPTION-FIELD.html.twig

Optional:
If you want to get rid of some container
s around fields automatically rendered by Drupal, create a wrapper-less field template. E.g. I wanted to remove ALL
s and field labels rendered by any paragraph host field:
(this is global for every paragraph host field, change it to a template suggestion matching only your carousel if you don't want this)

field--entity-reference-revisions.html.twig

{% for item in items %}
  {{ item.content }}
{% endfor %}

Finally create your own CSS styles for your carousel in css/my_carousel.css and rebuild the cache so Drupal discovers your new template files.

This basically is how I'm creating carousels on every of my projects. Not tested with Bootstrap theme though, this is some sort of general purpose tutorial.


How can I get a display name from the view ID and display ID?

After reading throug the docs (https://api.drupal.org/api/drupal/core!modules!views!src!ViewExecutable.php/class/ViewExecutable/8), I tried the following (which worked):

$view = \Drupal\views\Views::getView('your_view_id');
$view->setDisplay('your_display_id');
$displayObj = $view->getDisplay();
//$displayPluginTitle = $displayObj->pluginTitle()->render();
//$displayTitle = $displayObj->getOption('title');
$displayName = $displayObj->display['display_title'];

N.B.1: I use the render function on a TranslatableMarkup object, this is what the pluginTitle function returns. It could be possible to use other functions there, like, e.g. getUntranslatedString
N.B.2: I misunderstood the OP. :-) Commented out the faulty part of the code, which returns the display plugin's title, and not the display's title as requested.
N.B.3: I misunderstood the OP. AGAIN! :-) Commented out the faulty part of the code, which returns the title of the display, and not the display's name as requested. To my defense, that property is labeled 'Display name' and its name 'display_title' (as was mentioned in the OP).

Screenshot from Views example:

And a test script that gets the title of the display (with the output):

Cheers!


How to add link to my module in the Structure admin page

You would need to specify a url that beggins with /admin/structure for that matter (Drupal 7).


how do I get Rounded Corners to work on a ddblock in drupal 7?

I've used ddblock before with round corners.   I was able to do it all, across every browser, with the csspie module.

But atlas you are using CurvyCorners. With this demo, they are only using

.myBox {
    ....
    border: 3px solid #FFFFFF;
    border-radius: 20px 20px 20px 20px;
    ...
}

nothing to do with o-border, webkit-border, khtml-border, -moz-border, border-top-right etc.  half of these are browser specific  (ie -moz-border is for firefox only).


Cannot use string offset as an array in includes\form.inc on line 3575

Deleting the module folder outright, without uninstalling it through the UI/Drush (even manually in the DB) is bound to cause a few problems.

To get rid of any errors caused by Drupal thinking the module files are still there, you can simply delete the row in the system table which corresponds to the relevant module; but make a database backup first, of course.

In case you haven't come across the pages before, you can disable modules at http://mysite.com/admin/modules and uninstall them at http://mysite.com/admin/modules/uninstall through the UI, or use Drush.


How to reset form values when Ajax submits?

You can try the code below

$response->addCommand(new InvokeCommand('#form-id','trigger',['reset']));

  The 'invoke' command will instruct the client to invoke the given jQuery method with the supplied arguments on the elements matched by the given selector. Intended for simple jQuery commands, such as attr(), addClass(), removeClass(), toggleClass(), etc.

This command is implemented by Drupal.AjaxCommands.prototype.invoke() defined in misc/ajax.js

Please see InvokeCommand


Creating custom settings/variables for site

To save custom configuration you probably want to use ConfigFormBase, the code would look something like this.

class SocialSettingsForm extends ConfigFormBase {
  ...

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'social.settings', // The name of the config you want to edit
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->config('social.settings')
      ->set('facebook', $form_state->getValue('facebook'));
  }
}

Then everywhere, you can use the config factory of the Drupal global object to get the config like this.

function some_preprocess_function(&$variables) {
  $facebook = \Drupal::config('social.settings')->get('facebook', 'default_value_if_no_value_is_set');
}

Note the above approach is centered around how you would do it in a module, saving and getting configuration. You should also note that it's best practice to define the configuration a module provides in a yml file located in module_folder/config/schema/module_name.schema.yml. I'm not 100% sure what the file is actually used for, as it's possible to save configuration not defined in the config file and all other features seem to "work" just fine without it.


You can do this in jQuery, just get the url and then split as required.

$(document).ready(function() {
    var $url = window.location.pathname;
});