texts:
I have a content type 'school' and an entityform that's called 'contact'...

I would like the URL path for the contact form to be:

www.example.com/node/nid/contact

It's important that the node ID be passed in the link to the entityform in this format rather than:

www.mysite.com/eform/submit/contactform?some_custom_field=[nid]

so that people can share the contact form easily.

It's also important that the contact form be an entityform

Any pointers to set up my entityform url so that it reflects the NID of the content that linked to it?

I am trying to set up URL alias for the entityform but am having trouble setting up the NID as a wildcard.

  EDIT for my helper module I have...(we can ignore the entityform part of my question because I'll probably re-build the form) ... I am trying to get the letter generator to appear at /node/%node/lettergen but the %node wildcard isn't working ...

function lettergen_menu() {
$items = array();
$items['node/%node/lettergen'] = array(
'title' => 'Letter Generator',
'description' => 'Generate a Letter'
'load arguments' => array(1),
'page arguments' => array('lettergen_form', 1),
'access callback' => TRUE,
);
return $items;
}

  THIS WORKS

function lettergen_menu() {
$items['node/%node/lettergen'] = array(
'title' => 'Lettergen',
'description' => 'A form to mess around with.',
'page callback' => 'drupal_get_form',
'page arguments' => array('lettergen_form', 1),
'access callback' => TRUE,
);
return $items;
}


texts: "The website encountered an unexpected error. Please try again later." while trying to update

texts:
I'm not great a Drupal, but I was trying to install some updates.

I put my site in to maintenance mode.

Copied the entire directory for in to /var/www/html/backups/
Backed up the database with mysqldump -u <username> -p <site> > /var/www/html/<backup folder>/backup.sql

Then I cleared out everything in the web directory.
I downloaded the .tar.gz file from here, untarred it and copied it in to my website directory.

Finally I copied /sites, .htaccess, and robots.txt from my backup in to my website directory.

When I go to run update.php I get to the initial update page I click continue I get The website encountered an unexpected error. Please try again later.

At one point I was able to try to install updates and got the error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /update.php/start?id=37&op=do_nojs&op=do
StatusText: OK
ResponseText:

I even tried deleting everything from my website directory and just copying everything in my backup back in, but that doesn't seem to fix the problem. I can't even view /admin/reports/dblog to try and get more information as suggested by a different solution.

Does anyone have any suggestions or did I just totally screw myself over?


texts: Which modules should I add to Advanced Forum to provide increased functionality?

texts:
Drupal 6 Advanced Forum is very capable, but the basic installation doesn't offer many features. For example, by default there is no signature possible.

What modules/plugins/things do you recommend adding to provide a well rounded set of improved functionality in Advanced Forum?

For example, Apache Solr is meant to be a very good add-on to provide improved search functionality. There will surely be lots of other modules that you can think of that would be needed to provide some of the features that come as standard in 3rd party software. Which modules would you say are the most useful ones to have?

Edit:

One need of the forum is to support posting from a mailing list. It can do this already, but maybe there are nice features that can be added to improve this. Perhaps something that makes e-mail formatting look better in a forum, if that is necessary.

Anti-spam is important too. I don't know whether there is a single, catch all anti-spam module. Perhaps there are several modules that should be used here.

The forum is important for community building, so plugins that would help there, for example things that make profiles more informative.

I am interested in all sorts of good functionality. I would like to hear about plugins that people suggest because they are useful, even though I haven't referred to them in this post. That is what I am hoping for. I don't know what to look for / what good things to add.


texts: What replacement token to use for counting a specific content-type

texts:
I have a content type of 'partners', and I wanted to create a body text like 'Currently we are working with X partners'. I have token-filter working, but I cannot find a token that allows me to choose the content-type.

[content-type:node-count] Doesn't do anything.

[node:content-type:node-count] Returns the amount of the current type (basic page, not partner).

Is there some token that allows me to choose the content-type to work with? eg. something like [content-type:?:node-count] where I can enter my content-type of partner on the ? ?


texts: How can I display the author's profile with a particular view mode on a node using display suite

texts: I'd like to show the author's profile on a node. I'm not using Views to display a single node. That node would display through an altered display of the 'default' view mode using Display Suite. Now I see the fields: author, user picture. But the author field doesn't allow me to select a custom made display suite 'user view mode'. I only have the possibility to select "author linked to profile" or "author" for the settings.


texts: In views, Drupal 7, is there a way to display the total number of fields being displayed from one node?

texts:
I have one view outputting images with specific taxonomy term. These are all coming from different nodes. The image field is set to have unlimited values. Some nodes might have 2 images, some 3, you get the point. So what you have is one view displaying possibly 40 or so images. What I would like to output through views is 1 of 3, 2 of 3, etc. as text along with each image.

I already have the current image count using the :delta field, but what I'm missing is the total count.

So there may be 40 images on this page (they're in a slideshow) but I need the count based on the nodes the images are coming from, not the total being displayed by views. Hope this makes sense.

EDIT: Please let me clarify that I also am only trying to display the count of a specific field (image), not from all the fields (title, body, etc) that may be displaying.

I found the answer in this post

It's the top answer using the computed field module and the code in the comments. It didn't work for me at first so I abandoned it and asked this question. Eventually I went back to it and realized my issue. I had to re-save my node after I added the computed field to my content type. Without doing that it wouldn't display anything.


texts:
I'm trying to update my site using composer.

I was previously using the Composer Manager module, but I've removed this as it's no longer supported, and composer support is built into core.

I'm now getting an error with the Ctools module (though I suspect the problem lies with composer rather than Ctools):

# composer require "drupal/ctools ~3.0"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package drupal/ctools ~8.3.0-alpha21 is satisfiable by drupal/ctools[8.3.0-alpha27] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.

Copying my composer.json file below in case it offers any insights:

{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0+",
    "require": {
        "composer/installers": "^1.0.21",
        "wikimedia/composer-merge-plugin": "~1.3",
        "drupal/address": "~1.0",
        "symfony/intl": ">=1.0"
    },
    "replace": {
        "drupal/core": "~8.2",
        "drupal/entity": "8.*",
        "drupal/pathauto": "8.*",
        "drupal/simple-conreg": "8.*",
        "drupal/swiftmailer": "8.*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8"
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php."
        ],
        "installer-paths": {
            "modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ],
            "libraries/{$name}": [
                "type:drupal-library"
            ],
            "drush/{$name}": [
                "type:drupal-drush"
            ]
        },
        "merge-plugin": {
            "include": [
                "core/composer.json",
                "sites/all/modules/entity/composer.json",
                "sites/all/modules/pathauto/composer.json",
                "sites/pasgonreg.lostcarpark.com/modules/simple_conreg/composer.json",
                "sites/all/modules/swiftmailer/composer.json"
            ],
            "recurse": false,
            "replace": false,
            "merge-extra": false
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer",
            "Drupal\\composer_manager\\Composer\\": "/var/www/drupal/sites8/all/modules/composer_manager/src/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "drupal-rebuild": "Drupal\\composer_manager\\Composer\\Command::rebuild",
        "drupal-update": "Drupal\\composer_manager\\Composer\\Command::update"
    },
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    }
}

I'd really appreciate if anyone can offer any insights.

James


texts: Unable to index field in Search API settings in a commerce site

texts:
In my product display content type, I created a new image field and am aiming to show that in a view among other things. I after long research found out that I have to enable indexing of a field before I can use it in a view. However, this new field is nowhere to be found on Search API settings. Where else can I look?

Best,
mto


texts: How to programmatically replace a field label and content before rendering?

texts:
I expected to be able to do it with THEME_preprocess_field, but the data at that point seems to have only the content's markup and not the label. I would need an instance where I can change both, because there's some mutual conditioning between them.
I also tried with THEME_node_view to no effect.
Note: I want to do this in a theme, not a custom module.


texts: How do I upload a complete Drupal website?

texts: I have received a complete website template that I need to upload to Drupal. However, there seems to be files already at the root access. I have the full images, index, data base. Everything that needs to be uploaded.


texts: How do I create multiple translations of a panel page?  My homepage is designed with panels and I have both english and spanish content.  For nodes everything is fine but I can't figure out how to do the multiple language thing with panels.


texts: Delete from Multiple Tables using db_delete()

texts: How can we delete fields from multiple tables using db_delete() and INNER JOIN in Drupal 7?


texts: impossible to save source code in wysiwyg blocks if  does not contains some strings

texts:
It is impossible to use an icon as anchor  in wysiwyg blocks.

The content is lost when editing back a block

it only works for strings

 some text


texts: In Views, how to wrap a div around every specified number of items

texts:
I'm using D7, Views 3, and am playing around with using jQuery Cycle. What I would like to do is amend my view output so it's like in this example from the jQuery Cycle website:

I was hoping to use Semantic Views for this but I'm stuck on how to wrap the div class "slide" around every 3 items. Is it possible to do this? I only seem to be able to apply a div to every item and then apply the class to every 3rd item. Any help/guidance/tips much appreciated.


texts: How to call one file functions in other files in custom module?

texts:
I have created custom module in Drupal 7.

I want to create one file and in this file I want to create all functions that I need to use in this module. I want to call these functions in .module file. So for this what file and how can I use these functions?


texts: Way to log some datas in file during migration

texts:
I have many migrations to operate and I searching to log some datas in files depending conditions (for example, log every external links which no longer work for each imported content). I have many ideas but they're not optimal (not very clean or optimize) or I don't know how to implement them:

Open my file, log my datas and close it directly when it's necessary, via a custom process plugin during the migration. It's the more simple. The problem: Opening the file is consuming and on a migration where I can log many thousand links, I will do this each time, which will have an impact on the duration of my migration.
Via a subscriber, I can open my file before my migration via an eventSubscriber, and closed it when my migration is finished (always with the eventSubscriber). But in this case, I don't know how to use it during the migration. Other idea: I can save temporary my datas with State API and save it in the file when the migration is finished, then, delete the state (which seems the more proper for the moment).
I though to use a logger class implementation but I'm not sure how to define my file and how it works (I looked the file SysLog.php but I'm not sure to understand where I should open and close my file).

Any better way (or explanation for logger or access to my file after open it with an eventSubscriber).


texts:
I've got a quiz. There is a content type to create a question. I've added a textfield to it (which will show a link to where the user can find the answer).

When I look at the question itself the textfield has been added and is being displayed on the screen. But when the question is part of the quiz, the textfield isn't there anymore (not on the screen, nor in the code).

Who can help me?

Maybe I need to add some kind of hook to the Quiz module but I don't know how hooks/custom modules work.

Thanks in advance.


texts: How do I filter a menu to only show menu items translated into current language?

texts:
In my Drupal 8 project I have a menu containing menu items in english. Some of the items have a german translation. How do I filter the menu to only show the german items when viewing the site in german?

I'm currently using MenuLinkTree to fetch my menu and I have created my own MenuLinkTreeManipulator transform where I try to filter out MenuLinkContent items that does not have a translation in the current language. But the method for getting an entity from a MenuLinkContent object is protected, so I cannot access the language property of the underlying entity!

Is there some other way of finding out the language of a MenuLinkContent object? Or another way of filtering a menu by current language?

Edit:

Here is the method I'm currently using (as a transform) when getting the menu via the MenuLinkTree service:

public function currentLanguage($tree) {
  $lang = \Drupal::languageManager()->getCurrentLanguage()->getId();

  return array_filter($tree, function($item) use($lang) {
    return $item->link->getEntity()->language()->getId() === $lang;
  });
}

$item->link above is an instance of \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent. The above code does not work since $item->link->getEntity() is a protected method. If make it public the code above works. I see no way of accessing the underlying entity here without hacking core. Is it possible in any way? Is it possible to "swap" out this class for my own implementation in a custom module?


texts: Having trouble making Views treat external content as nodes/entities

texts:
I have created a module by customizing FlyViews module to fetch data from a third party API and render via a View. I have been successful in showing the data on a page but the data has merely one style, that is, fields. Now I want to render that content as nodes of a specific content type. That content type will be configured in the module's configuration page. Once I mention a content type, the content should be rendered as nodes of that type.

Even a hardcoded solution will work for me, but it would be nice if I could select the Show option (on Views configuration page) as Content, just as I can do for a regular View.

Edit

I have implemented the custom row plugin which is now visible in Views UI as Show option under Format. Selecting the option and saving shows the output from my plugin's render() method. This is as far as I could get without help. Any ideas how can I manipulate render() to actually render the external content as nodes/entities?


texts: Packing taxonomy fields into one div not from SQL?

texts:
I created 2 taxonomy entity-reference fields. One is Categories and one is Tags and some similar other fields.

In nodes, some of these taxonomy fields appear one above the other.

I want to give some padding-top and padding-bottom css code, not to each one - but to all together.

Yet, they don't sit inside a wrapping div and wrapping them through the SQL isn't quite comfortable, though I am not sure it's a minimalist/easy to supervise/safe solution.

Do you know a way to bias Drupal 8 to "pack" some of these into a div ? Maybe an intervention in the Twig could do that with some behavior-code?


texts: Qiuck tabs shifts the Openlayers map background layer

texts:
Im displaying the list of locations (address and map Openlayers + Geofield) using views. There is no problems when displaying view in ordinary way, but when the view is displayed inside quicktabs the background shifts about 100px in particular(top-left) direction from the place it should be.

Normal map display

Same location with shifted map background

Also, I noticed that after opening Developer tools in Chrome the grey zone without map disappears(fills up with map) and if you click on the map region the red point mark shifts back to the place where it should be.

Any ideas about how to fix this issue ?


texts:
I am new to drupal 8 however, I have experience in MVC pattern and used Django earlier. I want to create a page that points to localhost/home where I would like to show a slideshow from view slideshow module as well as some static contents like images, links, etc. If I were on django, I would simple redirect the parameters to display directly on template i.e something like HttpResponse(template.render(context, request)).

How do I do such thing is drupal 8? I have looked at lots of places and still cannot find anything. The solution that I have found till now is to create separate module for each page i.e home, about-us, etc. and route a Controller function. Is this the only approach? Please help. Thanks.


texts: Drupal 7 - div popup inside the overlay (node/123/edit)

texts:
I'm trying to display a pop up dialog (using a hidden block) inside the overlay when editing a node.

When i click to edit a node, the overlay appears with all the custom fields of a given content type as usual. It is clean and white and everything in the background is darkened out.

So now i have logic in place (using jQUery) that's supposed to change my div's display to 'show' on keyup for a specific field on top of the overlay edit node.

I've tried adding a z-index of over 1000 and still nothing. The drupal overlay is using a z-index of 501 but my custom div still wont display on top of/over it.

This is my CSS for the hidden block:

#block-block-block-26 {
  z-index: 2000 !important;
  position: fixed;
  display: none;
  text-align: center;
  border: 1px solid #333;
  width: 200px;
  height: 80px;
  border-radius: 5px;
  padding: 10px;
}

This is my function inside jQuery:

 $('#edit-field-pi-estimated-ini-capital-und-0-value').keyup(function() {
        var txtVal = this.value;
        if(txtVal == 0 && txtVal != '') {
          $('#block-block-block-26').show();
          return false;
        }
  });

any idea how to make my div appear over the overlay?

Thanks


texts: How to download bulma sass file an compile in order to change the primary font?

texts:
I'd like to change the primary font in Bulma as per https://stackoverflow.com/questions/64512940/setting-a-new-primary-font-family-with-bulma.
I've used composer to install libraries_provider
 composer require drupal/libraries_provider

Libraries provider is enabled
dr en -y libraries_provider

Looking at the libraries provider documentation and the drulma documentation I should add something to my theme libraries yml file.
At a rough guess as I can't find documentation on how to do this
bulma:
  libraries_provider:
  enabled: true
  source: https://asset-packagist.org
  npm_name: 'bulma'

Then I run
composer require npm-asset/bulma

Which does not work

Could not find a matching version of package npm-asset/bulma.

Then I set the variables in the sass file for the new font, which the stackoverflow question handles.
Finally, recompile the SASS file (what command is required?). Make sure the updated bulma CSS file is included in my theme and it is done.


texts: How do I check the access to every node?

texts:
I need a quick solution to restrict access to nodes based on the contents of field. I've built the skeleton of a module and managed to restrict access to a custom route.
Now, the service that redirects to access check is this:

services:
  access_check.untitled_check:
    class: Drupal\untitled\Access\UntitledAccessCheck
    tags:
      - { name: access_check, applies_to: _access_untitled_check }

This only applies to routes with _access_untitled_check in the requirements array.

How can I have all nodes  checked?
Can I add _access_untitled_check to nodes' requirements array?


texts: How do I add the tertiary level from the main menu to my skin?

texts:
Let's say I have the following menu:

Smartphones

Android

LG Nexus 4
Samsung Galaxy Note 2
HTC One
Motorola Droid RAZR MAXX HD

iOS

iPhone 4
iPhone 4S
iPhone 5

Windows Phone

HTC Windows Phone 8X
HTC Windows Phone 8S
Nokia Lumia 920
Nokia Lumia 820

I want a menu that will display all the third level items if I'm on the parent node.  So, if I'm on the Android page, I should see LG Nexus 4, Samsung Galaxy Note 2, HTC One, and Motorola Droid RAZR MAXX HD.

The only recommendation I keep seeing is to use the Menu block module, but I want to just create the menu myself in PHP.  How?


texts: Try to add in different views to a single page, keep getting "Error" message?

texts:
I have a panel where I'm pulling in 7 different views pages in different regions, and when I try and save it, I keep getting the same message-- "The website encountered an unexpected error. Please try again later."

So, I went to the specifics of the error and this is what it says:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'panel' at row 1: INSERT INTO {panels_pane} (did, panel, type, subtype, shown, access, configuration, cache, style, css, extras, position, locks, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => 41 [:db_insert_placeholder_1] => block_layout_row_2_col_2_row_1_region_1_ [:db_insert_placeholder_2] => views [:db_insert_placeholder_3] => review_entries [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => a:0:{} [:db_insert_placeholder_6] => a:15:{s:23:"override_pager_settings";i:1;s:9:"use_pager";i:0;s:14:"nodes_per_page";s:1:"5";s:8:"pager_id";s:1:"0";s:6:"offset";s:1:"0";s:9:"more_link";i:1;s:10:"feed_icons";i:0;s:10:"panel_args";i:0;s:12:"link_to_view";i:1;s:4:"args";s:0:"";s:3:"url";s:0:"";s:7:"display";s:7:"block_6";s:14:"override_title";i:0;s:19:"override_title_text";s:0:"";s:22:"override_title_heading";s:2:"h2";} [:db_insert_placeholder_7] => a:0:{} [:db_insert_placeholder_8] => a:1:{s:8:"settings";N;} [:db_insert_placeholder_9] => a:0:{} [:db_insert_placeholder_10] => a:0:{} [:db_insert_placeholder_11] => 0 [:db_insert_placeholder_12] => a:0:{} [:db_insert_placeholder_13] => cc38c8a0-a223-4b16-91ca-7426f802c8f8 ) in drupal_write_record() (line 7308 of /srv/bindings/2ed870ecae69481598cc782d3c4e9589/code/includes/common.inc).

Does anyone have any idea how to fix this?? Thanks!


texts: Drupal 7 how to use item menu as MENU_LOCAL_TASK and MENU_NORMAL_ITEM simultaneous?

texts:
I have hook_menu with 3 pages they are defined by default as MENU_NORMAL_ITEMs and I see them from in main menu:

$items['accounting'] = [
    'title' => 'Accounting',
    'page callback' => 'accounting_extras_unprocessed_page',
    'access arguments' => ['access accounting extras'],
    'file' => 'accounting.pages.inc',
    'type' => MENU_NORMAL_ITEM,
    'menu_name' => 'main-menu',
    'weight' => 10,
  ];

  $items['accounting/extras'] = [
    'title'   => 'Extras',
    'page callback' => 'accounting_extras_unprocessed_page',
    'access arguments' => ['access accounting extras'],
    'file' => 'accounting.pages.inc',
    'weight'  => 0,
    'menu_name' => 'main-menu',
  ];

  $items['accounting/report'] = [
    'title'            => 'Report',
    'page callback'    => 'drupal_get_form',
    'page arguments'   => ['accounting_report_form', 'report'],
    'access arguments' => ['access accounting report'],
    'file'             => 'forms/accounting_report.inc',
    'weight'           => 1,
    'menu_name'        => 'main-menu',
  ];

  $items['accounting/transfer'] = [
    'title'            => 'Internal transactions',
    'page callback'    => 'drupal_get_form',
    'page arguments'   => ['accounting_report_form', 'transfer'],
    'access arguments' => ['access accounting report'],
    'file'             => 'forms/accounting_report.inc',
    'weight'           => 2,
    'menu_name'        => 'main-menu',
  ];

But I also need to see them as MENU_LOCAL_TASK and if I add type = MENU_LOCAL_TASK then they disappear from menu and appear as local tasks

What to do to see them in both places? Thank you.


texts: multiple values of several fields grouped together

texts: I am using drupal 7 as a backend, in which I have a content type called conferences, and each conference has several events. I do not want to create another content type for events and would want to add them to the same content type as each event has only two fields the date and the venue. How can I achieve this using UI as CMS ? and then later be able to make API's to send the same. Please suggest modules to achieve the same


texts: SEO-friendly Views: How do I make contextual filters work together with exposed filter criteria?

texts:
I have substituted my frontpage with a view at http://example.com/frontpage.
I use it with two exposed filters: country and city. The current url format (http://example.com/frontpage?country=us&city=New York) is not too much SEO friendly.

What I would like to use is http://example.com/frontpage/us/New-York.

How do I do it with Views and Drupal 7?


texts: Why is smtp not sending emails via SendGrid?

texts:
I am attempting to add SendGrid to a Drupal 7 site. I have been following the offical sendgrid.com documentation for this, and following the instructions for using the smtp authentication support module. (https://sendgrid.com/docs/Integrate/Open_Source_Apps/drupal.html)

After installing and activating the smtp Authentication Support Module using drush (for which I used version 7.x-7.x-2.x-dev because of a bug with the default version), I was able to activate the module without error and follow the instructions in the documentation.

Going to configuration > System > SMTP Authentication Support

Turn the module on
Make sure Email delivery is turned on
Adding a provier witht eh name sendgrid
SMTP server: smtp.sendgrid.net
SMTP port 587
User encrypted Protocol: No
username and password for my sendgrid account
set email from address and email name
save configuration (which went through without error)

I then filled out a test email address and saved the configuration again.

I got a confirmation message that the settings were stored without error and that the test email had been sent.

I received the test email, but when I checked the headers on the email I received I can see that it has not arrived via SendGrid, but has come directly from my server. I can also see no activity on the SendGrid account at all.  I have repeated the test sending system emails linked to user signup and I get the same result, I receive the email but it does not come via SendGrid.

I have also tried using port 465 and SSL as the encryption protocol, but while the the test email reported to have worked, I received no emails at all with these settings.  Also as before no activity is logged in SendGrid.

Just to be thorough I tested my SendGrid account using telnet and was able to send an email using the same setting and account username and password used in drupal, including port number. The email was sent without issue, registered in SendGrid activity feed and the received email header references SendGrid.

I have gone as far as I can think of. Can anybody suggest where I might be going wrong?


texts: How to set up Apache Solr with facets so that it uses a front page search form?

texts:
So I am working on my first mid sized D7 projects and it needs some rather advanced searching capabilities (at least advanced for me). I've installed Solr, created a server and an index with the Search API, and created a search page.
So far so good... everything works according to what you'd expect, and it even has facets, which is something I really wanted for this site. The problem is that this seems to be pretty much my ceiling... and I would like to change some things. For instance:

I would like to be able to search through my indexed taxonomies. Right now I can only search the node titles and descriptions and I have a bunch of taxonomies which is what I really want to search through.
I would like the users to be able to search from a search form in my home. Right now the core search is all I have in my front page, and if I want to use the Solr server I have to go to my search page. Ideally I want the user to enter a search term in the search form, to be redirected to the results page, and just there for him to see all the facets to further filter the results... linkedin style.

How would you guys accomplish something like that?

Edit:

Seems it seems I haven't stated clearly what I intend to do I'll try to upload some pics regarding point 1:

admin/config/search/search_api/index/node_search/fields

These are the fields I choose to be indexed!

admin/config/search/search_api/page/search/edit

If you see I can only choose "Title" and "description" from the fields to search from... so if I search for a taxonomy term which is not in any title or description, I get nothing. I would like to make the taxonomies in the first picture searchable... which is why I indexed them in the first place.

Edit 2:

I've finally managed to get the core search form to work with Solr following this tut(http://web3us.com/drupal6/how-create-web-site-handbook/apache-solr-drupal/apache-solr-3-drupal-7-turtorial-screen-shots) but I still don't know how to display the fields I want in the search results. Right now the results look like this:

And I would like each of them to look as the Teasers I've configured in my "Restaurant" content type (which are the nodes that I've set Solr to index)


texts: How to use Token Replace only if the field has a value?

texts:
So I've been using token replace for a while now with great success in my themes.  For instance I'm using it currently to show the real name of an author by using

<?php print token_replace('[node:author:url]', array('node' => $node)); ?>">

The issue is that I've recently added a byline field in my storys and not all stories have a byline.  I've added it normally by using

<?php print token_replace('[node:field_byline]', array('node' => $node)); ?>

However when the field is empty it simply prints [node:field_byline] so I get stories like...

By: [node:field_byline]

Is there a way to check that the token field has something in it and only show that field if there's a value?  I'd like to just show nothing if there are now authors for the byline.  I tried using something like:

<? !empty [node:field_byline] ?>

but this hasnt worked.  Ideas?


texts:
I'm having trouble using Drush version 8 to pull down an instance of Drupal 7. I've tried variations of drush qd --core=7 d7_no, but all seem to fail.

  No release history was found for the requested project (7).
  Could not download requested project(s).

Also drush qd --core=7.x d7_no fails.

  No release history was found for the requested project (7.x).
  Could not download requested project(s).

What should I pass as --core?


texts: Reverting/updating "FILE_DISPLAY" in Features

texts: My site is running Drupal v7.30 and Features v7.x-2.2. I can't revert or update file_display components in features. There are additional definitions under the Default column that appear to be define by the Media (7.x-2.0-alpha3) module in hook_file_default_displays_alter(). How do I go about properly keeping my features not in a perpetual Overridden state?


texts: Using Migrate in Drupal 6, setup and parsing XML

texts:
Is there a better walkthrough to setting up Migrate than this documentation on Drupal.org? I have followed those directions, and I can't get my classes to show up in the UI. Is there anything clearer?

And how would I go about using Migrate, once it's set up, to parse a series of XML documents (one list XML that includes an additional document per node) into nodes which I can then manipulate in Views?

EDIT
Now I've gotten my XML read and fields set up (I think), but now I can't get the nodes to save. The import has the correct number of nodes, but they don't ever get imported. The wine examples in the documentation didn't say anything about using prepareRow() or anything when you are using XML. Where are my nodes? Can I pull out that data with Views even if nodes don't import? My end use for this is to arrange everything with Views.


texts: Which Foundation 6 files need to be uploaded to my host in order to make my Drupal 8 custom theme working with full capabilities

texts:
I installed Foundation 6 into my themes/custom/mytheme folder using foundation new. I get my starter kit, all good and ready to go.

I am not sure which files I need to upload to my host in order for my sites full capabilities.

I track my whole Drupal 8 website using Git.

With the installation of Foundation 6 there comes a .gitignore file. In this .gitignore file it ignores:

bower_components
node_modules
npm-debug.log
css

But when I want to commit my Foundation 6 custom theme to the server I need files inside bower_components folder? Or do I mis something here?

When you look at Foundation 6 example index.html they load:

bower_components/jquery/dist/jquery.js
bower_components/what-input/what-input.js
bower_components/foundation-sites/dist/foundation.js

What do I have to do with the Foundation .gitignore file exactly?
And which javascript files do I have to attach to have a good working Drupal 8 and Foundation 6 theme to start building my theme on?


texts: MySQL master/slave database replication?

texts:
Since it's so easy to set up pagodabox with multiple databases (for free), I thought I'd experiment with master/slave database setups.

I have good credentials for both MySQL databases. Everything should be fine and dandy.

The trouble is: At no point does Drupal create tables on the slave DB. I made a module to show me the credentials, and verify the connection, but the DB simply has no tables.

Should it? Is Drupal supposed to do this? Or do I need to do the initial replication myself?


texts: Newly created field not being added to entity

texts:
I have created a form that adds a subset of field types to an entity (does not support bundles).  (the reason for the custom form is that end users find the Drupal standard 'Manage fields' workflow too difficult)  The class extends FormBase.  When the 'submitForm' function is executed, the field is saved but not added to the entity.
This is the code to save a date field (with text values filled in for explanation purposes):
$field_storage_values = [
  'field_name' => 'field_test_date',
  'entity_type' => 'my_entity_id',
  'type' => 'datetime',
  'translatable' => TRUE,
];

$field_values = [
  'field_name' => 'field_test_date',
  'entity_type' => 'my_entity_id',
  'bundle' => 'my_entity_id',
  'label' => 'Test Date',
  'translatable' => FALSE,
];

$this->entityTypeManager->getStorage('field_storage_config')->create($field_storage_values)->save();
$field = $this->entityTypeManager->getStorage('field_config')->create($field_values);
$field->save();

When the form is submitted, the field is created correctly but not added to the entity.
When I export the field configuration to YML, the following appears under dependencies:
dependencies:
  config:
    - field.storage.my_entity_id.field_test_date

Creating an identical Node field results in the following field configuration YML dependencies:
dependencies:
  config:
    - field.storage.node.field_test_date
    - node.type.basic_page

I suspect the field created with my custom form should also add the second configuration dependency like:
my_entity_id.type.my_entity_id

I tried adding the following before the field is saved but the 'addDependency' function is protected.
$field->addDependency('config', 'my_entity_id.type.my_entity_id');


texts: How can I get the full content of a PHPUnit test truncated response?

texts:
I'm writing a Functional test (extending BrowserTestBase) for a Drupal REST resource.  My resource works fine in real life, but the test (running with --verbose and --debug options) throws a server error

...resulted in a '500 500 Service unavailable (with message)' response:
The website encountered an unexpected error. Please try again later.

Drupal\Component\P (truncated...)

This happens when I make the request, before I can try to catch it in an assertion.  I'm pretty sure that truncated output has the information I need to solve this, but I'm having no luck getting to it.  Drupal console docs say there's a test:run command but when I try that (v1.8.0), it tells me that's not a valid command name.  I've tried running my test through the debugger but no help there, either.

Is there any way I can get to see what's in the truncated part of the response?


texts: Have an exposed filter on a view be a list of US states

texts:
I would think this would be a pretty common thing, but I have a job board that I am exposing for users to search on. They can search by city and/or state so I exposed some filters on my view for city and state. Now, of course, plain text boxes work fine out of the box if I want the user to freely type in a state, but I really want it to be a dropdown of states. I see that I can do a "Grouped Filter" which allows me to specify some key|value pairs, but do I REALLY need to enter in all 50 states manually? Is there a way programatically to have the dropdown be a list of states? I also noticed that even if I DO specify a few values to test with like AZ|AZ, CA|CA, NV|NV, when I go to use the exposed filters instead of the URL being something like this:

http://sandbox/job-board?city=&state=AZ

it actually uses:

http://sandbox/job-board?city=&state=1

where there is a "1" instead of "AZ". I would really like to be able to pass "AZ" not a 1 in the URL because if I have other apps posting to the job search page, I don't want to have to map ID's to actual state values, I just want to pass in the state code. What's the best way to go about this?

THANKS


texts: Configuration management sync vs active vs staging

texts:
The documentation on config management talks about a CONFIG_SYNC_DIRECTORY setting, but then there is also mention of CONFIG_ACTIVE_DIRECTORY and CONFIG_STAGING_DIRECTORY setting throughout comments both on d.o and in stack overflow.

What are these two different setups about?


texts: Composer cannot find drupal/commerce in a specific module

texts:
I'm attempting to update the dependencies of a specific module in my site. I've downloaded the module with git and navigated inside. If I run composer validate it says ./composer.json is valid.
However if I run composer update or composer require drupal/commerce:2.16 I get the error :

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package drupal/commerce could not be found in any version, there may be a typo in the package name.
  Problem 2
    - The requested package drupal/search_api could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

I cannot figure out what is the legit issue here.
This is the current require of my composer.json

  "require": {
    "drupal/commerce": "~2.8",
    "drupal/search_api": "~1.9",
    "picqer/php-barcode-generator": "^0.2.2",
    "cboden/ratchet": "^0.4.1"
  }


texts: Can I make the second button in a form the default button?

texts:
I have a form in a custom Drupal 6 module built with the Form API, it has 1 or more image_button elements in a list followed by the Save and Cancel buttons.

Everything is working fine when clicking the image and standard buttons, they call the submit functions they should, but if I hit the [ENTER] key within any of the text fields in the form the first button in the form is submitted, which unfortunately in this case is an image_button in the list rather than the Save button.

This is a standard problem with web forms, you generally have to hack in a hidden (by style and/or size) button early in the form definition to ensure the default submit path is called (in this case that's what the Save button will call) rather than the submit path for the buttons that are before the button you want to be the default.

Is there some Drupal 6 magic that enables setting a default button regardless of where it is in the form definition that I've failed to find in the docs, or should I create a phantom submit button that is styled to not be visible?

Thanks in advance for any answers.


texts: How to test an alter hook in your .module with ModuleHandler service?

texts:
I have setup a kernel test to test a function in my module:

/**
 * Implements hook_link_alter().
 */
function mymodule_link_alter(&$variables) {
  // ... code
}

In my test, I tried:

$variables = [...array];
$this->container->get('module_handler')->invoke('mymodule', 'link_alter', $variables);

But what I got was:

  Parameter 1 to mymodule_link_alter() expected to be a reference, value given.

For now I removed that line and just called the function directly. Is there a way to invoke a hook that does not throw that error?


texts: How to move hidden fields of a form above other fields

texts:
When a form element is rendered in drupal, some hidden field are added inside the form tag, like bellow:

<form action="/example/unsubscribe" method="post" id="exampleform-unsubscribe" accept-charset="UTF-8">

      E-mail address *
      <input type="text" id="edit-email" name="email" value="" size="60" maxlength="128" class="form-text required" />

    <input type="submit" id="edit-submit" name="op" value="Remove me!" class="form-submit" /> <input type="hidden" name="form_build_id" value="formjKkl1KLWJLnv0hM4DSVd8-40boTgBQAzWWhUn44c15Q" />
    <input type="hidden" name="form_token" value="LB07DqsDXK9idWdOHLxUen7jKxm52JqTyHiR7-pNumA" />
    <input type="hidden" name="form_id" value="exampleform_unsubscribe" />

</form>

Is there any way to move all input tag with the "hidden" attribute above the other tags ?
This is the result I am expecting :

<form action="/example/unsubscribe" method="post" id="exampleform-unsubscribe" accept-charset="UTF-8">

         <input type="hidden" name="form_token" value="LB07DqsDXK9idWdOHLxUen7jKxm52JqTyHiR7-pNumA" />
    <input type="hidden" name="form_id" value="exampleform_unsubscribe" />

      E-mail address *
      <input type="text" id="edit-email" name="email" value="" size="60" maxlength="128" class="form-text required" />

    <input type="submit" id="edit-submit" name="op" value="Remove me!" class="form-submit" /> <input type="hidden" name="form_build_id" value="formjKkl1KLWJLnv0hM4DSVd8-40boTgBQAzWWhUn44c15Q" />

</form>

I tried to do that by setting weight for "form_token" and "form_id", but it doesn't have any effect.


texts: Automatic alias overriding manual alias on each edit

texts:
Does anyone have an issue with Automatic alias, where the setting keeps turning back to auto on each edit of a node?

What we would like to achieve is

a) some node paths should be generated automatically from the title and remain automatically managed

b) for other paths we want to override the alias

The problem is only with b, where after any edit to the node the alias behavior reverts back to a.

How to get desired behavior?


texts: Calendar + Custom Table + Add views from template

texts:
My custom table has 5 datetime columns.

I am able to create Calendar view using 3 of those columns but 2 of those columns are not listed in "Add view from template" list.

I have no idea why Calendar module is leaving these 2 columns out from "Add view from template" list. Any thoughts ?


texts: How to remove (not verified) status in anonymous comments?

texts: If I allow users to comment while they are not logged in (anonymous authors), they will have a 'not verified' tag next to their name in the comments of my site. How can I remove it?


texts:
I'm using custom search module in my site. What I want to do is set a value for the input (text box) in the username and password field.
How can I do that?


texts: I have the CKEditor module installed, and it has a place to configure the allowed tags, but the list of allowed tags that you are allowed to... allow is very anemic. Is there a way to stop it from stripping  tags (or any other tag for that matter)?


texts: How do I programmatically change the user ID in a order?

texts:
I programmatically created a user using the following code.

use Drupal\user\Entity\User;

/**
 * Helper function to create a new user.
 */
function create_new_user() {
  $user = User::create();
  $user->setPassword('<password>');
  $user->enforceIsNew();
  $user->setEmail('<email>');
  $user->setUsername('<username>');
  $user->save();
  drupal_set_message("User with uid " . $user->id() . " saved!\n");
}

Now I need to set the ID of the created user into an order.

I've loaded the order using the following code.

$ord_id = 10;
$order = \Drupal::entityTypeManager()->getStorage('commerce_order')->load($ord_id);

I want to update the user ID of this order. How can I achieve this?


texts:
Programmatically, in Drupal 8, how can I retrieve a list of all entity reference fields including label and machine name?

I have tried the entity manager service, but it only produces a list of keys without their label, and it is reported to be deprecated.


texts:
I need an array of all blocks in the site

For example, if I display the array, it should output the block info or block titles e.g Search, User etc


texts: How can I use HTML in a field of paragraphs module

texts:
I am using the paragraphs module. And I add a text field (plain,long). In this field I want to add e.g.

After rendering the output in browser is in quotation marks like this

""

How can I avoid it?


texts: Would replacing hooks with events be a good practice?

texts:
Do you think it would be a good practice to replace hooks with events? I mean dispatching an event inside a hook to subscribe afterwards.

For example if you have 20 hooks in your module, is it recommended to dispatch an event for each hook, or just keep using the hooks as usual?

/**
 * Implements hook_ENTITY_TYPE_insert().
 */
function my_module_node_insert(EntityInterface $entity) {
  // Dispatch the node insert event so that subscribers can act accordingly.
  \Drupal::service('event_dispatcher')->dispatch(NodeInsertEvent::NODE_INSERT, new NodeInsertEvent($entity));
}


texts: Allowing users to create calculated views

texts:
I am using Views 3 and I was able to do some math on the fields using the "Views Custom Field" module that was recommended to me.

It works perfectly and does exactly what I want it to do, but my problem is that I need to grant access to users to create views and calculations on them.  Views custom field is not really a math only field, it's basically allowing them to execute PHP code directly on my site, which I suspect is dangerous.

Also, another requirement is that they are not directly modifying the actual data, but creating a view for themselves(or to share) that derived from this data. That means the view they create must somehow be connected to their ID and not modify the master data.

I don't know if it is the best approach, but I was thinking of using something like phpexcel and exposing the tables so they can link to certain data; it seems complicated for me and even more complicated for the users.

How would you approach this?


texts:
I just want to remove a secondary menu local task from a preprocess function such as

function mymodule_preprocess_menu_local_tasks(&$vars, $hooks) {
    $vars['secondary'] = '';
}

I'm using D7, sky theme for front-end and seven theme for admin.
The above code works in seven but not in sky.

The sky theme page.tpl.php has a variable $secondary_local_tasks which I might be able to remove from hook_preprocess_page(). I also tried this :

function mymodule_preprocess_page(&$vars, $hooks) {
    $vars['secondary_local_tasks'] = '';
    unset($vars['tabs']['#secondary']);
}

My hook is invoked correctly, but the secondary local task is still rendered to the template. Where local tasks are prepared to be rendered after my hook ?


texts: Undefined variable block...when trying to integrate a form into a block

texts:
i was just beginning to build my first module which should display a checkbox in a block.

With this code (see below) I get an Error:
Notice: Undefined variable: block in ios_lang_checkbox_block_view()

<?php
function ios_lang_checkbox_menu() {
    $items['ios'] = array(
        'title' => 'View the sample form',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('ios_lang_checkbox_nameform'),
        'access callback' => TRUE,
        'type' => MENU_NORMAL_ITEM
    );
    return $items;
}

/**
 * Define a form.
 */
function ios_lang_checkbox_nameform() {
    $options = array(
        'de' => t('de'),
        );
    $form['ios'] = array(
        '#title' => t('Your Name'),
        '#type' => 'checkboxes',
        '#description' => t('Choose language'),
        '#options' => $options,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit')
    );
    return $form;
}
function ios_lang_checkbox_block_view($delta='')
{
  switch($delta) {
    case 'ios_lang_checkbox':
      $block['subject'] = null; // Most forms don't have a subject
      $block['content'] = drupal_get_form('ios_lang_checkbox_form_function');
      break;
   }
   return $block;
 }

?>

Any help with that?


texts:
I don't seem to see an ability to add tax to an order when it's created by admin through Store->Orders->Create Order. Can this be somehow configured?

I have it working on a standard checkout for a frontend user, it depends on the billing address entered. I'd like to have the same for when order is created 'manually'


texts: Views sort criteria by term for advertising

texts:
I have view displaying 3 types of content with, one of the filter criteria is taxonomy term for city.

I would like to give user option to pay to be first on the list for a specific city(term), and afterwards the results would go as usual (sorted by date of creation).


texts: Form select type: setting default based on options' value

texts:
So I've got this form:

$form['color'] = array(
        '#type' => 'select',
        '#title' => t('Kleur'),
        '#options' => array(
            0 => t('Wit'),
            1 => t('Geel'),
            2 => t('Groen'),
            3 => t('Rood'),
        ),
        '#default_value' => 'Rood',
  );

As expected, this doesn't currently set the default value to 'Rood'. How would I get it so that the default value can be accessed by it's value?

Note that this example shows the string 'Rood', but in practice it would be a variable string that is pulled from the database.

Thanks in advance!


texts: Count entitys dependent om field value and as entity reference

texts:
I have two node types, Apartment and Building.

Apartment has two fields:
- "Building" a Entity Reference field that reference to the node type Building
- "Rooms" a Text List with values 1 room, 2 rooms, 3 rooms etc...

I want to have a View, that lists all Buildings and under each Building it displays how many Apartments WITH specific amount of rooms. Like this:

Building 1
1 x 1 room apartment
5 x 2 rooms apartment
6 x 3 rooms apartment

Building 2
7 x 1 room apartment
3 x 2 rooms apartment
2 x 3 rooms apartment

Is this possible to do with Views, and then HOW to do it?


texts: Why can't anonymous users vote more than once from different browsers/machines?

texts:
I created a poll in a Drupal 8 site and I enabled anonymous voting too, but when opening the pool in different browsers/machines, the poll results appear and anonymous users cannot vote.
Please tell me where the issue is.


texts: How to get user data when I provide the uid or username - Services

texts:
I am using postman.
I want to provide the username or uid and fetch the user's information.
What should be the URL.


texts: Dependency inject a class with values from a config object?

texts:
Is it possible to DI dependencies in Drupal 8 but initialize it with values from a config object?

For example, SoapClient requires specifying the WSDL when called. I have different WSDL URLs depending on what environment I am using (test/prod etc).

I know you can do this from the services yaml file, but I have not read of a way where you can reference a value or value(s) from a config object.

My ultimate goal is to create a decorator or factory for SoapClient, but I'm not sure which.

edit: updated with code.

An interface:

<?php

namespace Drupal\iana_netforum_auth\Factory;

use SoapClient;

interface SoapClientFactoryInterface {

  /**
   * Create a SoapClient.
   *
   * This method should prepopulate the SoapClient with values from our
   * module configuration so it is ready to use.
   *
   * @return SoapClient
   */
  public function create() : SoapClient;

}

The factory:

<?php

namespace Drupal\iana_netforum_auth\Factory;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\iana_netforum_auth\Exception\NetforumException;
use SoapClient;

class SoapClientFactory implements SoapClientFactoryInterface {

  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->configFactory = $config_factory;
  }

  public function create() : SoapClient {
    $config = $this->configFactory->get('iana_netforum_auth.settings');
    $arguments = [];

    try {
      if ($config->get('mode') == 'live') {
        $endpoint = $config->get('live_endpoint');
      }
      else {
        $endpoint = $config->get('dev_endpoint');
        $arguments = [
          'trace' => $config->get('enable_trace'),
          'exceptions' => $config->get('enable_exceptions')
        ];
      }

      return new SoapClient($endpoint, $arguments);
    }
    catch (SoapFault $error) {
      throw new NetforumException('Invalid WSDL endpoint specified.');
    }
  }

}

The class:

class NetforumClient implements NetforumClientInterface {

  protected $username;
  protected $password;
  protected $token;
  protected $authorizationHeaders;

  /**
   * Drupal\Core\Config\ConfigFactoryInterface definition.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Drupal\iana_netforum_auth\Factory\SoapClientFactoryInterface definition.
   *
   * @var \Drupal\iana_netforum_auth\Factory\SoapClientFactoryInterface
   */
  protected $soapClient;

  /**
   * Class constructor.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   An instance of ConfigFactoryInterface.
   * @param \Drupal\iana_netforum_auth\Factory\SoapClientFactoryInterface $soap_client_factory
   *   An instance of SoapClientFactoryInterface.
   */
  public function __construct(ConfigFactoryInterface $config_factory, SoapClientFactoryInterface $soap_client_factory) {
    $this->configFactory = $config_factory;
    $this->soapClient = $soap_client_factory->create();
  }


texts: how to check whether an error occurs due to a specific field in drupal?

texts:
Inside a validate function how can I disallow errors for a specific field and allow errors for a specific field.
Like if I get errors for a field_abc I would like to clear that specific error and allow the form to submit.
But if I get error for a field_def I would like to restrict the submission.


texts:
Sometimes when I run below code in the hook_preprocess_menu() of a node, I am getting a previously loaded node instead of my current node.

\Drupal::routeMatch()->getParameter('node');

What should I do to stop this?


texts: hook_ENTITY_TYPE_view() only fires once on cache rebuild?

texts:
When implementing hook_ENTITY_TYPE_view() for nodes, I notice the following behaviour:

Cache rebuild
Navigate to node/1 // Message 'Node viewed!' displays
Navigate to node/2 // Message 'Node viewed!' displays
Navigate to node/1 // No message
Navigate to node/2 // No message
Cache rebuild
Navigate to node/1 // Message 'Node viewed!' displays

My code:

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;

/**
 * Implements hook_ENTITY_TYPE_view() for node entities.
 */
function sitelog_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {
    drupal_set_message(t('Test result: @result', array('@result' => 'Node viewed!')));
}

Is this the intended behaviour (it doesn't fire every time an entity is viewed) of hook_ENTITY_TYPE_view()?


texts: Webform component email does not follow other form formatting

texts:
I implemented a webform with an email component which does not follow the regular formatting set up for forms.

It does not put the label above the field (despite it being requested in the settings).
The field is not in the same colour or length than the others.

Is there a clean way to correct this? I need to add that I am picking up from a colleague who left, so trying to figure this out by myself!

PS: I also have the same problem with a term reference field which uses autocomplete deluxe widget in a regular node form. I am guessing the solution will be similar.


texts: How can I return data from ctools modal to parent form

texts:
Let's say I have a Drupal form with a "Open popup" button and a text field. If user clicks on the button, I'd like to open ctools modal popup with two buttons (#3 and #4). Clicking on any button in the popup should close it and set a text value in a form (i.e. button #3/button #4 was clicked). What's the proper way to implement this functionality?

I know how to open a popup:

$form['popup_result'] = array(
  '#type' => 'textfield',
  '#title' => t('Subject'),
  '#default_value' => $node->title,
  '#size' => 60,
  '#maxlength' => 128,
  '#required' => TRUE,
);

$form['popup_button'] = array(
  '#prefix' => '

',
  '#type' => 'button',
  '#value' => t('Open popup'),
  '#weight' => 3,
  '#ajax' => array(
    'wrapper' => 'popup',
    'callback' => 'mymodule_popup_function'
  )
);

and how to set a popup contents:

function mymodule_popup_function($form, &$form_state) {
  ctools_include('modal');
  ctools_include('ajax');
  ctools_modal_add_js();

  $commands = array();
  $commands[] = ctools_modal_command_display('Title', 'Contents');
  print ajax_render($commands);
  exit;
}

but I have no idea how to render buttons in the popup and populate a value in popup_result textfield.


texts:
I have two sites, built in tanden but launched at completely separate points.

Both of them need access all content from both sites in some form, so that for example auto-completing references can be used across the two sites. For sake of brevity, I suggest exactly how that is done is kept out of this question.

The real difference between the sites, is that

One domain shows content types W and X, while the other domain shows Y and Z, they
Each domain has a completely separate front page.

How would you go about solving the above two problems?


texts: Date Validation according to different type

texts:
I met a problem when create a new content.

I created a content type, it has a field named Type, this field have two values.
When select "normal", another field Date will be hidden. When select "renewal", another field Date will display.

Now I want to compare start date and end date before save this content.
On one way, I used field validation, but it always give warning for both "normal" and "renewal".

On the other, I add new rules to compare the date, but it gives warning always after saved the content.

Anyone could help me to solve this problem? very appreciate for this.


texts: Block wrapping DIV disable with theme hook?

texts:
I've managed to suppress the wrapping markup for a few blocks using

block--block--1.tpl.php
region--banner.tpl.php

but now it's getting messy as I have several blocks which require no additional wrpaping markup so I would ideally like to do this in a theme function with a switch case...but can't find any example that works...

function front_preprocess_block(&$vars, $hook) {

$to_delete = array('block-block-4');

//if(in_array($vars['block']->delta , $to_delete)) {
//  $vars['template_files'][0] = 'block-empty';
//}

print_r($vars);

}

I need to remove wrppaing DIV's for about 4 blocks onlys...ideas???


texts: How to add multiple forums for a single site in Drupal

texts:
I am working on a client portal and client needs multiple forums for the site based on the user priviledges.

e.g.

  www.example.com/forum1

  www.example.com/forum2

  www.example.com/forum3

Is it possible to create multiple forums in Drupal? If yes, any reference or steps please.


texts: Why does core use print rather than echo?

texts:
I've read somewhere, and I don't remember where, that echo is a more efficient way of outputting data then print.

Why does Drupal core use print so much? Is there any special reason behind that?


texts: A block created with Views is not rendered if the page URL contains "page="

texts:
I have an odd problem. I'm using Drupal 7 and an Omega subtheme. Within Views, I have a block defined and it works great - appears where it's supposed to all over the site - except when the URL has a "?page=" in it. Some possibly relevant info: clean_urls and pathauto enabled, Delta and Layout installed but no Deltas defined.

I discovered this when I created a page View (of a different content-type) that features the pager to scroll through the results. When using the pager it appends "?page=1", "?page=2", etc to the URL. I think it does it by default and from what I've read it seems to be difficult to change this. I could probably put up with the non-clean URLs but the bigger issue now is trying to work out why this results in my first view block not being rendered. I've tested it out by navigating to random pages on the site and appending the "?page=" to the URl and it's always the same result - the block view's not displayed.

Do you have any idea, or any pointer to where I should start looking?


texts:
I am looking for a good theme or module in which users can set up their own profiles on the page. I want them to fill out a form, so that their profile answers my questions, and I want to be able to approve their page first. Also, I would like to be able to grant other people admin rights to just some of the (geographic) profile pages; so that they may approve them. Is this possible?

In addition, I would need the answers from the forms to be transferred to a database so that people can find the profiles with specific answers. Also the profiles (after checking specific tags should be placed on the pages of these tags, when approved.

All quite complex and I am not sure if Drupal can help?


texts: LDAP Feeds example not importing new users - Undefined index: count in FeedsLdapEntryParser

texts:
I followed the LDAP Feeds example from the documentation and the query test returns the user fields just fine, but after launching the cron job manually I get "There are no new users." + notice:

  "Notice: Undefined index: count in FeedsLdapEntryParser->parse() (line
  20 of
  /var/www/html/drupal/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc).
  LDAP Users Imported Successfully."

I triple checked my configurations, as well as the mapping which got unique targets for both User name (name) and mail. I also posted in the drupal module issue as I would think importing users via LDAP is a very much needed function.

Has anybody been successful importing that way or any idea why the count is making issues?

FYI my LDAP Query Results: count=1574. Could it be limited to certain amount of user entries?


texts: Can't retrieve POST parameters in Webform

texts:
This post is the continuation of this question : Form isn't sending POST parameters?

I now have difficulties to retrieve my parameters in a Webform. In Chrome, I can see that my parameter is sent but the POST header have a "302 Moved Temporarily" status

In my webform I try to get my parameter with %post[email] but it don't works

Here is my code using the Form API in a custom module (see my old post for more informations)

function gn_ot_block_contact_newsletter_form()
{
  $form = array();

  $link_newsletter = drupal_get_path_alias('node/'.variable_get('gn_ot_webform_newsletter_default_nid', ''), $language->language);
  if(strstr($path_newsletter, 'node/') !== FALSE){
    $link_newsletter = drupal_get_path_alias('node/'.variable_get('gn_ot_webform_newsletter_default_nid', ''), 'fr');
  }

  $form['#action'] = base_path() . $link_newsletter;
  $form['description'] = array(
    '#type' => 'item',
    '#title' => t('INSCRIVEZ-VOUS A LA NEWSLETTER !')
  );
  $form['email'] = array(
    '#type' => 'textfield',
    '#default_value' => t('Votre adresse e-mail')
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('OK'),
  );

  return ($form);
}

I'm using Drupal 6.25. Thank you if you have any advice !


texts: Is the module Menu translation necessary at all?

texts:
I am developing a Drupal 7 multidomain - multilanguage site. I have installed Menu Translation module, but it is a nightmare to have dozens of items. But, in fact, it is not necessary at all. You can create menu in original language, and then use t() in a module to get all the text strings translated on the fly. Even you can have a very simple module in which you extract all the items in the menus.

Sincerely, I would have preferred to handle the site in that way, now there is no come back and it is a nightmare of a management.


texts:
I'm working on a project that involves multi-sites in Drupal 8. The client specifically wants  to have shared user accounts across all 4-5 sites. As of now the sites share a codebase but not a shared database. After researching I came across the CAS module. Can CAS allow for multiple logins? When one account is made can other accounts be generated in the other 3-4 Drupal sites? Is there a better way to do this in Drupal 8? Also, the client eventually wants to have paid account registries. For example, a user would pay on one site and get access to all 4-5 sites. IS there any guidance for accomplishing this? If not with CAS what other modules / resources would I need to make this doable in Drupal 8?

So far I've seen sites that offer advice on this but largely with Drupal 7 with out a clear path for doing this in Drupal 8. CAS seemed the most stable option but not sure if it will work. There was also the option of sharing users through shared tables, though this was discouraged in the forums I read. What is the best / proper way to do this in Drupal 8? Or should I go back to Drupal 7?


texts: Context.module fires blocks on access denied pages. How do I stop this?

texts: The context.module fires block regions on the access denied page if the condition for the context is path. I don't have much of a choice in triggers other than path for these pages. How to do I disable the side blocks? Is doing a page redirect to a custom 403 page a better idea?


texts: Delete a node after X weeks it was created

texts: How  can I delete a node after, for example, 2 weeks it has been created?


texts: Renaming a content type during migration

texts:
I am migrating a Drupal 6 site to Drupal 8. On the Drupal 6 site I have a content type called book_page but would like it be called faq on the new site.

I set the default_bundle to faq in my yml file but it still migrates as book_page.

Here is my yml file:

uuid: a67dbd6f-416c-44c0-9698-05ec3bb3c5a9
langcode: en
status: true
dependencies: {  }
id: upgrade_d6_node_book_page
migration_tags:
  - 'Drupal 6'
migration_group: d6_migrate_group
label: 'Nodes (book_page)'
source:
  plugin: d6_node
  node_type: book_page
process:
  nid: tnid
  vid: vid
  langcode:
    plugin: default_value
    source: language
    default_value: und
  title: title
  uid: node_uid
  status: status
  created: created
  changed: changed
  promote: promote
  sticky: sticky
  body/format:
    plugin: migration
    migration: upgrade_d6_filter_format
    source: format
  body/value: body
  body/summary: teaser
  revision_uid: revision_uid
  revision_log: log
  revision_timestamp: timestamp
  field_image:
    plugin: d6_cck_file
    source: field_image
  field_upload_files:
    plugin: d6_cck_file
    source: field_upload_files
destination:
  plugin: 'entity:node'
  default_bundle: faq
migration_dependencies:
  required:
    - upgrade_d6_user
    - upgrade_d6_node_type
    - upgrade_d6_node_settings
    - upgrade_d6_filter_format
  optional:
    - upgrade_d6_field_instance_widget_settings
    - upgrade_d6_field_formatter_settings
    - upgrade_d6_upload_field_instance

Anyone have an idea what I am doing wrong?

Update:

I have also tried adding the following under process under each of my node yml files?:

type:
  plugin: default_value
  value: faq

I wonder if the All node types are created in ....node_type.yml?


texts: Execute Javascript when the registration form is completed

texts:
I am running Facebook advertising campaign for my site. The below code needs to be executed when registration is completed.
How can I achieve this?

<script>
// Track when a registration form is completed (ex. complete subscription, sign up for a service)
fbq('track', 'CompleteRegistration');
</script>


texts: How to get the URL addresses of all the photos on form

texts: I have standard input form for custom content (for example, /node/add/page and /node/%/edit) with image-field in which you can upload multiple photos. How to get the full URL addresses of all the photos when user add new content or editing old one (delete or upload extra photos)?


texts: How to remove duplicate nodes in a view with taxonomy relationship (1 node per term)?

texts:
I have a fairly straightforward view. Ie. Display nodes that are published & of content type X. Then sort by date.

It does however, have a relationship to a Vocabulary so that I can get access to the taxonomy image to display.

The result is a view that displays duplicate nodes if there is more than one taxonomy term of that vocab tagged on it.

How can I remove these duplicates?

I've tried the Query settings Distinct/Pure Distinct to no avail.

I'm also looking at this, but I'm hoping for a different solution.
Views relationship outputting duplicate nodes?

Update I had seen the Views distinct module (suggested in an answer now) and should have added it to the possible solutions. I'm still hoping for a "I just didn't know how to configure the view properly" kind of solution, as it feels like there must be a way to do this in Views instead of adding another module.


texts: Why semaphore table is not using MEMORY as storage engine?

texts:
Drupal's table "semaphore" is using MyISAM (Drupal 6). I was wondering why it's not using MEMORY as storage engine?
The only thing that I could think of is that Drupal needs locking/semaphore data after MySQL restart. But the point with semaphore is that it should not have important data...

Am I missing something?


texts: Circumventing Drupal's Cache for New Content

texts:
We like to post updates to Facebook and Twitter when publishing new content. We are running into a problem, however, in that anonymous users will get the "Access Denied" page until the cache recycles to show them the new content.

Currently, we're caching pages for anonymous users for three minutes. How do we keep our cache, yet allow anonymous users to see new content immediately as it's published?

For what it's worth, we are not using Memcache, Varnish or anything outside of the standard Drupal page caching.


texts: How to display date and time inside a form #markup?

texts:
I want to retrive a UNIX epoch (as returned by the PHP function time()) and display it as a formatted date as part of a text (i.e. a #markup element) in a form.  This is not a field where the user is supposed to enter a date. It is just showing the current date and time in a human readable format inside the form.

Is know that I can get a human readable date and time from a Unix epoch with the PHP date() function.

However, I am looking for the "Drupal" way of doing this. I think this means that I should display the date and time in the short format set by the site manager under Home » Administration » Configuration » Regional and language.

Is there a way to do this (or is there another way that is condidered "the Drupal way")?

Edit: Function format_date()  turned out to be the right answer.  It depends on a set of format variables (e.g. date_format_short) being set.  If this variable is undefined, you only get the US-centric formats hard-coded into format_date().  The confusing bit is that when you visit the  Home » Administration » Configuration » Regional and language admin page, it shows you some formats (and I therefore errenously assumed that these formats were those that were defined for the site). But these formats are not defined until you press Save configuration on that page.


texts: Lots of 500.shtml page not found errors in logs

texts:
I've been getting lots of page not found errors for  500.shtml in my logs. A lot of them seem to be originating from search spider and ho I might be able to fix these, I'm curious to why 500.shtml is even being sought out in the first place and how these are being generated at such a furious pace:

   type: page not found
   location:http://www.example.com/test.html
  referrer:
 message: 500.shtml
 severity: warning
  hostname:

500.shtml entries in the Drupal logs. In many cases, these are generated by search engines (determined by doing reverse lookups on the IP's), sometimes from users (but in very few cases). How can I fix it?


texts:
I created a custom theme to serve as the base for all my company's future drupal projects, that includes all of our base requirements. The sites will live on different servers, and each site will have it's own subtheme.

Drupal themes compare versions w/ the drupal projects server to check for updates.

I do not want to submit my company's theme to the drupal.org, as it has company specific features.

The goal is to be be able to update the theme in a "local" central repository, and have the various drupal sites check for version updates.

is there a place in the .info file to set a url to check for updates?

The version number is pretty easy to set.


texts:
I'm trying to create a form table with a column of checkboxes. The theming isn't working with the code below. All help is appreciated :)

myadmin.module

function myadmin_menu() {

  $weight=0;

  $t = get_t();

  $items = array();

  $items['myadmin_dispute'] = array(
    'title' => 'Dispute Queue',
    'access arguments' => array('view myadmin'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('myadmin_dispute'),
    'file' => 'myadmin_dispute.php',
    'type' => MENU_NORMAL_ITEM,
    'expanded' => true,
    'weight' => $weight++,
    'menu_name' => 'myadmin',
    'module' => 'myadmin',
  );
}

myadmin_dispute.php

function myadmin_dispute($form_state) {
    //add output - css and javascript to include
    drupal_add_js ( drupal_get_path ( 'module', 'myadmin' ) . '/scripts/jquery.tablesorter.js' );
    drupal_add_js ( drupal_get_path ( 'module', 'myadmin' ) . '/scripts/myadmin.js' );
    drupal_add_css ( drupal_get_path ( 'module', 'myadmin' ) . '/blue/style.css' );

    $disputes = array
      (
        array('uid' => 1, 'first' => 'Joe', 'last' => 'Smith'),
        array('uid' => 2, 'first' => 'Susan', 'last' => 'Doe'),
        array('uid' => 3, 'first' => 'John', 'last' => 'Doe'),
      );

    foreach($disputes as $dispute)
      {
        $checkboxes[$dispute['uid']] = '';
        $form[$dispute['uid']]['first_name'] = array
        (
          '#value' => $dispute['first'],
        );
        $form[$dispute['uid']]['last_name'] = array
        (
          '#value' => $dispute['last'],
        );
      }

    $form['checkboxes'] = array
      (
        '#type' => 'checkboxes',
        '#options' => $checkboxes,
      );
      $form['#theme'] = 'dispute_theme';

      return $form;

}

function myadmin_dispute_theme()
{
  return array
  (
    'dispute_theme' => array
    (
      'arguments' => array('form' => NULL),
    ),
  );
}

function theme_dispute_theme($form)
{
  $rows = array();
  foreach(element_children($form['checkboxes']) as $uid)
  {
    $row = array();
    $row[] = drupal_render($form['checkboxes'][$uid]);
    $row[] = drupal_render($form[$uid]['first_name']);
    $row[] = drupal_render($form[$uid]['last_name']);
    $rows[] = $row;
  }

  if(count($rows))
  {
    $header = array(theme('table_select_header_cell') , t('First Name'), t('Last Name'));
  }
  else
  {
    $header = array(t('First Name'), t('Last Name'));
    $row = array();
    $row[] = array
    (
      'data' => t('No users were found'),
      'colspan' => 2,
      'style' => 'text-align:center',
    );
    $rows[] = $row;
  }

  $output = theme('table', $header, $rows);
  return $output . drupal_render($form);
}

function myadmin_dispute_submit($form_id, &$form_state) {

}

Update, this is needs to work for drupal 6 instance.


texts: how to get the value from a field in hook_node_load($nodes, types)

texts:
I have a hook_node_load(), when I dsm($nodes), it returns an array, I need to get the value from field_tt_status (contains 1 or 0). I know I have to do something like

$status = $nodes['field_tt_status']['und']['0']['value'];

but it that doesnt work. Can someone help me?


texts: where does the Node information in drupal database exist?

texts:
I have a strange problem, Below are the steps I followed to create and delete a content type.

I have created a content type on site A.\
Deleted content type on Site A by navigating to structure->content types.
cleared cache.
Refreshed the content types page. What I saw was content type still existed.
deleted content type from 'node' and 'node_type' table in DB.
cleared the cache.
Refreshed the page. Still I see content type exist.
I checked the DB again, what I see is that node type re appears in DB.

Is there any other place where the node is getting populated from and making it to reappear?

Any suggestions/help greatly appreciated.

Thanks


texts: How can I add the +0430 timezone to Drupal 6?

texts:
As you know, Drupal 6 doesn't have the +0430 timezone in the date/time page. I want to add this specific item into timezone drop-down list.

Does anybody know about this core patching? How can I do it?


texts: Drupal Commerce changing product attributes not firing AJAX update

texts:
I'm currently building an e-commerce website using Drupal 7 and Drupal Commerce (not kickstart). I've built my product display page, and added an attribute to the product called "size" where the customer can pick the size before they add it to their cart.

I'm looking to recreate the functionality seen on this page:
http://demo.commerceguys.com/ck/storage-devices/commerce-guys-usb-key

Where by when you select a different option, an AJAX call is made and the price updates.

Looking at the HTML generated on my page, it looks like it's half-way there as the select has the 'ajax-processed' class on it, but when the select option changes, nothing is called and no errors appear in the browser JS console. Debugging the field shows that the AJAX callback is in place:

array(5) {
  ["#type"]=>
  string(6) "select"
  ["#options"]=>
  array(2) {
    [4]=>
    string(22) "Small Bag (5KG)"
    [3]=>
    string(24) "Big Bag (7.5KG)"
  }
  ["#default_value"]=>
  string(1) "4"
  ["#weight"]=>
  int(0)
  ["#ajax"]=>
  array(1) {
    ["callback"]=>
    string(49) "commerce_cart_add_to_cart_form_attributes_refresh"
  }
}

Any suggestions as to what might be causing this not to be called?


texts: How to decide wich responsive base theme is better for a certain project?

texts:
I know that each project is different and there´s no such a thing as one size fits all. BUT, when you want a responsive theme, you have the choice to start it from scratch or use a base theme.
The Omega Theme and the adaptive theme are both responsive and very popular. Afetr you tried both maybe you select one according to your personal tastes, but what do you keep in mind yo actually make that choice? Wich features?

Thanks for your insight!

Note: I´ve updated the post to add the Adaptive Theme instead of the mothership. I´ve checked and it seems Omega and Adaptive are very popular responsive grid themes. (Thanks Clive!)


texts: Using call_user_func_array on the db_select object

texts:
call_user_func_array() makes calling a variable function with a set of arguments fairly simple. I would like to do the same with db_select() passing in various options to different methods. Going to use dblog_cron from 6.x and 7.x as the examples. How can I do something similar in D7?

D6 Code

<?php
// These 2 lines return the same thing in D6
$max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
$max = call_user_func_array('db_result', array(call_user_func_array('db_query', array('SELECT MAX(wid) FROM {watchdog}'))));
?>

D7 Code

<?php
$min_row = db_select('watchdog', 'w')
  ->fields('w', array('wid'))
  ->orderBy('wid', 'DESC')
  ->range(999, 1)
  ->execute()
  ->fetchField();

 // Getting closer but not what I'm looking for.
 $min_row = db_select('watchdog', 'w')
   ->{'fields'}('w', array('wid'))
   ->{'orderBy'}('wid', 'DESC')
   ->{'range'}(999, 1)
   ->{'execute'}()
   ->{'fetchField'}();
?>

How can I call the above code without eval using something like call_user_func_array() or ReflectionMethod::invokeArgs?


texts:
Is it possible to rewrite the url in a 404 redirect according to the page which is actually being displayed ?

For example, if the non-existent url "/fzenk" is requested, and you have configured the default 404 error page to be the front-page, the url in the address bar after the redirect should be front-page's.

I tried Global Redirect module but it didn't work. Is it possible to do the 404 redirect = URL-rewrite with another module or should we request a new feature ?

Update:

While it is possible to do it, it seems to be a bad idea to rewrite 404 pages url.


texts: Issue with content access and multilingual system

texts:
I have a multilingual website using English, Arabic and French. 2 days ago I noticed that anytime when I clicked on node/add/* for the English section, it returns an access denied page. And that is just for English (the other languages are fine and nothing wrong with them).

I use the Content Access module but even after I uninstalled it the issue remains the same.

I'm using Drupal version 7.32 and I18n 7.x-1.11.

Does anyone have an idea about this issue?


texts:
I have form in one module.

  public static function validateForm(array &$form, FormStateInterface $form_state) {
      $url = \Drupal\Core\Url::fromRoute('test.route');
      $form_state->setRedirectUrl($url);
      $form_state->setRedirect('test.route');
  }

Trying to redirect the route of another module.

It's not redirecting from one module to another.


texts: CKEditor violates layout borders in Drupal 7

texts: In Drupal 7 the CKEditor violates border of left column (where it should be) and penetrates into right column. Now, I can not resize it because when I resize borders of CKEditor by dragging resize button, the icons (image tabs) of CKEditor does not react and does not obey to this act and still remain in right column, although the very borders of editor are changed. In other words CKEditor icons not only violates borders of my site layout, but also it's own CKEditor borders. I should mention that this nuisance occurs only in my Chrome and Opera browsers, while, for example, in Firefox everything is ok. Version of CKEditor is 3.6.5. and by following some suggestions I tried to fix this problem by putting library of 3.6.6. version but no solution found. How can this be solved?


texts: (Admin) Collapsible blocks don't work anymore

texts:
I'm currently working on a Drupal site which requires quite a lot of modules to be installed. As I progressed, I encountered several important bugs (some admin pages --eg Patterns-- not loading any more, instead displaying a critical error, etc). Among those bugs was the fact that the collapsible blocks present in various places in the admin don't work anymore: the mouse cursor doesn't change to a hand when placed upon their title, and clicking on them doesn't produce any effect. In other words, the collapsible blocks are stuck.

Because of that, I tried starting again from scratch with a clean install of Drupal 7.24 in a new separate folder and on a new database.

I was very surprised to see that even during the Drupal install procedure (step 4: set up database), so before Drupal is even fully installed, the collapsible block doesn't work either! (It's the block "Advanced options"). Of course there are no modules installed at that point, so it's not related to that.

I inspected the page with Firebug:

the block stuck has the class "collapsible collapsed form-wrapper collapse-processed".
in the header of the page, the JS file "collapse.js?v=7.24" is present.
this JS file exists on the disc and I haven't tampered with it.

I tried restarting Firefox in Safe Mode but that didn't change anything. (I'm using Firefox 27 and it's up to date.)

Any idea what the problem might be?

UPDATE: I tried the installation procedure in Chrome and the collapsible blocks do work! So it's apparently a problem related to Firefox --and Firefox itself (as I said, I already tried Safe Mode in Firefox, so it's not caused by some 3rd-party extension). I hope it gets fixed soon.
If somebody has a solution, you're welcome to answer. :)


texts:
I am struggling with how to get node id in my user_register_form_submit.
I need to get the node id of the node where my form is, let me explain :

I have created a tpl for my user register form in order to print it in nodes of a special content type, those nodes prepopulate my form and helps to create users, I need this node id to delete the node after submiting the form wich means delete the node after a user is created.

here is my hook :

    function hook_form_alter(&$form, &$form_state, $form_id) {
        if($form_id == 'user_register_form'){
            $form['#submit'][] = 'user_register_form_submit';
        }
    }

    function user_register_form_submit($form, &$form_state) {
    // print the node id
    }

Last thing, I'm working with Drupal 7.
Thanks !


texts:
I'm using Drupal 7, Views 3, and Token.

I created a view of comments.

I would like added to this view a field of the parent node.

I thus added a header, of type "global text area", I tried of added a token corresponding to the desired field, clicked on "Use replacement tokens from the first row ", but it does not work (the token appears but not the field).

Have you a solution?


texts: How to create custom rules action event conditions?

texts:
Is there any universal formula or module to create custom rules actions, events and conditions? So that I just have to replace the required values and rest of the code remains the same. I searched, but I did not find such code. I found few, but those were targeted towards a specific need/question.

For example there are lot of things missing. I am using message module to log activity. I am using statuses module and flag 2 (flag 3 is not compatible with the statuses module) I am trying to do following

Log statuses comments. Logs only for "currently logged in user". Cannot determine who commented. for e.g. John commented on your status update. Event available, but only shows current user name instead of who commented.
Log activity for "John liked your status update". No event available.
Similarly, for status updates comments, "likes flag".
John started following you on stackexchange. Event is available, but it also lacks option to tell who followed you. It also only shows current user name. Obviously you do not need your name here, you want to know who followed you.
John mentioned you on stackexchange. Again, instead of john, it will show current user because you do not have any option when setting up the rule.

The simple activities are easily created though.


texts: How to use variables in a PHP evaluation in a rule?

texts:
I created a rule with the actions "Provide a variable: mynumber" and "Grant points to a user". I'd like to evaluate the points with PHP, using "mynumber". For some reason, I can't use $mynumber, although that is possible in the PHP evalution of the sections 'Operation' and 'Description'. As the replacement pattern [mynumber] is available, I tried to use it in my code with and without the square brackets, but in both cases, I get the error:

  Notice: Use of undefined constant mynumber - assumed 'mynumber' in
  eval() (line 1 of
  C:\wamp\www\mysite\sites\all\modules\rules\modules\php.eval.inc(146) :
  eval()'d code).

Is this a missing feature, a bug in the Rules module or did I do something wrong?


texts: How do I show user attributes on articles?

texts:
I added a custom field "Twitter URL" to each of my users (on the page Home » Administration » Configuration » People » Account settings). I'm trying to display this "Twitter URL" on every article that that user makes. For example, under the "Published by someusername on Wed, 12/28/2011 - 02:57" that is already on every post, I want to have the "Twitter URL" for that user right under that.

  Published by mike on Wed, 12/28/2011 - 02:57
  http://twitter.com/someusername

I think I need to go into node.tlp.php and edit something, but could anyone give me a little more help?


texts: How to get users (entities) for a certain field value?

texts:
I want to write a function that returns users which have entered a certain value to a custom user field.

Lets say there is a custom birthday field for every user. What would be the best way to get all users with a certain birthday?

I could create a DB query that searches the field_data_field_birthday table and returns the entity_id(s) (which in this case would be the users id(s)) for which the field_birthday_value matches a given value and then load the user(s).

This seems a little bit crude, are there generic functions for this use case available? In the entity API or the field API maybe?


texts: Using Acquia for a production site and running Wordpress concurrently

texts:
I've been building a website for my library in Drupal 6 using the Acquia Installer package on my local machine, a Win7 PC. I'm also going to need to run 2-3 Wordpress blogs alongside Drupal on the same machine, both on my local machine and when everything is migrated to our Server 2008/IIS 7 machine.

Do I need to ditch Acquia Installer now while still developing in order to run WP alongside Drupal? I've thought about installing WAMP alongside Acquia just to run WP on my local machine. But that seems like it would kill my local machine, running two separate installs of Apache, MYSQL, PHP, etc. And Acquia + WAMP probably isn't the smartest way to set up an efficient production environment on my server.


texts:
I'm creating a new Drupal 8 site using Lando/Pantheon - and then installing the Umami profile. I've done this before with no problems.

This morning when I try, the site is created and it looks like the Umami theme is in place. However, the content is not created.

Is there any way to create the content after the profile is installed?

Note: Oddly, drush is saying that the demo_umami_content module is not found but is able to find demo_umami_tour. ~/Desktop/lando/lando-panth $ lando drush pmi demo_umami_content demo_umami_content was not found.


texts: How do I let users unpublish and publish their own content?

texts: I want to let users unpublish and publish their own content. By default, you have to give "administer nodes" permission for users to be able to unpublish or publish content. That is way to broad though. I want to let users unpublish or publish a node if and only if they created it. This also means they should be able to view unpublished nodes if and only if they created it.


texts: Map subset of taxonomy terms to a content type

texts:
I have a taxonomy called Writer and I have the terms added to it. I would like to maintain both active and inactive terms in the vocabulary and use only the active terms when mapped to a content type. In other words I would like to soft delete the terms instead of hard-deleting them. For this I added a custom boolean field for Writer vocabulary to indicate if the term is active or not. I am now not sure on how to apply the conditional mapping of taxonomy terms to the content type.

Appreciate help on this.


texts: Cannot get rules component to fire on Commerce Completing the checkout process

texts:
I have a baffling situation. I created a nice little rules component that retrieves a list, using VBO, of published Drupal Commerce Product Display nodes with referenced product stock of zero or less. And then loops through that list unpublishing each node. This is how I built it - https://drupal.org/node/1345216#comment-8306801

This component works as expected when executing it by itself or when placing it in a rule with the "After updating an existing commerce product" and/or "After updating existing content" events. I cannot get it to run when attaching it to a "Completing the checkout process" event.

Any ideas? Is it a permissions issue, as in customer cannot run the component or access the VBO list?

Is there another event related to a customer completing an order that might work better?


texts: Setting up sub sections with their own editors

texts:
I'm new to Drupal (v7.21) and hoping to use it for a site that contains several sections each run by a separate owner and their team of editors. Just wanted to ask if it would be possible and how I could go about it. The type of flow I'm looking for is:

Main Site
- Forum
- Store

  Section One
  - Blog
  - Book

  Section Two
  - Blog
  - Book

As normal the Admin would have overall control with each section having an 'owner' that can edit their sections Blog, Articles etc. The owners would also be able to give an 'editor' role to other users so they can edit content within the section.

It would be helpful if the urls for the site were:

domain.com/
domain.com/forum/
domain.com/store/

domain.com/sectionone/
domain.com/sectionone/blog/
domain.com/sectionone/book/

domain.com/sectiontwo/
domain.com/sectiontwo/blog/
domain.com/sectiontwo/book/

If I haven't included enough information please let me know. Any help would be greatly appreciated.


texts:
I am trying to set the default values for the Username, Email address, Password, and Confirm password fields so that I can use JavaScript code to show the default values in the field, until the user enters the field and begins typing.

Do I need to use hook_form_alter() for this, or can I just add something to the template.php file for my theme?


texts:
When I try to access some specific pages, I get the following errors in my log, one after the other:

  Notice: Trying to get property of non-object in ds_field_formatter_view() (line 1233 of /var/www/sites/all/modules/ds/ds.module).

Followed by

  EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7729 of /var/www/includes/common.inc).

And the page serves the following error:

  Error
  The website encountered an unexpected error. Please try again later.

I had the modules taxonomy and taxonomy manager enabled. I disabled taxonomy manager, but no effect. I wanted to disable taxonomy too, but could not because there was a field with data in it. This has made almost 44 pages of the site with good content in accessible, so any help will be greatly appreciated.