texts: Post content via JSON API: CURL works, PHP not?

texts:
I've got those modules enabled:

HAL
HTTP Basic Authentication
JSON:API
REST UI
RESTful Web Services
Serialization

When I run this command, the content is created.
curl \
--user demo:9aqW72MUbFQR4EYh \
--header 'Accept: application/vnd.api+json' \
--header 'Content-type: application/vnd.api+json' \
--request POST http://www.demo.drupal/jsonapi/node/article \
--data-binary @payload.json

Now I try to read via PHP, which works fine too.
require 'vendor/autoload.php';

use GuzzleHttp\Client;

// Update to a user on your Drupal site that has permissions to create content
$user = 'demo';
$pass = '9aqW72MUbFQR4EYh';
$url = 'http://www.demo.drupal';

$content_client = new GuzzleHttp\Client([
    'base_uri' => $url,
    'timeout'  => 20.0,
]);

$res = $content_client->request('GET', '/jsonapi/node/mail/71adf560-044c-49e0-9461-af593bad0746');

$body = $res->getBody();
$stringBody = (string) $body;
var_dump(json_decode($stringBody, true));

I can't post content. The code I am using returns a 401, 402, or 500 error.
$headers = [
  'Content-type' => 'application/vnd.api+json',
  'Accept' => 'application/vnd.api+json'
];
$payload['data'] = [
  'type' => 'node--article',
  'attributes' => [
    "title" => "My custom title"
  ]
];

$guzzleResponse = $content_client->post('/jsonapi/node/article', [
  'json' => json_encode($payload),
  'headers' => $headers
]);

if ($guzzleResponse->getStatusCode() == 200) {
  $response = json_decode($guzzleResponse->getBody());
}

What am I doing wrong?


texts: What's wrong with my taxonomy links or my taxonomy view and contextual filter?

texts:
I have a D7 view displaying all items tagged "food" at

mysite.com/industry/term/food

But my taxonomy terms for "industries" link to e.g. mysite.com/industry/food
(i.e. without /term/)

I thought I could update the view to make the page path: /industry/%
instead of: industry/term/%
but that breaks the view

so I thought I might be able to update my Taxonomy url aliasing pattern to be:

[term:vocabulary]/term/[term:name]

instead of [term:vocabulary]/[term:name]
but that doesn't work either :( or at least, it doesn't update all pre-written aliases...

I read this:
http://www.webbykat.com/2012/04/overriding-default-taxonomy-page-view-drupal-7
which pointed to a solution from 2009 here
https://www.drupal.org/node/394062#comment-1953504
but if I use Name or ID (rather than "name converted to ID") in my contextual filter it breaks the view

What am i doing wrong - I'm sure it's something simple and I'm just being blind!?


texts: Is it possible to preserve image quality when uploading images?

texts:
Is it possible to preserve image quality when uploading images through Drupal7?

For example, I take this image:
http://f.cl.ly/items/0L3j21030C3O2A3x2w0b/thumb.jpg

I upload it using an Imagefield, which has no min/max resolution set, and it looks like this:
http://f.cl.ly/items/2B2q2a1H402T1Z1j3w2j/baboon-onesie-costume-thumb.jpeg

So already we're seeing a loss in quality. Then it's displayed using a view, which scales the image (which it should do IF) it's larger than 190x280 (which it isn't), and now it looks like:
http://f.cl.ly/items/2n023q1Q331J3E2d3a3I/baboon-onesie-costume-thumb-1.jpeg

The quality difference is massive - there's a huge loss of colours and severe artefact creation around the image edges.

The GD image settings are JPEG quality: 100%.

Is there anything that can be done to prevent this ridiculous loss of quality?


texts: How do I insert the title of the block between two Views fields?

texts:
A designer has sent me a very cool design, and I don't know which is the .tpl file I need to override.

Basically, I need to put the title of the block between two fields of a view. The view is already a header of another view, and it displays only one record.

Other (bad) alternatives I see:

Do some positioning tricks with CSS.
Create a custom text field and style it like if it was the block title, and then hide the block title.


texts: How to add author's user role as CSS class to comments?

texts:
Snippet from Bartik's comment.html.twig ( https://pastebin.com/D70cyHNp ):

{{ user_picture }}

{{ author }}

{{ created }}

I want to highlight comments by administrators with CSS so how can I say "if the comment author has the role administrator, add the class "comment_author_is_administrator" to the author variable?


texts: hook_form_alter checking $user->uid == $node->uid

texts:
I need to check if the node uid and the logged-in user's uid are identical when the user is in the node edit form, and then add a class to the form if that condition is true.* The relevant code in my custom module currently looks like this:

function custom_form_alter(&$form, $form_state, $form_id) {
    global $user;
    $node = node_load(arg(1));
    switch($form_id) {
        case "custom_type_node_form" && "$user->uid == $node->uid":
            $form['#attributes'] = array('class' => 'test-class');
    break;
    }
}

The class is getting added even if the user isn't the author.

*Use case is that all site members with role X can edit nodes of type Y, but if the member editing the node is the author, I'd like to add some CSS.

I'm using Drupal 6.31.


texts:
I am using this code on D7 for my themes template.php to replace default 'Read More' title with 'Read More →' (it just adds arrow):

function theme_preprocess_node(&$vars){
  $vars['content']['links']['node']['#links']['node-readmore']['title'] = str_replace("Read more","Read more →",$vars['content']['links']['node']['#links']['node-readmore']['title']);
}

It all works, but when clearing cache I get this error message:

Notice: Undefined index: node-readmore in theme_preprocess_node()


texts: I am using the popup module (http://drupal.org/project/popup) to pop blocks. It works fine with the default core themes in Drupal 7, but when I use my own custom theme, the popup windows break up. I have tried adding CSS styles, but this doesn't seem to work. If any one have an idea on how to solve this, please help me out.


texts: How to display translated term names in exposed form in block

texts:
So I've got a views page displaying a list of nodes from specific content type. This view has filter form exposed in a block.

Some of the filters in the form are vocabularies. I'm using the BEF module to display the terms from each vocabulary as checkboxes instead of the default select lists.

The terms are translated - I'm using i18ntaxonomy for that, the vocabularies have this option selected: Localize terms. Terms are common for all languages, but their name and description may be localized.

The problem is that when the site is displayed in other languages different than the default one, the terms in the form are not translated.

I guess the problem is not with BEF as when I disable the module the terms remain untranslated.

I'm looking for any advice on how to debug/solve this issue.

This is definitely not the correct way to do it, but as the project deadline is tomorrow I've got no other choice but to hack the views module source code:

--- a/htdocs/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc
+++ b/htdocs/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc
@@ -122,7 +122,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
           $result = db_query("SELECT td.* FROM {term_data} td INNER JOIN {vocabulary} v ON td.vid = v.vid ORDER BY v.weight, v.name, td.weight, td.name");
         }
         while ($term = db_fetch_object($result)) {
-          $options[$term->tid] = $term->name;
+          $options[$term->tid] = i18ntaxonomy_translate_term_name($term);
         }
       }

I don't think a patch for the views module will be accepted. Any suggestions how should I proceed with this?


texts: How to sort the content types/bundles on /node/create page

texts:
I want to reorder the list of available content types on the create content page.
I have node-add-list.html.twig and entity-add-list.html.twig inside my custom theme template folder.
Twig then outputs the array of all types or bundles/content types in alphabetical order. How can I sort this a different way? And can I hard code the links I want in this file or can I output each content type individually?


texts:
I have a view that uses a Relationship and Aggregation. My View is working; however, I don't understand how/if I can fix the Query to remove redundant GROUP BY fields. Here's a summary of what I have:

I've created a View with Child items, which have an entity reference field parent_id that I use to create a relationship to Parent items. Each child has four integer quantity fields. Each row should display three text fields from the parent entity and then the SUM of each of the four quantity fields. I use the Aggregation settings on each of the quantity fields to get the SUMs. That works fine. I use "Group results together" for the target_id of the parent_id, which also works fine. What I don't understand is what to do for the other parent entity text fields. It seems that the only option is to use "Group results together" for the aggregation type for each. However, that results in a query with a bunch of extra GROUP BY criteria. I'd like my criteria to look like this:

GROUP BY child_entity_parent_id

instead of this:

GROUP BY child_entity_parent_id, parent_entity_title_field, parent_entity_description_field, parent_entity_size_field

Is there anything I can do to get those redundant fields out of the group by or do I just ignore them since they're not really hurting anything? Everything else in the query looks good.

(This is Drupal 8, if it matters.)


texts:
Currently, I am using hook_page_alter() in my module, but this runs too early. I am loading some fields from the node in template.php so that I can put them into other regions. These fields need JavaScript code from my module, after they are loaded, as the JavaScript depends on the IDs which are generated during the field loading process.

If anyone can help or point me to a list of hooks ordered by the point at which they are run then that would be a great help.


texts: How should a custom configuration entity define a dependency on other configuration?

texts:
In a custom module I am defining a defaults Configuration entity that references a role.
I would like to define a dependency on the role. This is my first attempt.
public function calculateDependencies() {
  $this->dependencies = parent::calculateDependencies();
  $this->addDependency('module', 'user');
  if (isset($this->role_id)) {
    $this->addDependency('config', "user.role.{$this->role_id}");
  }
  return $this; // Also tried return $this->dependencies;
}

The Drupal documentation on dependencies references the Block configuration class that looks very similar:
  public function calculateDependencies() {
    parent::calculateDependencies();
    $this->addDependency('theme', $this->theme);
    return $this;
  }

However I am seeing an error shown below when trying to save the entity.The backtrace indicates it is coming from the attempt to add a dependency on the user module. I chose to add that dependency by taking an example from system.action.user_add_role_action.administrator.

PHP Error:  Cannot use object of type Drupal/my_module/Entity/MyAccessDefaults as array in /app/web/core/lib/Drupal/Core/Entity/DependencyTrait.php on line 32

For example I am trying to test with this code:
$values = [
  'id' => 'administrator', 'label' => 'Administrator role grants',
  'grant_type' => 'role', 'role_id' => "administrator",
  'grants' => ['grant_view' => 1]
];
$default_admin_config = \Drupal::entityTypeManager()->getStorage('my_entity')->create($values);
$default_admin_config->save();


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

texts:
I posted this question at https://stackoverflow.com/questions/39234531/import-multi-value-from-csv-into-field-collections but I have not got any replies yet. Below is the summary:

I have a simple csv file with 3 columns: NID|Key|List; where NID is the node id and Key was the unique value used to add field collections to the respective node. "List" is a multi-value field separated by ";".

Example (csv file):
NID,Key,List
1,2,text1;text2;text3
1,3,text4;text4
2,123,text1
...

Field collection has an entity reference field to a taxonomy plus other fields.

Field Collections:
Field1: text;
Field2: Term Reference;
Field3: Entity Reference; <-- importer/tamper not working!
...

The field collection fields were mapped correctly, except for the field that was an entity reference to a taxonomy. I configured Feeds Tamper with the Field Collection Feeds module but the entity reference list was not imported.

Does anyone has experience (suggestions) importing a multi-value field from a csv file into an entity reference field within a field collection?


texts: What Drupal tables to export from broken site

texts:
I'm on localhost with Acquia Dev Desktop , Drupal 7.34. Php 5.3.29.
I was just playing in the Views when suddenly the site crashed. After few drush cc and restart of Acquia Dev Desktop and trying to access the site again showed me:

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes) in c:\sites*\database.inc on line 2171.

I tried to increase memory limit to 1024M in php.ini and settings.php. Then I check the PhpMyadmin and I found that the watchdog table has ~6,000,000 records and its 6.4GB so I deleted it. drush cc, disable statistics and dblog modules. But still can't access the site. it just don't open. I copy watchdog table from another Drupal install (actually it was a previous backup) but still doesn't work and now it shows:

Fatal error: Maximum execution time of 300 seconds ...

and the watchdog db increased from 0mb to 350mb with ~777,034   rows.
Can I export certain tables with my views, taxonomy and settings and import them in another Drupal clean install? the Content is not important.
Edit:

Watchdog Message:%type: !message in %function (line %line of %file).
Variables: [BLOB - 294 B]
location: http://nina2.dd:8083/
the file watchdog_variables.bin says:

a:6:{s:5:"%type";s:14:"Strict warning";s:8:"!message";s:40:"Creating default object from empty value";s:9:"%function";s:43:"views_many_to_one_helper->ensure_my_table()";s:5:"%file";s:60:"C:\Sites\nina2\sites\all\modules\views\includes\handlers.inc";s:5:"%line";i:940;s:14:"severity_level";i:7;}


texts:
I have a table {cases} which has in part, upload_id, case_id case_name etc etc.
With a custom form, users, depending on role(4 custom roles), will upload a file upload_id. This  has been serialized. If it is a new case, case_name is NOT present then get max(case_id) add one and save to DB. Also users can add a file to existing cases, so the upload_id would auto-increase, and the case_id stays the same.
I've been working on this one area for 2 weeks and have come to the end of my rope.

I have written all of this into a custom PHP web app a few years ago, but now I have to rewrite it all in Drupal 7.  Any pointers in the right direction would be appreciated.

**********EDIT**************

I didn't think you could have 2 Serial Fields in the same table schema. I already have upload_id as a serial. I just can not figure out how to insert the case_id in Drupal.

Real scenario:

User uploads the file, upload_id =3796, case_id = 2916, case_name = 'xxx Macy'.

User forgot to include something needs to upload additional file. upload_id = 3797, case_id = 2916 where case_name = 'xxx Macy'. And still forgot a file, upload_id = 3798, case_id = 2916.

New user uploads file, upload_id = 3799, case_id = 2917, case_name = 'Jane Deer'.


texts:
Perhaps this is more of a DB/SQL question than Drupal. However, when defining large primary keys (multiple cols) how should I be indexing?

In my example below I am both setting a primary key -and- index on multiple cols. This is because I expect to use all of those cols in the WHERE part of queries. Is this correct?

  $schema['tournament_stats_node'] = array(
    'description' => 'Stores relations between tournament stats and node.',
    'fields' => array(
      'entity_type' => array(
        'description' => 'Primary key: Entity type of participants, e.g. user/team.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'nid' => array(
        'description' => 'Primary key: Related node ID',
        'type' => 'int',
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      ),
      'id' => array(
        'description' => 'Primary key: Unique entity ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'stat' => array(
        'description' => 'Tournament stat type',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array('entity_type', 'nid', 'id'),
    'indexes' => array(
      'entity_type' => array('entity_type'),
      'id' => array('id'),
      'nid' => array('nid'),
      'stat' => array('stat'),
    ),
  );


texts: How to create a multifield programmatically without using features

texts:
I have a custom module that I am working on that uses a couple of custom content types. I am trying to keep the module as self-contained as possible and thus far I've been able to create my content types using field_create_field() and field_create_instance(). However, I've just hit a point where it would be really nice to be able to implement a multifield in a content type, and that's where I get stuck. I have example feature exports to look at, but I'd rather not use features if possible.

Any help would be appreciated if either someone knows how to implement a multifield in the .install file of a custom module, or if anyone can explain that this is simply a bad approach.

Thanks in advance.


texts: Installation showing only SQLite as database option

texts:
I using Windows 8.1, XAMPP 3.2.2 and Drupal 8.0.3.

When I install Drupal, it only gives an option for Database as SQLite and it stores the file in drupal->sites->default->files. Then inside the folder 'files' name of the SQLite DB is drupal.ht.sqlite.

I want to use MySQL as DB instead of sqlite, Please help me to get out of this problem. And I have add some content it is working fine.


texts:
I'm working on a module that uses soap to fetch data from a webservices.
Data are ok, and I'll use theme functions to display them as a list.
I should also to split results in pages, like views.
Is there a way to add a pager?


texts:
Is there a way to reverse order of the outputed list:

These items were being added as Global:Contextual links in the View, but order is wrong. Instead of going and replacing in each view (lets say that there are 100 views), what would be the quickest way of reversing order and making it like :

Manage display
Clone
Access Control
Delete
Edit

Thanks


texts:
I am trying to learn views/panels and therefore am working on cinema listings: there are 2 cities, each has 2 cinemas, each cinema has 2 show halls and there is a list of 10 movies, that are shown in some of these halls during the period of 5 days.

The question is - what would be the easiest way to enter and display such listings - should I use panels pages, panel nodes and is it possible to create such things using node references and relations?

please correct me if I'm wrong - i'm a newbie here:

I was thinking to create 10 nodes for each movie, where there is description of the movie, picture, etc, but then I am lost - shoud I create a node for each cinema and so on, or is it better to use taxonomy terms and to add  these to each movie: city, cinema, hall and show time - I'm lost here... :(

the result that i want to achieve is that I'm clicking on a movie and I'm getting description and all it's showtimes. And if I'm clicking on particular cinema - I'm getting a timetable with movie names and times.


texts: How to change labels on node add/edit form inside Authoring information box?

texts:
I have a Drupal 8 site with the Bartik theme. How can I change label text on node add/edit form inside 'Authoring information' box. This box contains:

-Menu settings
-URL path settings
-Authoring information
-Promotion options

I want to rename some labels and add a new input text field. The main thing I want to change is the Authoring information box and the information inside of it. Is this done with hook form alter?

:


texts: I was debugging by adding a print_r() to my code to check array values along the way. The problem is I forgot where (which module and which file) I had added the print_r() statement since it has been some time I had worked on it. Now some of my pages are outputting an unwanted array print out. Is there a way to find out which module and which file specifically generated the array print out?


texts: Drupal Views - Missing [view_node] from rewrite tokens

texts:
I'm trying to follow along with this tutorial here but I don't see the [view_node] among my list of rewrite tokens.

Tutorial Link

I have rearranged the fields but I just don't have it available.

Thanks for any help you can offer.


texts: How do I hide a view's field based on role?

texts:
In /admin/people, I want to hide the display name (i.e. the Display name must not appear in the user list), but only for a specific role.

In my .module file, I have tried following hooks:

function hook_views_data_alter(array &$data) {
  kint($data['users']);die;
}

function hook_views_pre_render(\Drupal\views\ViewExecutable $view) {
  if($view->id() == 'myview'){
    print_r($view->result);die;
      // kint($value->_entity->get('title')->value);
  }
}

function hook_views_post_render(\Drupal\views\ViewExecutable $view) {
   if ($view->id() == 'viewid') {
    // Set the view title.
    $field_name = $view->getFields();
  }
}

function hook_field_views_data_views_data_alter(array &$data, \Drupal\field\FieldStorageConfigInterface $field) {
  $field_name = $field->getName();
  echo 'hjsjhwd';
  print_r($field_name);die;
  }

None of them helped me. I thought of getting fields of the view "user" and after that I will unset it for particular role. But in views listing, Name field is still appearing. How can I hide it for a particular role?

Is there any way to achieve this?


texts:
I can't run cron; see the video capture I created.

If I click "Run cron" in the admin menu I'm redirected to another URL.

If I go to mysite.com/cron.php, I get the "Access denied" message.


texts: Node Hierarchy: Display Children of top most parent in views

texts:
Node Hierarchy lets you assign parent/child relationships to nodes, which can be displayed in Views.

In Views, you can display the parent of a node, the ancestor of a node and the child of a node. (Instructions below*).

Is there are any way to combine this to display the immediate children of the top level parent node?

If not, are there any other modules that would allow this. (I have tried both relationship and entity references, but they don't seem capable).

*Instructions on how to display Node Hierarchy relationships in Views.

How to display Parent Node:
In Views, Go to relationships and enable the Node Hierarchy Parent relationship.
Then go to contextual filters, and selected Node ID as a filter. Under "When the filter value is available" set the Validator to content.
Create a block display and place it on your node.

How to display Ancestor Nodes:
Exactly the same as Parent Node, but the Node Hierarchy Ancestor Relationship is used.

How to display Child Nodes:
This requires a different approach from the above two, as a relationship is not used. The "Node Hierarchy: Parent Node ID" is used as a contextual filter in place of Node ID, however, the settings are the same.


texts: How to set the classes used in Drupal commerce buttons with Bootstrap theme

texts:
I am working on a site with Drupal commerce, I use the Bootstrap theme and a child theme.
I would like the [add-to-cart] button to have the "btn-default" class, instead of “btn-success". Actually, I want to get rid of the "info" and "warning" classes in many cases where I don't need them and replace them by "default" or "primary".

I saw in /sites/all/themes/bootstrap/bootstrap.api.php

/**
 * Allows sub-themes to alter the array used for colorizing text.
 * …
 * @see _bootstrap_colorize_text()
 */
 function hook_bootstrap_colorize_text_alter(array &$texts) {
   // This matches the exact string: "My Unique Button Text".
   $texts['matches'][t('My Unique Button Text')] = 'primary';

  // This would also match the string above, however the class returned would
  // also be the one above; "matches" takes precedence over "contains".
  $texts['contains'][t('Unique')] = 'notice';

  // Remove matching for strings that contain "apply":
  unset($texts['contains'][t('Apply')]);

  // Change the class that matches "Rebuild" (originally "warning"):
  $texts['contains'][t('Rebuild')] = 'success';
}

So I tried in /sites/all/themes/[my-sub-theme]/template.php

function hook_[my-sub-theme]_colorize_text_alter(array &$texts) {
  // Let's try a dummy change for a test
  $texts['contains'][t('Update cart')] = 'success';
}

But I can't see anything changed.

I also saw that /sites/all/themes/bootstrap/includes/common.inc sets a number of values based on the contained string, in which I find th “Update” I am looking for.  the function is
function _bootstrap_colorize_text($string, $default = '') {…}
it ends with

// Allow sub-themes to alter this array of patterns.
    drupal_alter('bootstrap_colorize_text', $texts);

But I still haven't found how to do what I want in my sub theme. and what I read in /sites/all/themes/bootstrap/templates/system/buttons.vars.php won't help me.

Can somebody please explain where to start?


texts: How to filter by language in default search

texts:
On a D7 (7.60) site, we're currently using the default search tool for a little search form block on the page. Our site has multiple language versions, dependent on url.

Right now, content in 4 languages is giving 4 search results. I want to filter this to just current user's language. But when I go into the view (admin/structure/views/view/search/edit), I'm not seeing "current user's language" as a filter.


texts: Restricting the term reference field from creating a new vocabulary term

texts:
I have a term reference field in a form and it is an auto-complete term widget, it has a vocabulary that supplies the values to it. My intention is to allow users to input only the terms which are defined with in the vocabulary and it shouldn't accept entries other than the vocabulary terms. But, the field is allowing other entries from the user.

For example, consider the term reference field is associated with a vocabulary. Now,if an user enters the values(other than the vocabulary terms) within that field and submits the form. It accepts the values and inturn creating a new vocabulary term with the given values. Here I want to restrict the automatic creation of terms. If the value is not defined in the vocabulary terms, it shouldn't accept the form.

I want to restrict user to enter the values which are defined. If a user enters the value which is not defined in the vocabulary, it should give an error message.

Here, my problem is the vocabulary has already been assigned with some data and I couldn't delete the vocabulary anymore.

Any alternatives to restrict the term references??


texts: Can I use the Search API module and its facets without a server running Java?

texts:
The host I am currently using doesn't support Tomcat or Java applications of any kind.
Is there a non-Java based search server, or are my only options a third-party host or migrating to a new host?


texts: How does Drupal handle autoloading of classes?

texts:
How does Drupal handle autoloading of classes through modules? For instance, if I have an Events module, and I declare a class called Event, and then in the .info file I include the class file, how is this registered?

The problem is that I'm trying to dynamically get an array containing all loaded class names. get_declared_classes() does not return the names of all my classes declared in this manner, so I'm assuming that they're autoloaded somehow. Following the suggestions from another stack overflow question, I tried getting all of them with spl_autoload_functions(), but that was also unsuccessful.

Any ideas?


texts:
Being able to update the shared modules folder in a multi-site Drupal installation is amazingly easy, but I am wondering, what are some best practices when it comes to that?

Updating modules on a live environment when multiple sites are affected can be bad if a module has some sort of bug or if it's incompatible with something you were unaware of, correct? Usually we like to perform quality assurance on sites after a module update has been performed, but that starts to become a hassle once there are many sites under one core.

Assuming the sites/all folder is synchronized between development and live environments, pushing a site live is specially an interesting experience - since we want to make sure that all of the modules are updated. Sometimes these modules are in the shared modules folder, meaning it would affect every remaining multi-site as well. Then, in that case the only solutions I can imagine at the moment would be to either:

Push the site live without updating any of the shared modules - Perform updates on the live environment periodically when everyone is available to do Quality Assurance.
Perform module updates everytime a new site is pushed live. In this scenario, quality assurance would have to be performed on every site under multi-site - every single time a new site is pushed live.
Any input would be appreciated. Thanks for your help, guys!


texts: How to add unique identifier to each submission?

texts:
In short, I am trying to figure out how to add a custom and unique identifier to each submission from the Webform module.

Example: User fills out the Webform and submits. User then receives an email (email is captured from email field in Webform) confirming their submission and providing them with a Unique Identifier (ABC-14-001).

I know Webform asks what number to start the next submission (and I'm assuming this is considered the "SID"). If I am to utilize the SID, I need to be able to append the custom "ABC-14" prefix to each submission's SID.

I'm not very familiar with hooks (sorry for the ignorance), but I understand that hooks might be the only way, or at least most effective way, to accomplish this?

Update
Thanks all who responded! I have a working solution right now with this module:

function identifier_webform_submission_presave($node, &$submission)
{
  $component_id = 23; //that's your hidden field
  $submission->data[$component_id][0] = 'Text to be inserted';
}


texts: Exposed date filter against >= "today" fails until 5pm Mountain time

texts:
I added a Date only date field named expires to the user profile.
The expires field has the value 2021-01-08 for a certain user (I checked the database; it has no time component).
In a view, I have an exposed filter that tests the expires field using Operator=Is greater than or equal to with Value type=An offset from the current time and Value=today.
On 2021-01-09 up until 5pm Mountain time, the user with expires = 2021-01-08 is improperly included in the view.
When I refresh the view at 5pm Mountain time or thereafter, the user is dropped from the view.
I tried switching to Value type=A date in any machine readable format and Value=today. This also has a problem, but in this case users aren't included when they should be sometimes (the problem is sort of reversed).
If, as a test, I edit the exposed filter and use Value type=A date in any machine readable format and Value=2021-01-09 (i.e. hardcode the date) then the user with expires=2021-01-08 is not included in the view at any time, as expected.

It appears that today isn't giving me today's date until 5pm Mountain Time. What am I missing?
SOLUTION: Inspired by @Patrick Kenny below, I added this to MYMODULE.views_execution.inc:
function MYMODULE_views_query_alter($view, $query)
{
    if (!empty($query->where[1]['conditions'])) {
        foreach ($query->where[1]['conditions'] as $key => &$value) {
            error_log($value['field']);
        }
    }
}

Testing on 2021-01-13 at 10:17 am Mountain Time with Operator=Is greater than or equal to and Value type=An offset from the current time and Value=today, the output is
DATE_FORMAT(user__field_expire.field_expire_value, '%Y-%m-%d') >= DATE_FORMAT('2021-01-12T17:00:00', '%Y-%m-%d')
Notice the today value of 2021-01-12T17:00:00. WRONG DAY. Off by 7 hours. This confirms the answer by @Patrick Kenny.
HOWEVER, if I change to Value=now (instead of Value=today) and test again, the output is
DATE_FORMAT(user__field_expire.field_expire_value, '%Y-%m-%d') >= DATE_FORMAT('2021-01-13T10:17:02', '%Y-%m-%d')
Notice the today value of 2021-01-13T10:17:02. CORRECT DAY and time.
In my case, switching to now seems adequate to fix the problem because the Y-m-d format is applied, making the comparison work correctly. But I still subscribe to @Patrick Kenny's solution as a general fix.


texts: How to migrate a physical files into Drupal 7

texts:
I'm new to Drupal so forgive me.

I'm trying to migrate an existing site into Drupal. The site is all static content. I'm wondering if I can point Drupal towards a file path, rather then manually creating pages within Drupal and coping the body text.

Is there an easer way to handle a migration. I've looked on google, but most links are for existing CMS systems, or assume a database is provided.

If I do need to copy the HTML into the body, how I can I manually edit the header tag for a page? e.g. I'd like to add CSS and Js references.

Thanks


texts: Create AJAX multi step form which changes based on user input

texts:
I am trying to create a form where initially, the user is presented with just one field, which is their email address. When they click submit, I would like it to be an AJAX submit where I then lookup their email in a custom table in the database and then present them with additional form fields that will either be blank if we do not have their email address in the sytem, or will be pre-populated and ready for them to edit, if we already have them in the system. I was thinking a multi step AJAX form might do the trick, but I don't know if it even needs to be "multi step". Can I accomplish this with just a standard AJAX submit? I just can't figure out how to show/populate those additional fields after they submit the form. This is what I have so far, I just can't figure out how to only show the additional fields AFTER the submit and verification process:

/**
 * Implements hook_form().
 */
function _vista_form($form, &$form_state) {

  $form = array();

  $form['email'] = array(
    '#type' => 'textfield',
    '#title' => 'Email',
    '#required' => TRUE,
  );

  $form['wrapper'] = array(
    '#markup' => '',
    '#prefix' => '
',
    '#suffix' => '
',
  );

  // all of the fields below this are the ones that I would like to show ONLY after I look them up and then I can prefill them in or not
  $form['id'] = array(
    '#type' => 'hidden',
    '#value' => 0,
  );

  $specialties = db_query("SELECT specialty_code, specialty_name FROM {specialties_vista}")->fetchAll();
  $default_specialties = explode('^', '');

  $specialty_options = array();
  foreach ($specialties as $specialty) {
    $specialty_options[$specialty->specialty_code] = $specialty->specialty_name;
  }

  $form['specialty'] = array(
    '#type' => 'select',
    '#multiple' => TRUE,
    '#size' => 10,
    '#title' => 'Specialty',
    '#description' => 'Hold Control or Shift while clicking to select multiple specialties',
    '#options' => $specialty_options,
    '#empty_option' => '-All-',
    '#empty_value' => 'all',
    '#default_value' => $default_specialties,
  );

  $type_options = array(
    'VISTA-HealthCare-Partners-Government' => 'Vista Healthcare Partners',
    'International' => 'International Locum Tenens',
    'Permanent' => 'Permanent Physician',
    'US-Locum-Tenens' => 'US Locum Tenens',
  );

  $form['job_type'] = array(
    '#type' => 'checkboxes',
    '#multiple' => TRUE,
    '#title' => 'Type of Job',
    '#options' => $type_options,
    '#empty_option' => 'Choose a placement type',
    '#empty_value' => 'all',
    //'#default_value' => $type_selected,
  );

  $form['active'] = array(
    '#type' => 'checkbox',
    '#title' => 'Subscribe/Unsubscribe',
    '#default_value' => 1,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
    '#attributes' => array('class' => array('submit')),
    '#ajax' => array(
      'callback' => '_display_form',
      'wrapper' => 'ajax_wrapper',
      'effect' => 'fade',
    ),
  );

  return $form;
}

function _display_form($form, $form_state) {
  //do database lookup here and set some variables? Not sure.
  return $form['wrapper'];
}


texts: How do I define a Route with multiple different paths?

texts:
Does Drupal's routing system support a regular expression or other means for multiple route paths? I have a route that I would like to be able to hit from two different endpoints, /api/v1/foo and /api/v1/foo_bar. One route is newer, the other I want to keep for backwards compatibility reasons.

In my module's my_module.routing.yml file, I have defined:

foo:
  path: 'api/v1/foo'
  defaults: { _controller: '\Drupal\my_module\Controller\MyController::doItAction' }
  methods:  [GET]
  requirements:
    _access: 'TRUE'

foo_bar:
  path: 'api/v1/foo_bar'
  defaults: { _controller: '\Drupal\my_module\Controller\MyController::doItAction' }
  methods:  [GET]
  requirements:
    _access: 'TRUE'

This works, but as you can see everything after the route name and path property is copy/pasted. It's not exactly adhering to the DRY principle. Now this is a simple case, but imagine if I had a much more involved route with complex requirements and parameters. There would be a very high chance of making a typo or pasting mistake in one.

Is it possible to define the path as a regular expression or something similar so I don't have to repeat all the route properties?


texts: how to rename password label on user edit page in Drupal?

texts:
I would like to change labels only on user edit page. String overrides module would not work because it would rename all labels (user register and user edit). I tried the following:

function theme_preprocess_page(&$vars, $hook) {
  if ($vars['template_files'][2] == 'page-user-edit') {
    $vars['content'] = str_replace('Password', 'New Password', $vars['content']);
    $vars['content'] = str_replace('Confirm password', 'Confirm new password', $vars['content']);
  }
}


texts: How do I add the equivalent of GROUP BY using drupal 6 and views 2?


texts: How do I implement a search filter/field for my view? Lets say I have a view with a list of names/titles and there's a lot of them, so users could use search to filter through?


texts:
I have added Fivestar Module as a Field (Widget: Rated while Viewing) in my content type.

Before Adding the Module, My display was fine as in the picture below:

After Adding Fivestar, the display changes to

Adding more field will break the layout and goes to Horizontal scrolling of the browser.

The jQuery in my Theme starts like this:

(function($, Drupal, window, document, undefined) {

// To understand behaviors, see https://drupal.org/node/756722#behaviors
    Drupal.behaviors.my_custom_behavior = {
        attach: function(context, settings) {

And the jQuery in Fivestar module start like:

(function($){ // Create local scope.

Drupal.behaviors.fivestar = {
  attach: function (context) {
    $(context).find('div.fivestar-form-item').once('fivestar', function() {

I am pretty sure this is due to JavaScript conflict, but I am not sure how to resolve this, edit the Fivestar's JavaScript directly? or is there anything I can do in my custom theme to resolve this issue?

Have anyone come across this situation? how did you resolve it?


texts:
I am working on developing a type of bucket that would store my selected content in some sort of data container (I am hoping to store it in an array). The selected data comes from default views, I wrote an handler to add a 'ADD' button to the default view.
I am new to drupal and have very less experience with form api and not really sure how to push/store the selected content.

The following is the handler code:

<?php

 /**
 * @file
 * handler class for the new field 'bucket'
 */

/**
* class definition
*/
  class bucket_views_handler_field_actions extends views_handler_field {
 /**
 * Render function: return html output
 */
  function render($values) {
   //debug ($values);
    $biomaterial_id=$values->biomaterial_id;
    $form=array();
    $form['Add']=array(
     '#type'=>'button',
     '#value'=>'ADD',
     '#access'=>TRUE,
      );
  }


texts:
I look for create custom field image widget with image styles for drupal 8.

I need something like that:

// Here for example with a "Large preset"

// Here  same images but with a "Thumbnail preset"

I read this https://www.drupal.org/node/2620966 but still don’t understand how to applicate it for my objective. P.S. I mean to make it in a custom module.

I don’t have any idea how to make it. I’ll very thankful for any help!


texts: Dedicated image style for media gallery teaser

texts:
Is there any possiblity to define another dedicated image style for the teaser of a media gallery node only? I can change the default gallery thumbnail image style but this has also effect on the galleries overview page.

Because I like to create an image slider on the front page with the 5 newest galleries but need the image in another format then the default square thumbnail format.

Is there any possbility to do that so?


texts: Editing entity property (title) with ECK and editablefields

texts:
I'm using Entity Construction Kit and Editablefields.  When configuring the "Manage Display" of a bundle, the properties (specifically, "title") do not have the option of "editable".

Is there a way to make the entity property fields editable as well?  I'm considering doing a dummy field that updates the entity title on save.


texts: how to have a another page.tpl.php file in drupal with different regions and blocks?

texts:
Well, here is the problem. In my site I want to create a plain template and add my own regions and my own blocks. So when the user visits for example www.example.com/register-now the blocks will be different from the main page. I dont like disabling the blocks because when you open Firebug the blocks can be still be seen.

So I have read in this article that you have to create a new .tpl.php file.  So in my case I created the page__register-now.tpl.php file. and put that under drupal/sites/all/themes/ninesixty/ directory.

Then I opened the template.php file and tried the below code:

function ninesixty_preprocess_page(&$vars, $hook) {
  $path=drupal_get_path_alias();

  if($path == 'register-now'){
    $variables['theme_hook_suggestion'] = 'node__register';
  }
}


texts: How to print alt or title field image in custom block programmatically?

texts:
I want to print alt or title field image file in custom module Drupal 8. I load file entity use Drupal\file\Entity\File; I checked core/modules/file/src/Entity/File.phpall public function but not get any function which return title or alt text.

$graph_data = Paragraph::load($graph['target_id']);
$output .= '
';
$output .= '
';
foreach ($graph_data->field_slider_image as $item) {
 $title_img =    "Need image title here";
if ($item->entity) {
$slide_uri = $item->entity->getFileUri();
$url = ImageStyle::load('orignal')->buildUrl($slide_uri);
$output .= '

'.$title_img.'

';
}
}

Please anyone give idea ?

Thankyou


texts: Is it possible to use tokens in a menu link in Drupal8?

texts:
I need to add an option to "User account Menu" that shows the current user name. It is possible to do this using tokens or some other method?

Thanks!


texts: drush archive-dump and archive-restore remotely

texts:
I know how to backup and restore a whole site using drush archive-dump and archive-restore which is explined in this link:
Backup and restore Drupal sites with Drush

my question: is it possible to do the archive-dump and the archive-restore using aliases from a different server of the site.?

I have tried putting in the aliases file remote-host and root but it doesn't work.


texts: Imageapi Optimize - enabled libraries exec

texts:
I'm investigating Imageapi Optimize module and everything is quite clear except one thing. There is a list of internal libraries on UI which can be enabled and set the order of it. So, for example if first library is set to pngquant and second is optipng and both are enabled, what does the second one do?

I assume, when the image is being displayed pngquant process the image and it's being compressed. After the compression the image already have the desired size, so what does the second one do? I've searched through all the web and the module code and I can't really find out what is the logic behind it. I suppose it should be radio buttons rather then checkboxes.


texts: What operators and functions can I use in a Views "Global: Math expression" field?

texts:
When you create a "Global: Math expression" field in Views, the following help appears beneath the Expression field:

  Enter mathematical expressions such as 2 + 2 or sqrt(5). You my assign variables and create mathematical functions and evaluate them. Use the ; to separate these. For example: f(x) = x + 2; f(2)

I tried to use a modulo operator (%), but it didn't work, and the function specified in that help is obviously not vanilla PHP.

What syntax or language is allowable in this field?


texts: How to display User from Access Log in Views

texts:
The statistics module documentation says that user name is logged in the Access Log: "This access log is used to store data about every page accessed, such as the remote host's IP address, where they came from (referrer), what node they've viewed, and their user name. "

I have enabled statistics Acces Log and created a view which shows Access Log. Available fields are:

I can't find any field related to user.


texts: How do I create an AJAX filter for a view?

texts: I have created a page using Views and it works fine. I want to add an AJAX filter to this page to allow visitors to filter the contents based on PubDate or by Taxonomy/Vocabulary for this content type. How can I accomplish this?


texts:
I would like to prevent admin site (user id 2) to remove or change password user with id 1 although i need to admin add users and edit another users.
how to do this?


texts: Database error after moving host and renaming the DB

texts:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table
      '<olddb>.semaphore' doesn't exist: SELECT expire, value FROM {semaphore} WHERE name =
      :name; Array ( [:name] => variable_init ) in lock_may_be_available() (line 167 of
      /<somedir>/includes/lock.inc).

When I load the site it tried to load semaphore info from the old DB.

I moved the site to a new host and renamed the database. Change the settings file. It has the right user, password, host, dbname etc.

I have cleared the cache. Running drush says that all is good. It can connect and bootstrap Drupal.

Any ideas ?


texts: Is there any module that adds a field to all nodes and then add the value of that field as a class on the  tag of the page when the node is displayed?


texts: Webform Build Tab not displaying correctly

texts:
We just installed the Webform module, but as I'm going in to create and edit a new form, the "Build" tab is only allowing me to enter Elements with YAML code (pic one below). In the module description, it shows a preview of the Form Builder (pic two below), which doesn't look anything like what we have.

Is there an add-in that makes it looks like the module description...and therefore easier to use?


texts:
I have a content type with several fields, some of them are node reference fields displaying multiple values. I've configured the display of one node reference field like teaser showing two fields "code, description".
The problem is when the node reference has more than one value, keeps adding lines to the bottom. I want to display this node reference field like "code1/code2 description1/description2" in one line.

How can I achieve this? What template should I override, field.tpl.php or node.tpl.php?


texts: Drupal 7: What's the schema of the 'data' column in the 'users' table?

texts:
I'm trying to bulk-add some users, all columns of the users table are clear less the last, the data which has some serialised data like this:

a:2:{s:13:"form_build_id";s:32:"form-153847821e107639110c0cae645b3d88";s:4:"contact";i:0;s:11:"newsletters";a:2:{i:67;i:42;}}

I'm looking for a syntax/reference for this field, so I know what I'm getting into.

thanks


texts: How can I compare data comparison with values submitted in a webform?

texts:
I am trying to use webforms with the Rules module.

How can I compare data with the values submitted in a webform ?

For example, if the webform has a yes/no radio button, how can check the submitted value is yes?

When adding a new condition, I choose:

Data Comparison
Data selector *
Data (the submitted webform value)

I'm not sure how to access a particular form_key to check its value. I feel like Data should have more options to choose from.


texts:
I have multiple content types like news, publications, etc and I will like to link them to pages on my site. So when a user posts a news item on a specific page, it only shows up on that page only. Also I will want users to be able to edit content on only pages they have been assigned to. Eg. A user will only be allowed to add news to pages they have rights to.
I was considering using groups for this, but I know more suggestions will be helpful.

Many thanks
Isacc


texts: How to add extra data to a programmatically created node

texts:
Using Drupal 8 i am importing data from an external source and creating the node programmatically from the controller:

$node = Node::create(array(
  'type' => 'article',
  'title' => 'some title'
));
$node->save();

I want to add some extra field with the external id (e.g. "3cru_81pazBBRbj5e8LZkZ").

Adding of the field should happen programmatically within the module without the need of the user having to add it via the ui.

I have been reading up on this but i have come to the point that tutorials have confused me more then helped me.

Any help would be greatly appreciated.


texts: How do I change the order of the form elements?

texts:
I am using Drupal 7, and trying to make a custom register form to fit my needs.

I am also using a contrib module named "Auto Assign Role" to let the user choose his role.

Now heres the issue, the fields are appearing on the form but the order is messed up.

I have 5 fields on the form total:

First Name
Last Name
Role
Username
Password

The first i added via the manage fields section of Account area, the role field is added by the contrib module, and the other two field are built-in, I guess..

Above is the order i seek, but its not doing that even though i think it should. I ordered the field like that in the manage display screen, yet it still doesn't do what i want it to.

The order i get is:

First Name
Role
Last Name
Username
Password

If i set the weight of the above two fields (first & last names) to 0 instead of dragging and dropping to order in the manage display screen i get the following order:

Last Name
First Name
Role
Username
Password

This is almost what i want, but i want first name to be above last name.

Is there some way i can accomplish this?

Thanks!


texts:
I'm using feeds with Commerce. For each of my product variation, I have 4 images.

Each time I execute the feed import, the images are all copied by the number of variation. For example, if a product has 10 variations that are supposed to use image testpicture.jpg, the result is 10 copies named testpicture.jpg, testpicture0.jpg, testpicture1.jpg, etc.

How can All my product variations point to the same image and not make copies of the image with an incremental number?


texts:
I'm using snippet code:

$user = User::create([
      'mail' => 'usemail@example.com',
      'name' => 'user_name',
    ]);
// $user->save();   I don't want create user here.
$form = \Drupal::entityTypeManager()
  ->getFormObject('user', 'default')
  ->setEntity($user);
return \Drupal::formBuilder()->getForm($form);

or

$user = User::create([
  'mail' => 'aaaa@gmail.com',
  'name' => 'user_name',
]);

return $this->entityFormBuilder()->getForm($user);

on my controller to render user form to custom page. I want to this form have some default value. Example mail and username. I don't want to use hook form alter.

Other way to set default value for entity form?

Update: a way I tried:

Extend class RegisterForm
Override method form
Tried two method $form_state->setStorage() and $form_state->setUserInput() like on NodeForm

But doesn't working.


texts: How do I show the contact form in panels?

texts:
I have installed panels and Panelizer modules and used the core contact form.

There is no feature available for adding contact form in the panels.

How do I add the contact form in Panels without using the form Block module or other moudle?


texts: How do I place a multigroup in another multigroup?

texts:
Is there any workaround to be able to place a multigroup inside another multigroup using CCK?

This is what CCK tells me when I try to do it:

  You cannot place any kind of group inside a multigroup.


texts: How to display all children on parent node for custom content type?

texts:
I have a custom content type, let's call it 'parent'. I have another custom content type, let's call it 'child'.

I created a template file where I can display the 'parent' content type fields any way I want: node--parent.tpl.php. By using code such as...

<?php
  print $content['field_city'][0]['#markup'];
?>

I can move fields around and customize the markup, which is great. But how would I also display the parent's children on the same page?

(I don't use Views. I create a content type template file instead because gives me more flexibility for arranging the HTML).


texts: Content node migration to user profile in Drupal 6

texts:
I have Drupal 6.x installed where we a custom node type for author data. We are implementing a new design that designates users as authors and now assigning various roles such as author.

We have some 600 authors nodes which we wish to migrate to the user base so that we can assign the users to articles again.

What is the best method for accomplishing this?


texts: Communicating with Drupal from Javascript/Jquery (Drupal 7)

texts: I am trying to create a dynamically populated select list field widget.  This widget consists of three Jquery multiple selects.  When the user makes a selection from the first select list I need to dynamically populate the contents of the second select list.  My problem is that I need to access data stored in Drupal about what should be put in the second list based on the first selection and the only way I can think to access this data is through an ajax call to a Drupal endpoint.  Waiting for the return from an ajax call is going to be to slow for a useable widget so I need a better way to access this data stored in Drupal.  How should one go about doing this?


texts:
I am trying to do module with different share buttons in form of field to content type. It has no settings, I just need to enable it in admin panel and the button should appear on node. But I cannot get to work simple sample of code like this:

function fblike_field_info() {
    return array(
        'fblike' => array(
            'label' => t('Facebook Like'),
            'description' => t('This field displays Facebook Like button.'),
            'settings' => array(),
            'instance_settings' => array(),
            'default_widget' => 'fblike_default_widget',
            'default_formatter' => 'fblike_default_formatter',
        ),
    );
}

function fblike_field_widget_info() {
    return array(
        'fblike_default_widget' => array(
            'label' => 'Like Box',
            'field types' => array('fblike'),
        ),
    );
}

function fblike_field_formatter_info() {
    return array(
        'fblike_default_formatter' => array(
            'label' => t('Like Box (default)'),
            'field types' => array('fblike'),
        ),
    );
}

function fblike_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
    $link = '

';

    $element = array();
    $element[0] = array('#markup' => $link);

    return $element;
}

The result of this code is:

Like:&nbsp;

I already run out of ideas. I have created many modules with fields before, but none was that simple... Am I missing something?


texts: Location Module fields are not available under Search api fields

texts:
I am using Search API's Default Node index. I am using Location module to store Location data. But location module fields are not available under Search API Related fields.

I know this has been an issue but was just wondering if this could ever get fixed? I could have used Geolocation or Geofield modules and used the fields in search api. But unfortunately when i used location module i was not using Search API.

Now I have 10000 Nodes using location module to store location details.

What could be the solution? How to make these fields to be used under Search api so that i can use facets and eventually show them on MAP.?

Please help!

Thanks in advance.


texts: How to resolve the error about 'A partially-completed form was found'?

texts:
Yesterday I have updated Webform module from 7.x-4.0-beta3 to 7.x-4.13.

After doing so, I am getting this notification message, throughout the site:

  A partially-completed form was found. Please complete the remaining portions

I have also checked some threads.

When I check log entries I got this error :

  Notice: Undefined property: stdClass::$is_draft in webform_client_form()

And deleting partially filled nid in webform submissions table is not working for me.

What can I do with it?


texts: How to show event calendar with active links and event details underneath

texts:
I wanna show a page with calendar by month and all the upcoming events that fall within that month underneath.

So, on the page, I'd have this calendar that shows the current month:

Underneath I want the details of the events that fall in this month.

Any idea which module I should use and how can I achieve that in Drupal 7?

Thanks.


texts: How can I tell which Feature something belongs to?

texts:
I am working on a site that has maybe 100 different Features. I am editing a block, which I assume is attached to a Feature.

Without looking through each Feature individually, how can I tell which Feature this block belongs to (or even if it is Featured at all?


texts: How do I periodically import from a source?

texts:
In the basic settings of a feeds importer there is a select list:

Periodic import
Every 30 min
Choose how often a source should be imported periodically. Requires cron to be configured.

Merely selecting an option doesn't appear to import from my source every 30 minutes. It appears that I have to configure cron too. I've found a lot to read about this, but nothing that describes the basics.
What do I need to do to ensure my source is imported periodically? I can do a manual import without problem.


texts: Allow only static IP to reach the admin panel

texts: Running Drupal on an Red-Hat instance, how do I configure the server to only allow it's back-end to be reached from a specific static IP?


texts: Output an empty alt tag for an image in with views?

texts:
I have an image field in a view. How can I output empty alt text for the image.

(For decorative images this is the correct markup
http://www.w3schools.com/tags/att_img_alt.asp )


texts: How do I attach a library to contact forms?

texts: Simple question, I just need to know how to attach a library to Drupal 8's contact forms.  I recently made a similar post for attaching a library to a view, that was accomplished by adding {{ attach_library('mytheme/mylib') }} to views-view--myview.html.twig, but doing the same to contact forms is less obvious.  If the preferred way to attach a library is through twig templates can someone please advise me on what the naming convention is for contact-form twig templates?


texts: How to set the number of front page's promoted nodes?

texts: Is it possible to set the number of front page's promoted nodes and thus display a pager?


texts: Problem w/ Migrate Source CSV importing Body content w/ HTML

texts:
I am using migrate_source_csv to import node body fields. The header for my CSV file is: "nid, title, body". The body fields contain HTML. My problem is that, on import, the HTML is being encoded into literals. See the screen grab below. Here is my migration YML file:

id: news_article_nodes
label: News article data we want.
migration_group: gdg_group
source:
  plugin: csv
  path: 'modules/custom/gdg_migration/import/news_article/news_articles.csv'
  ids: [nid]
  header_row_count: 1
process:
  nid: nid
  title: title
  'body/0/value': body
  'body/0/format':
    plugin: default_value
    default_value: full_html
destination:
   plugin: entity:node
   overwrite_properties:
     - body
   default_bundle: news_article

I must be missing something. Is there a plugin that imports the data as plain text?


texts: I have created two content types A and B. I have a Date field in A which is referred in B. But in B I want to display the Date field separately i.e 3 different select list for month, year and day.


texts: How to access the full html of a drupal basic page?

texts:
This is probably a dumb question. But I have not been able to find the full html of a basic page.
When I create a basic page, I can put a title and texts/images in the body. How can I access the <head>...</head> portion of a specific basic page so that I can edit that part and put a js script? or better yet the full html of the page?

Thanks!


texts: JavaScript and CSS settings fail unexpectedly: The files were not created

texts:
Possible Duplicate:
  Drupal Commons site has no style after installation

See the Drupal Commons site running on boysday.org

well how to start. i am new to drupal and I have serious flaws during the installation; Tried it dozens of times.I get warnings about too many files open. Somebody gave me the advice to do the adjustments in the administrative section (admin/settings/performance).

On "Bandwidth optimizations,"  the option "Optimize CSS files" and "Optimize JavaSript files" were enabled. I have tried to switch off; for testing and customize my Drupal Commons install it's better to disable as to have CSS and JavaScript development support with tools like "Firebug" using Firefox.

I tried to do so, and got back a very interesting message.

  Performance

  The file could not be created.
  The file could not be created.

Can this be caused by the fact the folders in /home/vhost/WWW/mysite/sites/default/files were all owned by the wwwrun user? What can I do?

There are no pictures, and no CSS. Is there any right or permission problem?

  warning: array_map() [function.array-map]: Argument #2 should be an array in /home/vhost/WWW/mysite/modules/system/system.module on line 1020.
  warning: array_keys() expects parameter 1 to be array, null given in /home/vhost/WWW/mysite/includes/theme.inc on line 1832.
  warning: Invalid argument supplied for foreach() in /home/vhost/WWW/mysite/includes/theme.inc on line 1832.


texts: Edit weight of block without using drag and drop

texts:
I'm attempting to reorder blocks. I understand that it can be done by dragging and dropping on the block structure page, however I have a limitation.

When saving, the order isn't saved. This is most likely because there is a very large number of blocks and the server can't handle that many inputs in one form. So it just reverts to it's original position. I do not have access to the server so I'm unable to make the changes to allow the server to handle that many inputs.
I also do not have access to the mySQL database.

I'd like to be able to change the weight manually within the block, but weight is not a field I can edit when attempting to edit that specific block.

Is there a way to add this field? Or is there another possible way to perform this action?


texts: What is the right way to use a different base theme for some pages when applying custom theme?

texts: I know that custom theme usually inherited from the "stable" theme, and the default backend theme is "seven. I like the UI of "/user/login","/user/register" and "/forum" pages. If I use a custom theme inherited from "stable", how can I make the UI apperance of these special pages stay in "seven" theme? I tried to set the "base theme" to "classy" or "false", but the theme suggestions still choose the "stable" as a default.


texts: Is it possible to create views pages with urls like "prefix-%-postfix" instead of "prefix/%/postfix"?


texts: Prepopulate entity reference field from url in node create form block

texts:
please help. I have tried so many ways to solve the following problem but did not succeed. I really need your support on this one.

Here is the problem:
There are 2 content types : Fruits and Apple.

Apple content type has an entity reference field to fruits content type.

Now, whenever I view a node of type fruits, the entity reference field in apple add form should prepopulate to fruits node title.

Please see the image below. It will make everything clear.

Is it possible to prepopulate the field? If yes, how? Thanks.

The modules I am using right now:
1.Panels
2. Entity reference
3. Form Block
4. Entity reference prepopulate.

As per the suggestion from Sinan Erdem , I checked http://drupal.org/node/494008 . The code is below . It still doesn't work. :( Can you tell me why?

    <?php
/** hook_form_alter **/

function pp_form_alter(&$form, $form_state, $form_id) {
// Check for a particular content type's node form. Form name is [content_type_name]_node_form
  if ($form_id == 'apple_node_form') {
    // Add an after_build function to process when everything's complete.
    $form['#after_build'][] = 'pp_after_build';
  }
}

/**
* Populate entity reference field
*/
function pp_after_build($form, &$form_state) {
  // Obtain node object from nid in url
  $entityreference_field_category = node_load(arg(1));
  //populate autocomplete entityreference field with node title. Name of field is field_[field_name].
  $form['field_category'][0]['nid']['nid']['#value'] = $entityreference_field_category->title;

return $form;
}
?>


texts: Multiple instances of a field, differently formatted - how?

texts:
And if I wanted a particular field displayed on a node twice, but each instance built with a different formatter - what should I do?
Example: a term reference field - formatted as plain text at the top, and as a link - at the bottom of a page.


texts: Drush does not get upgraded using composer

texts:
I got the following in composer.json:

"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.24",
    "wikimedia/composer-merge-plugin": "^1.4",
    "drush/drush": "^8.1.15",
    "drupal/core": "^8.4.0",
    "phpunit/phpunit": "^4.8",
    "drupal/console": "^1.0"
},
"replace": {
    "drupal/core": "^8.4"
},
"minimum-stability": "dev",
"prefer-stable": false,

However when I go composer global update, drush does not get upgraded as per:

vendor/bin/drush --version
Drush Version   :  8.1.9

Why is this happening?


texts: How to remove "display name" from edit user

texts:
I'm building a site that leverages the user email address for the user login instead of a username (via modules Logintoboggan  & Email Registration). I'm also using Real Name to display the "first name" field of the user instead of the username.

My solution is working perfectly apart from when the user is on the edit user account page (and some native drupal system notification message), which displays a "Display Name" field instead of the desired "first name" field.

Question: How can I remove/delete the "Display Name" field from the edit profile page and Drupal system messages/notification fields?


texts: Display entity reference field in a views block

texts:
I have two content types, "Contributor" and "Story".

Contributor has the following fields
1. Default title/label
2. Job title
3. Email address

Story has many fields, but includes an Entity Reference field that accepts multiple Contributor nodes.

When viewing a Story node webpage, I would like to have the "contributors" entity reference field to be displayed within the right sidebar using a views block. It should output all contributors that have been related to this Story node.

I have attempted to create a views block of Contributor nodes using Contextual Filters, but have not been able to output the contributors related to that story node. Are contextual filters the right method or should I have Relationships configured as well? If I have not set any contextual filters, all of the Contributor nodes are listed, but I can't seem to figure out which contextual filter and settings to use.


texts: Making File Size visible to anonymous users

texts:
I have media installed for file handling, and am displaying download links for my files using display suite.  I have the file size being loaded in as a dynamic field loading token [file:size].

Everything works fine while I'm logged in as admin, but when I view the page as an anonymous user, the file size no longer shows up.  Any thoughts?


texts: Personal contact form button if available

texts: How can I add a button to the user twig template that links to their personal contact form, but only shows if that user has the form available, and the person viewing the page has permissions to use it?


texts: page-new.tpl.php shows page not found in browser title

texts:
The page displays fine, however; the browser tile shows Page Not Found | main title of site.

How can I apply a proper title to this custom page when another page controls the header ?


texts:
I am just wondering. Is it possible to allow duplicate urls with pathauto. In some projects the "duplicate content penalty" does not matter: Internal projects, shops (products)...

Anyway, how do I configure pathauto to allow such duplicate/generate them:

I have an article with two taxonomy terms apple+pear

[node:field_category]/[node:title]

results in

apple-pear/node-title

what I looking for is:

apple/node-title
pear/node-title


texts: Panels- How can I show the related terms pane only if the term being displayed has only the root as parent?

texts:
I am using the awesome Panels module to override the default taxonomy display.  I am using the Related Terms content pane (built-in to Panels) to show children of the current term.

My vocabulary looks like this:

Country
State
City

What I would like to do is show the child terms (related terms pane) only for countries, not states or cities.  In other words, I would like to show the related terms pane if and only if the term has no parents except the root parent.

However, the only Visibility Rule that seems to apply is Term has Parent(s), which requires a user-created term (not the root term) to be selected.  I could select all of the terms and then check Reverse, but I have hundreds of locations and more are being added all the time, making this unfeasible.  Is there some other way?


texts: Computing statistic values and sorting views result

texts:
I want to show views results in specific order.
[( yearly view count / 365 ) +
( monthly view count / 30 ) +
( daily view count ) / 3 ]
Is there a way compute statistic values for sorting?


texts: How to add unique classes to FlexSlider slides? (default behavior in v 7.1.x - not in v 7.2.x)

texts:
I just upgraded the flexslider module from 7.1.x to 7.2.x and it broke my styling because the old version gave unique classes to each slide (also odd and even row classes to every other slide), but the new version gives each slide the same classes.

I really need to style each slide differently so I was using these unique classes.

This "feature request" is in the module's issue queue but it hasn't been touched in a long time and I lack the skills to fix it myself.

Does anyone know how I can give each Flexslider slide a unique class, either using jQuery, PHP or maybe some other module?


texts: How to get notifications in a new window when using the Mentions module?

texts:
I am using the Mentions module to be able to tag other users in a posts.

I also installed the Rules module and made a new rule which sends email and shows a message on site if the logged in user is mentioned in a blog.

But I need notifications like this to be displayed in a new window.

How can I achieve that?


texts: Views Slideshow only shows one static image and doesn't cycle in IE8

texts:
I have a slideshow that runs through numerous images on the homepage of a site. The slideshow works perfectly in Chrome and Firefox, but simply shows a static image in IE8. On IE8, a Javascript error is returned as follows:

Message: Object doesn't support this property or method
Line: 160
Char: 5
Code: 0
URI: /sites/all/modules/views_slideshow/contrib/views_slideshow_singleframe/views_slideshow.js

The Drupal settings JS is as follows:
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "admin_menu": { "margin_top": 1 },
"admin_menu_dropdown": { "key": "`", "default": 1 }, "colorbox": { "transition":
"elastic", "speed": 350, "opacity": "0.85", "slideshow": false, "slideshowAuto":
false, "slideshowSpeed": 2500, "slideshowStart": "", "slideshowStop": "", "current":
"{current} of {total}", "previous": "« Prev", "next": "Next »", "close": "Close",
"overlayClose": true, "maxWidth": "100%", "maxHeight": "100%" }, "CTools": {
"pageId": "page-4d858fb47100047beb7ca4246959a972" }, "extlink": { "extTarget":
"_blank", "extClass": "ext", "extSubdomains": 1, "extExclude": "", "extInclude": "",
 "extAlert": 0, "extAlertText": "This link will take you to an external web site. We
are not responsible for their content.", "mailtoClass": "mailto" },
"viewsSlideshowSingleFrame": { "#views_slideshow_singleframe_main_main_panel-block_1": {
"num_divs": 7, "id_prefix": "#views_slideshow_singleframe_main_",
"div_prefix": "#views_slideshow_singleframe_div_", "vss_id": "main_panel-block_1"
, "timeout": "5000", "sort": 1, "effect": "fade", "speed": "700", "start_paused":
null, "delay": "0", "fixed_height": "1", "random": "0", "pause": "2",
"pause_on_click": "0", "pause_when_hidden": 0, "pause_when_hidden_type": "full",
"amount_allowed_visible": "", "remember_slide": 0, "remember_slide_days": 1,
"controls": "0", "items_per_slide": 1, "pager": "0", "pager_type": "Numbered",
"pager_hover": "1", "pager_click_to_page": 0, "image_count": "0", "nowrap": "0",
"sync": "1", "advanced": "", "ie": { "cleartype": "true", "cleartypenobg": "false" }
} } });
//--><!]]>


texts: Flag commerce product variation breaks page

texts:
I am building a shop on Drupal 9 ,Commerce 2, and want to implement a "my favorite products"-bookmark, so that a user can bookmark products and save them for later. So, I installed flag module and created a flag for product variations which shows up in my products -> variations types -> variation -> manage display as follows:

I flushed all caches, went to the site, and it throws the "the website encountered an unexpected error"-error. In the logs, it says:
"DomainException: When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #attributes, #ajax_replace_class, #type, #optional, #process, #pre_render, #theme_wrappers, #defaults_loaded. in Drupal\Core\Render\Renderer->doRender() (line 335 of /home/domain.com/public_html/core/lib/Drupal/Core/Render/Renderer.php)."
When I set a bookmark flag for a product type (not product variation type), It doesn't break my site, but the bookmark link simply doesn't render (in Bartik theme).
Does anybody face similar problems with flag and commerce or can anyone point me any way to make it work? Should I build products as content type nodes instead of commerce products, to make it work?
Thank you very much in advance! Everything I can find is old patches and discussions about Drupal 7 and commerce...


texts: How to get the label values for list fields in Twig?

texts:
I'm trying to fetch the label of the list and display it on the twig template.

Using node.field_list.value outputs the key value. I tried using node.field_list.label but it returns empty. I tried using node.field_list.title, node.field_list.0.label or node.field_list[0]['#markup'] but it still returns empty on the twig template


texts: Do I need to add my IP in settings.php and change settings.local.php if I'm only doing web host? Because I would like to fix the status report about no trusted host patterns. Thank you all for helping


texts: How can I render multiple values which belong to the same field?

texts:
I have a content type with a text field "Person", which assumes up to 3 possible options. I am trying to render a block, where I would display this field with three presons.

if(\Drupal::routeMatch()->getRouteName() == 'entity.node.canonical'){
  $node = Node::load(\Drupal::routeMatch()->getRawParameter('node'));
  if($node->bundle() == "people"){

    // CONTACT
    $render = array();
    if($field = $node->field_contact_person->first()){
      $field = $field->getValue()['value'];
      $render['#markup'] = '
'.$field.'
';
      $render['#prefix'] = '

'.$this->t('Contact person').'
';
      $render['#suffix'] = '
';
      $block['#markup'] .= render($render);
    }

  }
}

The issue is that it fetches only first value. How can I fetch all values and render them in the block?


texts: How can I define a custom Contact Form in an Installation profile / distribution?

texts:
Question : How can I define a custom Contact Form in an Installation profile / distribution ?

Goal :

Research : :
It's for an installation profile we want to put an contact form in all our Drupal installations in the install profile. It's a little bigger than the default Drupal 8 forms. I have also content-types created for that profile with YAML-files. We can build forms in a module with the Form API but how can we that achieve that in an install profile ? In Drupal 8, i think all the configuration is in YAML.

Expected solution : I want to rebuild the form and put it into an installation profile with the captcha included. I used there the Drupal module Re-captcha for. Is this also with the YAML-files or in _install function ?

Is that possible ? Are they better/other methods for achieving this goal ?


texts: Inline entity form: Allow add existing nodes only for specific node types and node author

texts:
I use the "complex widget" of the inline entity form (IEF) module.
The user should be able to create new nodes of a specific type and also add already existing nodes with the field form.
My problem:
When the user adds an already existing node (entity) I found no way to limit the referenced entities yet. There appears a select list with the node content type and then the user can choose every node.
I want to limit the choice by

only a specific node content type and
only showing nodes of this content type where the current user is the author.

Is there a possibility to limit the choice perhaps by a view?
Thanks in advance


texts:
I use Drupal 9.1.4., core Contact module, Contact email module and Contact storage module.
How to use the author as a referenced entity to send email to author of content (in this case autor of article) when submiting simple Contact module form?
Thanks,
Tom.


texts: How can I avoid a warning about the PHP mbstring extension?

texts:
In the process of updating a Drupal module (update.php, very first instance) have found this message:

  "Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support. (Currently using Unicode library Standard PHP)"

Does anyone know the implications of not installing this PHP extension in Drupal 6?


texts:
I currently have a page http://proctors.org/tv that is driven by several views and attachments with tons of jQuery and hacked-together JavaScript spaghetti, and I would like to clean it up. I understand that newer Javascript "MVC" frameworks make use of templates, and don't strictly store all the data in the DOM as you might do with jQuery.

I believe you would use something like Services and/or Views as the backend, with Backbone on the front.

There is a D.o project for Backbone, and I remember there being a BoF or Session at DrupalCon Denver about it...

I am hoping to discover if it is worth my time to try and rewrite this in a new framework or just clean up what I have here.


texts: Configuring mail function in multistep form submission handler

texts:
I have been working in a multistep customer-survey form and i am unable to configure and send mail after the form is successfully submitted.

Here's is code for submit handler,

function customer_survey_personal_details_submit($form, &$form_state) {
  $multstep_values = $form_state['multistep_values'];

  $module = 'customer_survey';
  $key = 'customer_survey_complete';

  $to = $multstep_values['personal_details']['email'] . '; ' . variable_get('site_mail', 'admin@example.com');
  $from = variable_get('site_mail', 'admin@example.com');

  $params = array(
    'body' => 'Thank you for filling in our survey. You have now been entered into our prize draw.',
    'subject' => 'Thank you for filling in our survey, ' . $multstep_values['personal_details']['name'],
  );

  $language = language_default();
  $send = TRUE;
  $result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
  if ($result['result'] == TRUE) {
    drupal_set_message(t('Your message has been sent.'));
  }
  else {
    drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');
  }
}

I did configure my mail address in the $from variable but it didn't worked.

I am able to send email from other modules.

What could be the problem?

Can someone suggest me a possible solution?

UPDATE:

Thanks @Mołot for the dpr($result);. I found that the problem resides with my $to variable.If i explicitly give the recipient email address, the mail is sent successfully..

It will be helpful if someone could say what is the problem in this line of code,

$to = $multstep_values['personal_details']['email'] . '; ' . variable_get('site_mail', 'admin@example.com');

I replaced recipient mail address instead of admin@example.com. But it didn't work.


texts:
I have a custom block type created through the UI and I used the configuration files to export it to a module.
My custom block type has two fields and I want users to be able to fill out one or the other, but not both.

Is there way to implement that logic through the UI?
If not, how can I create the custom block type in code and add this logic?


texts: Remove a code from core module without modifying it(using hooks?)

texts:
Referring to my question about the removal of "Add new comment" link from the book page links area, is there a way to remove the code with the help of hooks. I am new to implementing hooks. I have found the solution to the problem, but I need a better way to implement it(maybe by hooks, idk).

Edit
I did face a similar problem when I had to comment out the print $tree from the core book module's book-navigation.tpl.php, as it was printing the tree at the bottom of every node, and I didn't want it that way. I used the tree navigation block in my sidebar to navigate through the tree structure. Is there a quick way to do this?


texts:
I have a site; www.example.net. If you type www.example.com it redirects to www.example.net which is okay.

On my site i have to different language prefixes /da and /en that you can switch between.

My question: is it possible to redirect all who try to visit the site via www.example.com to www.example.net/en?


texts: right sidebar doesn't shrink in zen responsive theme

texts:
I have a Zen 7.x.5.x Responsive subtheme with Right sidebar...

I know, I am new with all this responsiveness staff; but - I think the right sidebar doesn't shrink when I resize my browser....it just moves inside, staying about the same size....or may be I don't understand something....

so, I have made up my content area - it consists now from 2 blocks floating left and right; I put them width proportionally to content area : 67% and 33% - they resize, when I resize browser....but sidebar looks too big and not shrinking; even it seems to be set in percents from page's 1200px.....


texts:
We have complaints that are related to caching. A Global redirect URL points to a  PDF file on the server. People claim they get an old version even after an FTP update.

Using Apache 2.4 D7 and Global Redirect module.  URL is in a block (example.com/newsletter) which redirects to sites/files/upload/newsletter.pdf

I don't even know if this is client side or server side caching, but I want to make sure that caching expires daily.

Possible approaches:

Use drupal file system to manage this as a field
change the redirect type (gloabal redirect supports a few: like 301, 304,307,etc)
Add something to the a href tag ?


texts: SQL query to access a field collection's data? At them moment, I'm only getting field_collection_item returned

texts:
In the below example, I am trying to return the value of a field from all the field collections in the database but only get field_collection_item. This example is just the most basic field collection sql possible.

SELECT field_collection_item.item_id AS item_id, 'field_collection_item' AS field_data_field_grade_decimal_field_collection_item_entity_
FROM
field_collection_item field_collection_item

What do I need to change in this example? My SQL is terrible unfortunately. I just can't return any values from field collections using sql. I need to be able to do this for Forena Reports.
I'm getting the above code from views which returns the field collection values.


texts: Apache RewriteRule seems to be ignored for Drupal sites

texts:
I've set up an Apache rewrite rule to redirect all sites from one subdomain to another - one ruleset for each site:

<Directory /var/www/PATH_TO_WEBROOT_X>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(.*)\.subdomainOLD\.com$ [NC]
    RewriteRule ^(.*)$ http://%1.subdomainNEW.com/$1 [L,R=301]
</Directory>

Also each site virtualhosts has the old and the new domains, eg:

<VirtualHost *:80>
    DocumentRoot "/var/www/PATH_TO_WEBROOT_X"
    ServerName foo.subdomainNEW.com
    ServerAlias foo.subdomainOLD.com foo.subdomainNEW.com
</VirtualHost>

This seems to work, except when it's a Drupal project (in case of Drupal it just stays on the old domain). I've googled it and the best I've found is the DomainDefaultRedirection (https://www.drupal.org/project/domain_default_redirect) module - however I would like to achieve it without changing the Drupal config.

Is it the Drupal .htaccess that conflicts with my rules or something else?

Update: the setup is fairly standard. Drupal is generic, core 7.x. Apache2.2. All sites are enabled through virtual hosts inside sites-enabled - one config file per site. Tried to put the redirect rule to a generic apache config as well as into the site specific virtual host. The directory is matched always against the targeted site directory.


texts: Uploaded files are not showing correctly in some users

texts:
Uploaded files are not showing correctly in drupal 7.12. However this issue occurs only with some old users and newly created users are working fine.

what might be the cause of the issue. Can anybody please suggest/help to fix the issue?
Thanks in advance!
http://prntscr.com/7ang7h


texts:
I have a locally multi-site. Locally Drush works perfectly fine. But When I try to clone this project in different machine I get this error in Acquia Dev Desktop:

I also tried to run a Drush command via SSH and get this error:

Is any configuration that I am missing?

Is there another way to update my DB with config files?

Thanks in advance


texts: Need help finding source of CSS in Drupal code

texts:
I've added the share42 module, customized, downloaded it an installed it. It used to work fine. And it still works fine on my local development environment. But its not working on my production environment.

The steps to configure this module, are:

install the share42 module
customize the buttons: http://share42.com/
download and install the image and js script you created in step 2 in the all/libraries folder
put some code in the node.tpl.php file

I did all this, and like I said it looks fine on my development environment. However, when i push it to production it's all messed up and doesn't look right. I cleared caches and ran cron multiple times. I deleted my browser cache. Nothing.

So I did an inspect element on the  that's outputting the share42 buttons on the production server. It's showing some inline styling that I didn't add. So I clicked the linked word 'inline' and it shows me the code for the entire page (just a random node). I don't see the inline styling anywhere on the page referenced in inspect element! It just shows the .js file I'm bringing in via . I've looked at that code though and copied and pasted the contents of my local .js file with the one on the production server and they are identical.

Note: I also deleted and replaced the entire /sites folder on the production server, and the bad styling is still there.

So now I'm a bit exasperated. Not sure what else to try to find out where the incorrect styling is coming from. Anyone have any other suggestions for places to look?


texts: Devel kpr, dpr, dpm, etc. only print after cache flush

texts:
I'm writing a small module and using the Devel print functions (dpr, kpr, dpm, etc.) to print out some values.

However, I only see the values in the page after I flush certain caches. if I just reload the page or go to it I see nothing. This is true for both the message-area and the regular debug print functions. Is this expected?

I am logged in as admin so I'd think ordinary page caching is off.

(This is in D7.)


texts:
I am using a hook_cron (mymodule_cron) in my custom module, but would like to know whether the cron run is successful or not and has sent the data using CURL, and from there, update a specific column value in my sql table. How to get this status?

Part of my codes:

$options=array(
    CURLOPT_URL            => $urlCron,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HEADER         => false
);

$CURL=curl_init();
curl_setopt_array($CURL,$options);
$content=curl_exec($CURL);
curl_close($CURL);


texts:
I have added a fee with rules using commerce_fee module.
I need to remove the fee but i can´t find a way.
How can this be done?


texts: can I use db_update to update a field ( appending a string to the current string in the database )

texts:
Is it posible to do something like:

db_update('my_module_table')->fields( array('myfield' => <myfield> + 'newstring') );

Or do I have to load the field value first by using db_select() ?

Maybe someway with db_query() ?


texts:
How can I place visitor stats in a page from Counter module in Drupal 6?
I'm looking for the php Code. Maybe it can be done with:

<?php print theme(); ?>

but I don't know the exact code.


texts: Creating, modifying and removing folders and folder structures in Drupal 7

texts: I know that it is possible to delete files from the File Browser view, but is there a way to create, modify and remove folders in Drupal 7?


texts: How to validate if node is ubercart product?

texts: Im sure this is something simple, but I would really appreciate some help with it. How to check by php if the node is an ubercart product? Empty sku field might work but how can it be accessed ?


texts:
My webform allows file uploads, but I want to save them in a specific folder within the private folder (private://form_name/submission_id/original_file_name.ext).  How do I do this?
I see the Rename files option, but I am unsure what token I could use to maintain the original file name and/or specify the path.


texts: Prevent directory permissions of sites/default from being protected in a local environment?

texts:
Drupal automatically changes the directory permissions of sites/default to 555 (i.e. read-only), which means that if I'm editing sites/default/settings.php, even if I've set the permissions for that file to read/write (which it again reverts on a page load), PhpStorm still gives me a permission denied error on the swap file it's attempting to create in the same directory.

Is there a more flexible way to update settings (especially on
a dev machine) other than manually setting the file and directory
permissions every time you need to edit those files?
Do I just have to do it via sudo?
Can I disable permissions checking for a specific environment?


texts:
I have some views I want to keep, and maybe use in the future.
currently I am not using them and want to disable the path, or leave it as "No path is set".

but all the I'm I am getting the following message:

  Display "VIEW" uses a path but the path is undefined.

can someone tell me how can I leave a view as "No path is set" and be able to save that  not set?

Thanks!


texts:
I have an entityform called 'foia_generator' and I'm trying to embed it as a contact form on a page (the tutorial I used is for embedding entityforms in blocks) ... hence my problem...

function foiagen_form($form, &$form_state) {
    module_load_include('inc', 'entityform', 'entityform.admin');
    $entity_form_name = 'foia_generator';
    $render_estimate_form =
    entityform_form_wrapper(entityform_empty_load($entity_form_name), 'submit', 'embedded');
    echo drupal_render($render_estimate_form);
    return $form;
}

This displays the form but it's not 'inside' the normal bounds of the site (using bootstrap subtheme) i.e. it's not rendered properly - it appears before the regular divs like the navbar etc... and spans the entire width of my screen.

If I can't do it this way can I programattically embed the 'entityform' on my 'contact page' as an entityreference field, (rendered)?

Thanks


texts:
I want to override the default views-view-fields.html.twig so that I can display specific fields in a bootstrap layout, e.g.

{{ fields.field_name_1 }}

{{ fields.field_name_2 }}

{{ fields.field_name_3 }}

We have all this important code in that file that gets repeated for each field in the loop: -

{{ field.separator }}
{%- if field.wrapper_element -%}
  <{{ field.wrapper_element }}{{ field.wrapper_attributes }}>
{%- endif %}
{%- if field.label -%}
  {%- if field.label_element -%}
    <{{ field.label_element }}{{ field.label_attributes }}>{{ field.label }}{{ field.label_suffix }}</{{ field.label_element }}>
  {%- else -%}
    {{ field.label }}{{ field.label_suffix }}
  {%- endif %}
{%- endif %}
{%- if field.element_type -%}
  <{{ field.element_type }}{{ field.element_attributes }}>{{ field.content }}</{{ field.element_type }}>
{%- else -%}
  {{ field.content }}
{%- endif %}
{%- if field.wrapper_element -%}
  </{{ field.wrapper_element }}>
{%- endif %}

So I want to avoid having to repeat this over and over for each field that I manually arrange. What's the best approach here? I tried overriding the views-view-field.html.twig files but I can't seem to get to the same variables.

What's the best approach?

Thanks :-)


texts: Is there a module for scalable input / output for unlimited value fields?

texts: In a field with unlimited values a user may easily enter 100+ items. While the db does allow unlimited entries, the client side input does not seem too scalable since it shows all values on the same page. Perhaps some kind of paging or Views would be great. Is there such a module?


texts: How to stop Drupal for setting node changed date on creation?

texts:
This is my second question about my issues with creating custom migration script.

I am creating only new nodes and don't care about updates.

Code:

        $node = new stdClass();
        $node->type = 'migrate';
        $node->title = $content['title'];
        $node->language = LANGUAGE_NONE;

        $node->created = (int) date('U',strtotime($content['created']));

        $modified = $content['modified'];
        if (! empty($modified) && $modified != '0000-00-00 00:00:00') {
            $modified = (int) date('U',strtotime($modified));
        } else {
            $modified = 0;
        }
        $node->changed = $modified;

        node_object_prepare($node);

        #some lines later
        node_save($node);

E.g my $modified is set to 0 and after save I see updated column of this node row in admin content list with current datetime value.


texts: How can I pass multiple values to drupal_view()?

texts:
I'm on Drupal 8 and I have a view with multiple argument (list of node ID) but I can't embed this on my node.twig.html.

That's my code:

{% set myArray = [] %}
{% for item in content.field_articles_lies['#items'] %}
    {% set myArray = myArray|merge([item.entity.nid.value]) %}
{% endfor %}

{{ drupal_view('articles_lies','default', myArray()) }}

if I do that: {{ drupal_view('articles_lies','default', myArray.0) }}
it's ok but obviously only for one.

How can I pass an argument with multiple values to a view rendered via drupal_view() in a template?


texts: How to pass a variable about sufficient User Points to a Rules condition in another rule?

texts:
I used this link to set up a UserPoints Store: Drupal 7 - How to Set up a Simple UserPoints Store.

For some reason when I buy (flag) a node (store item) and for quantity I put more UserPoints, than the transaction is not blocked, which results in a negative user points balance.

Problem:

Either this issue is addressed and I set some wrong settings(I double checked everything so I don't think so)
I need to make my own custom setting for the UserPoints not to enter negatives.

Is there a way I can set and pass a variable (enough_points=true) from (1st) rule "Check User Points" and then use it as a condition in (2nd) rule "Flag item"?


texts:
How to delete these tables "views_data_export_index_%" create by views data export
module, the database getting huge.