texts: Getting total vote results for several nodes in a view (Drupal 7, Views 3)

texts:
This is the problem: I have a Drupal 7, Views 3 site with a certain node type with a Fivestar field on it. I want to get total scores not for one node, but for all the nodes in a view.

For example, let's say our nodes are "restaurants". A person can write a review for this restaurant and give it a score.

Okay, now imagine some of these restaurants are thai restaurants. Now imagine I want the average score for all the thai restaurants in a view. Be careful about this, I don't want the average for one of the restaurants, but for ALL the restaurants in a given category. That's clearly a work for views, but how? How do I do that?

Thanks in advance.


texts: Arrange fields in a drupal form by multiple columns/rows

texts:
I'm trying to create forms that I can customize to display multiple elements in a column or row, instead of the current one field per line that seems to be the default.

I've been searching around for a few modules and so far have only come across one that would be able to do what I need which is Form Panel.

How do I edit or create forms where I have control of the layout? I would like to avoid code as much as possible.


texts:
E.g. My site has two subdomains : domain_a and domain_b.

And My site has three roles: role_a, role_b, role_c.

I hope:

User with role_a can login domain_a, can't login domain_b.
(When user visit domain_b user status is not logined and not lost domain_a logined status)

User with role_b can login domain_b, can't login domain_a.

User with role_c can login domain_a and domain_b.

Does anyone have any solution?


texts: Is there a way to upload file in database instead of in filesystem via webform?

texts: When files are uploaded via webform, the attachment is stored in filesystem. Is there a way to store the attachment in database blob field?


texts: Recommended approach for setting up contact management?

texts:
I need to develop a contact form that the administrator can reply to and categorize each message (Responded, Transferred, Archived, etc.) received from users.

Which would be the best approach for this?


texts: Create node and node reference from URL at one time

texts:
I have content type "article", in some cases I need to orginise group of parent and child nodes and to do this I use Node Reference from URL module. Also I need to include parent node in this group of articles because some views and node URL depend on completed field "node reference". So, how it works now:

I create a parent node and leave the node reference field empty as the parent node doesn't exist now;
Save this node
Back to edit page and choose my new parent node from the list of avalible nodes in node reference field;

What I would like to do is to create parent node and fill node reference field at the same time.

I guess that Rules module could help me but It too powerfull module and I do not need it for my website. Is there a more simple solution?


texts: Don't show a field if it is not filled in

texts:
What is the best way to don't show up a field if it is not filled in.

I have a content-type for the homepage: (Machine name: home_pagina).

There is a field for my client to give a warning-message if necessary: (Machine name: field_aandachts_tekst).

The warning message has to show up in a colored box/div. But if the field is not filled in, the box/div should not show up.

I tried to achieve this with a field-template....

I already have a "field.tpl.php" created. So i thought if a create a special field template for the field (field_aandachts_tekst) i could put the colored box/div in there. And if the field is not filled in the box/div would not show up also.

But it seems that the field-template for the (field_aandachts_tekst) is not used...

My template for controlling the view of the (field_aandachts_tekst) is called:

field--field-aandachts-tekst.php

but it seems this template is not used... (instead it uses: "field.tpl.php")

The code in my "node--home_pagina.tpl.php" looks like this:

print render($content['field_aandachts_tekst']); surrounded with php-tag ofcourse

Any tips or suggestions are good!

Thanks,
Kristof


texts: Is there a way to "hard-reset" a module?

texts: I'm not sure why, but I am having extreme problems with several modules, but most noticeably, the signup module. The problems that I am having are sudden, and were not there yesterday, so I know it isn't a problem with the design of the module. I have tried patches, but those have caused other problems. Then it occurred to me: why should I have to do anything like that? Shouldn't there be a way to "hard-reset" a module? (ie remove the module and any remnance of it from the drupal database, and start from scratch as if the module was never installed in the first place, and then go and reinstall it) I have tried uninstalling it, deleting the module files, and the re downloading it and enabling it, but I get the same errors when I enable it again. How can I be delete it as if it was never there to begin with so I can start with a clean slate?


texts: Module to view theme folder through drupal 7 interface

texts:
I am working on this site http://talikulam.com/. I need to change the slideshow images. Theme setting allowing to change caption and description only. To change the images I need to go the images folder manually.

Is there any way to do this via Drupal7 interface?

A pre build module so even client can change the images easily. The slideshow is a Flex Image Slideshow.


texts: How can I remove preview button from contact form?

texts: How to turn off preview in contact form in Drupal 8.1.x


texts: Drupal 7 Calendar - How do you disable the number link to the day page?

texts: How would you disable the links to the daily page on a calendar page view?


texts: Show help text above input and below title of a cck field

texts: Hi I am working with a drupal 7 I have created multiple content types for the site. I want to display the content of the help text of a particular cck field above the input field instead of displaying it below the input field


texts: Number of users registered daily in table format using views

texts: I need a views in table format which show number of daily registered users.


texts: how to force  image file and music file  to download with zip format in drupal 6?

texts:
i have content type to upload music and image files.i want to provide a link to the users to download those music and image files.By using force download module , i can provide the download link for the file ,but now i want to zip the file when user click the download link and so user can download the image or music file in zip format.

i have installed the pclzip module and custom formatter module and i think we can achieve this by creating custom formatter for those cck field,but i dont know how to implement it? or any other module suggestion?  thanks in advance.


texts:
How can I get the user's current language code in a view as a raw value, for example en or fr-ca?
This isn't for filtering content. I need the raw value of the users' current language to pass into a URL for a third-party tool. I added a custom text field. Then placed in some Twig code. The code is just failing to the fallback else value.
Based on other forum posts, I tried this code.
{% if language.getId() == 'en' %}
  en
{% elseif language.getId() == 'es-us' %}
  es-us
{% elseif language.getId() == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I get failed.
{% if language == 'en' %}
  en
{% elseif language == 'es-us' %}
  es-us
{% elseif language == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I still get failed.
{% if language.id() == 'en' %}
  en
{% elseif language.id() == 'es-us' %}
  es-us
{% elseif language.id() == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I still get the same output.


texts:
I am working on a website that is about history and there are some map for this website.

I am using map tag of HTML to select a part of image(map), how can I merge that <map> to  that uploaded by drupe

or how can I put the image address and merge map to it:

<map name="Map">
  <area shape="poly" coords="396,270,516,286,549,324,502,353,447,342,406,343,384,366,400,396,386,414,353,344,346,293,345,263,389,235,428,223,470,234,487,252,596,243" href="#">
</map>

Where is the path (address)  of files on drupal that I can link to it insted of the path that I give on top source


texts: Limit a View with a relationship to show only the first (by sort) relationship of each of the original entities

texts:
(note - I've tried aggregation and Distinct, see final paragraph. This is different to questions like this one about Views duplicates because I want to remove the "duplicate" relationship-derived items with the first "original" determined by sort criteria, not ID)

To give a simple use-case, imagine a shop with products (italics) and a taxonomy vocabulary 'colour' (bold) something like this. Using products here simply for an easy-to-understand use case.

Each product has a field relating to sales:

Red - Weight: -5

Fire truck. Sales: 12
Telephone. Sales: 128

Blue - Weight: 0

Whale. Sales: 0
Bottle. Sales: 914

Yellow - Weight: 5

Banana. Sales: 1,941
Submarine. Sales: 1

more...

I want something like a view which, for each term (sorted by weight, limited to the top three), shows the term name with the image of the top-selling item, as an example of that category. For example:

Red. picture of a red telephone
Blue. picture of a blue bottle
Yellow. picture of a yellow banana

I could do this using Views Field View module, with each item in a Taxonomy Term view contains a nested view of products restricted to one item, receiving a contextual filter that is the taxonomy term ID, then sorts by sales to show only the top seller. This is my "last resort" option, since Views Field View can create very complex queries. I'd prefer to avoid views within views for somethig that seems so simple.

What I've tried to make work is, making a view of terms, with a relationship to products, then sort it first by product sales then by term weight. This works, but it gives me every product with the term, and I can't find a way to restrict it. With results limited to three the above example would show:

Red. picture of a red telephone
Red. picture of a red firetruck
Blue. picture of a blue bottle

Based on an old similar question on SO, turning on Use aggregation under Advanced view settings and ticking Distinct under Query settings under Advanced view settings, I've managed to get something that removes the "duplicates" from the original list. However, because of the timing of when they're removed, the sort isn't able to apply, and it seems to simply get the first by ID, not by my sort criteria:

Red. picture of a red fire truck
Blue. picture of a blue whale
Yellow. picture of a yellow banana


texts: How can I add an end-user-friendly "Add Relation" block?

texts:
Note: I am currently using Entity Reference, but am willing to use a different module if it makes the solution easier.

I am currently developing a recipe-sharing site with two content types - "Recipes" and "Recipe books". The idea is that each user can create their own Recipe Book(s), and can add recipes to them. There are two problems with the out-of-the-box solution:

Most of these users are not tech-savvy, and there are a large number of them, so asking them to search an autocomplete "Entity Reference" form inside of the Recipe Books content type isn't the best bet.
Since many recipes will be added to each book, it would make more sense to have an "Add to Book" feature on each recipe display page (think Amazon's "Add to Wishlist" feature - then lets you choose which wishlist the object is added to).

I've already tried the Relation module with the Entity Collector block, but even though it's functionally similar to what I wanted, I couldn't quite get it working on the site and it's not at all user-friendly. I'm hoping for a simpler solution that doesn't involve a lot of custom coding, and still allows all users to interact with the content type as needed.

Thanks in advance for help / suggestions!


texts:
I want to redirect to a node after comment form submit.
But I tried  using hook_form_alter hook,the redirect not happen.
function pf_core_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){
 if($form_id=='comment_comment_form'){
   $form['#submit'][] = 'pf_core_comment_comment_form_submit';
 }
}

function pf_core_comment_comment_form_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $form_state->setRedirectUrl('<front>');
}

Please help me to fix this issue.


texts: Why Views is ignoring my field override, and printing fields regulary?

texts:
You can see the question I am reffering here

I wrote a .tpl file to override the output of some fields.
I wanted the field will be printed with html like below (and succeed on doing so).
here is the output, when I am printing the field as a panel, through panels:

      <time datetime="PT3H45M" itemprop="prepTime">3 hours 45 min</time>

For some reason, when I am printing this fields regualry or with panels, the output is fine.
but, when I am printing them through a content-pane of views, the output is:

25 min

    Prep Time:

25 min

as you can see, views printing the field with "itemprop="prepTime" and without datetime="PT3H45M".

Why is that happening, and how can I fix it?

Thanks for your help!

UPDATE:
After I used @FiNeX tip, and checked the option "Use field template", it helped me solve some issues. Now the prepTime and cookTime fields are using the field template perfectly.

But, the totalTime template, which get the value from a computed field, print the output differently between views, and the regular way.

In the regular way the output is:

      <time datetime="PT1H35M" itemprop="totalTime">1 hour 35 min</time>

As you can see, the "datetime=PT1H35M" and the hour ("1 hour 35 min") are printed perfectly.

But, with views, the output is:

      <time datetime="P" itemprop="totalTime">5700</time>

As you can see, Views now is using the template, but the output of the template is:

datetime="P" and not  datetime="PT1H35M"
"5700" and not "1 hour 35 min" (by the way 5700 seconds are equal to 1 hour 35 min)

Why views is changing the output of the template after using it?

Here is the part of the template, that is creating the "Date time" and the time as I want to print it:

<?php
function time_to_iso8601_duration($time) {
    $units = array(
        "Y" => 365*24*3600,
        "D" =>     24*3600,
        "H" =>        3600,
        "M" =>          60,
        "S" =>           1,
    );
$str = "P";
$istime = false;

foreach ($units as $unitName => &$unit) {
    $quot  = intval($time / $unit);
    $time -= $quot * $unit;
    $unit  = $quot;
    if ($unit > 0) {
        if (!$istime && in_array($unitName, array("H", "M", "S"))) { // There may be a better way to do this
            $str .= "T";
            $istime = true;
        }
        $str .= strval($unit) . $unitName;
    }
}

return $str;
}
 ?>

<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php if (!$label_hidden): ?>
    <div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>:&nbsp;

  <?php endif; ?>
  <div class="field-items"<?php print $content_attributes; ?>>
    <?php foreach ($items as $delta => $item): ?>
    <?php $time = strtotime(render($item), 0); ?>
      <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>>

          <time datetime=<?php print time_to_iso8601_duration($time); ?> itemprop="prepTime"><?php print render($item); ?></time>
    <?php endforeach; ?>


texts:
I've built website using drupal 7. Site is having store of products, for transactions using commerce, commerce_payflow_pro modules.
Requirement:
Store -> Orders table not containing used credit card details i.e. last 4 digit of credit card number, used to place transaction & card type used to place the transaction.

Please suggest solution.


texts: How do you render a View with arguments using a Computed Field?

texts:
I have a computed field and i want to output a View's - block display with arguments passed into it. Can someone provide me with an example code of how to output a view with arguments?

thanks!


texts:
I have a custom user email field,
I want when the user signs up to automatically set the email for he/she.

For example, when the username field is user1 I want set the email to user1@mydomain.com and save it in email field.

How can I do this?


texts: Caching issue with class extension of RulesDataUI

texts:
In my custom module I am trying to extend RulesDataUI class as below in the code which works fine just after clearing the caches, but on the next page reload I get warning as "Warning: class_implements(): Class RulesDataUICheckboxes does not exist and could not be loaded". I am not getting a clue how the class functions are invoked only just after cache clear.

The below code is present in my module name.rules.inc(nodequeue_rules.rules.inc)

 function nodequeue_rules_rules_data_info() {
      $return = array(
        'checkboxes' => array(
          'label' => t('checkboxes'),
          'ui class' => 'RulesDataUICheckboxes',
          'token type' => 'rules_text',
        )
      );
      return $return;
    }

class RulesDataUICheckboxes extends RulesDataUI implements RulesDataDirectInputFormInterface {
  public static function getDefaultMode() {
    dpm("hi");
    return 'input';
  }
  public static function inputForm($name, $info, $settings, RulesPlugin $element) {
    dpm("called");
    if (!empty($info['options list'])) {
      // Make sure the .rules.inc of the providing module is included as the
      // options list callback may reside there.
      $element->call('loadBasicInclude');
      $form[$name] = array(
        '#type' => 'checkboxes',
        '#options' => call_user_func($info['options list'], $element, $name),
      );
    }
    else {
      $form[$name] = array(
        '#type' => 'textarea',
      );
      RulesDataInputEvaluator::attachForm($form, $settings, $info, $element->availableVariables());
    }
        $settings += array($name => isset($info['default value']) ? $info['default value'] : NULL);
    $form[$name] += array(
      '#title' => t('Value'),
      '#default_value' => $settings[$name],
      '#required' => empty($info['optional']),
      '#after_build' => array('rules_ui_element_fix_empty_after_build'),
      '#rows' => 3,
    );
    return $form;
  }
    public static function render($value) {
    return array(
      'content' => array('#markup' => check_plain($value)),
      '#attributes' => array('class' => array('rules-parameter-text')),
    );
  }
}


texts: Display a node counter, by specific content type?

texts:
How can I display a counter e.g. Total News: 999, Total Blog posts: 123, etc. ?
(looking for d6 solution actually)


texts: Login Users action in, $action_links, how do i edit it?

texts:
I am still very new to drupal and have let to use all the hooks and coding needed to do everything, now I have come up with a problem, which I can not seem to fix either with a module or by looking at code posted online.

I am using the forum core module from drupal 7 to build a forum, within my page.tpl file I have the render($action_links) option printed on each page. This works fine for logged in user. It displays a 'add new forum topic' as a link. However when a non-user views the forums, its displays 'Log in to post new content in the forum'.

My problem / issue is that only the 'Log in' words are linked to the user login in page and not the whole text. I would like to move the  tag drupal placed after the 'Log in' and move it to the end of the text!

I think I would have to use hook_menu something but I can't really find any information on how to do this for the $action_links. All the hook_menu options I find seem to deal with controlling the main menu output.

Any help give would be most welcome...

Thanks

Glenn Curtis


texts: How can i change the confirm page text in simplenews

texts:
how can I change this text or translate it:

Are you sure you want to add s*****@y*****.com to the sizing mailing list?

You can always unsubscribe later.

this is the page after click on confirm link in email ?

I've tried string override module but it can't change that .


texts: How to translate Groups in a multilingual site?

texts:
I have created a new grouptype and added some fields to have a "site". And then created a new group with this grouptype. I edited the overview site with some information. Now I would like to translate the site, because I have an multilingual site. Unfortunately I can't find out how to do so.

Is it possible to translate a groupsite on a multilingual site?
Or do I have to create two groups for that?


texts:
I have a Drupal site and the standard language is Danish. However the date on the nodes is rendered in English. I can't figure out why.

If i put a date field in a content type it displays correctly following my custom date format.

Any suggestions on how to solve this?


texts:
I have created node there path is "content/book/book-name-alias".
Where
I have override a node using view page "content/book/%"
where
contextual filter using "Node Id".

When I have request a page using "book/content/9" a node will override but same node "book/content/book-name-alias" it is not working.

How to override a node using an alias?


texts: How to hide row cell when using table in forms?

texts:
I have a field widget that has multiple values per field and some are values or other form types that do not render any visible data. I want to use the table element to encapsulate these fields into proper structure.

The issue I have is that for each field within the "field"(ie. table row) a table cell is created, even for values, which resutls in empty 	. Sure, I can use the colspan on headers but that also requires adding some css styling to hide those empty cells to avoid padding/margin offsets from those empty cells.

So I am wondering if it is possible to somehow tell the row which fields to put together into one cell or maybe render them outside of the table itself. I could use a custom template but I need to use the tabledrag so I don't want to reinvent the wheel.

I also don't want to alter the structure of those fields since it is very important the structure stays the same. although I could probably fiddle with array parents, I'd rather not.

So ss there a simple way I can get rid of those empty cells that hold values and hidden fields?

--
I have found an old Drupal issue when I was going through the Table code https://www.drupal.org/node/1248940


texts: Anonymous access to paid downloads using unique link

texts:
Is anyone aware of a solution using Drupal Commerce (or alternatives) whereby I can have a product which can go through the following sequence:

anonymous user places in cart
anonymous user goes to checkout
payment is completed
a unique token/string is assigned to the email address provided in purchase
a url from which an anonymous user can download the purchased file is created and emailed to the address provided as well as displayed on checkout completion screen
after a defined period of time the link would expire
non-expired links could then be retrieved via a form by supplying email address to resend them

I can achieve most of the above with commerce_file but it seems that it requires logging in to the user account to access paid for downloads.

Seems like this would be a use case that would not be completely unique so hoping someone has an idea of how best to achieve this without having to roll my own solution.

Thanks in advance

Rich


texts:
I have a view that loads a content type's images in a jcarousel format. They are arranged to show 3 items at a time.

How do you make any item clicked/selected on the jcarousel move to
the middle?
Is it possible to customize the jcarousel to do a $_GET and read
from the url as to use this as the image to be set in the middle?
If #2 is possible, can this be implemented via AJAX/jquery?


texts: webform alter default value template.php

texts:
I need to alter the default value of a webform in d6, so in my template.php I insert the following function, but it does not work; I don't like to use $get in webform.

function themename_form_alter(&$form, &$form_state, $form_id) {
  if ('webform_client_form_id' == $form_id) {
    $form['id_of_input']['#default_value'] = $node->field_cck_value[0]['value'];
    return $form;
  }
}

Can you help me?


texts: Drupal 8, override User Class for a custom added field

texts:
I am not a great POO specialist, maybe my ask will seems stupid x)

When I create new field from the user UI administration, I would like find quickly this field when I work from my IDE in customs modules.

So, I think I need add a custom method for the User Class, like :

public function mycustomfield_value($user){
    return $user->mycustomfield->value;
}

From my IDE, if I type "$user->" the IDE auto-complete must show me "$user->mycustomfield_value(..." method.

My ask is : how can I add this method ? I must create a new Class implement/extends User Drupal 8 Class ? I don't know how can I do that..


texts:
I have defined a new content type with comments. When I create a new view (page) consisting of the x most recent posts of this content type I see this:

I choose: Show content | Teasers + display links. I get an overview page consisting of teasers and each teaser has the Add new comment link (as well as the Read More link). This I understand.
I choose: Show content | Full content + display links. I get an overview page consisting of full content and only nodes with comments have the Add new comment link. This I do not understand. Why is the Add new comment link not visible for each node? And how can I make it visible (in node.tpl.php?)

Any help would be greatly appreciated!


texts: Using SimpleTest to test an image upload

texts:
I have a basic test written (per http://drupal.org/simpletest-tutorial-drupal7) but I am unsure how to proceed to test an image field.

public function testSimpleTestExampleCreate() {
    // Create node to edit.
    $edit = array();
    $edit['title'] = $this->randomName(8);
    $edit["body[und][0][value]"] = $this->randomName(16);
    $this->drupalPost('node/add/simpletest-example', $edit, t('Save'));
    $this->assertText(t('Simpletest Example Node Type @title has been created.', array('@title' => $edit['title'])));
}

So this will create a node with a title and body. How should I modify this to allow it to test uploading an image as well? Would I just add another key to $edit of 'files[image_image_und_0]' with the path to the image to be uploaded? But I think something else needs to be done since you have to click "Upload" before you save the node.


texts: Using views_embed_views() to generate content for an email message. How can I get it to insert images and urls correctly for this purpose?

texts:
I am using views_embed_views() to generate content for an email message. How can I get it to insert images and urls correctly for this purpose?

Or, asked another way, how can I put the contents of a view into an html email body?


texts: Editing content redirects to apache test page?

texts:
Everything in the site works except for when saving it redirects to an apache test page.  Any ajax request returns an error and the apache test page as debug text?  Any idea?  php 5.3 all requirements met.

Clarification
For example:
When editing content and clicking save I am taken to an apache test page.
The url display in the browser is site.com?q=node/1/edit&destination=admin/content
If I refresh the page and send the postdata again I get the apache start page.
If I load that page (like put the cursor in the URL bar and hit enter) it goes to the content edit screen but nothing is saved.

All forms that submit post data it seems do not work.  I dont have this problem anywhere else on the server.


texts:
I have Drupal site with a login form on my home page.

How do I go about posting to a HTTPS url, and then after a successful authentication, redirect back to HTTP admin page?


texts: Mixing attributes and line item fields in Drupal Commerce Add To Cart form

texts:
I am currently working on a Drupal Commerce site that offers highly customizable products with multiple attributes.  I am at the stage where i am trying to theme my add to cart form, and am a bit lost.

In my theme, I have created a hook_form_alter, and check for my add to cart form.  The $form variable has 2 groups of form fields:

$form['attributes']        // Contains 'Attr_1', and 'Attr_2'.
$form['line_item_fields']  // Contains 'Attr_1_c1', 'Attr_1_c2', 'Attr_2_c1', 'Attr_2_c2'

So each attribute has 2 customization options specific to that attribute.  I would like to output my form like so:

Attribute 1: (Select Box)
    Customization 1: (input)   // Attr_1_c1
    Customization 2: (input)   // Attr_1_c2

Attribute 2: (Select Box)
    Customization 1: (input)   // Attr_2_c1
    Customization 2: (input)   // Attr_2_c2

Thus grouping the proper customization line_item_fields with the proper attributes.  However, since attributes are already grouped in the $form variable, and are separate from the line_item_fields, I am not sure how to do this.  Any thoughts on the best way to proceed?


texts: Sending a message to users of a flagged node when it is referenced

texts:
I have a site where a user can watch a node using the Flag module. Users can also reference the node and I wanted to set up a rule that when the node is referenced, a message is sent to all the flagged users of the original node notifying them that the node was referenced.

Can anyone help with the rule?


texts:
I use Drupal 8.

I would simply want to add icons to one of the menus with a <span>.

Have you runways?


texts:
I need to test a series of links to see if any of them match the page that is being processed.  I'm having trouble finding a solution that will match all possible pages (a node, a view page, a page created by a module, etc) and will consider path aliases.

(It would be convenient to start with all parameters of $test_url stripped of the domain name and leading/following slashes.)

function _is_current_page($test_url){
   $test = FALSE;
   ...
   return $test;
}

Test case 1:

// current Url: domain.com/blog/year/month/article_name
// current Nid: 1234
// alias for above: domain.com/popular_article_name

_is_current_page("blog/year/month/article_name") -> true
_is_current_page("node/1234") -> true
_is_current_page("popular_article_name") -> true

Test case 2:

// current Url: domain.com/blog/calendar
// current Nid: _none_ (generated by view or module)
// alias for above: domain.com/blog-calendar

_is_current_page("blog/calendar") -> true
_is_current_page("blog-calendar") -> true

Help greatly appreciated : )


texts: Content Template no longer displaying new nodes. Works fine for older nodes

texts:
In my D7 site, I have a content type that's being displayed using Content Template (Contemplate). The Content Template code hasn't changed in over a year. It's been running like a champ… displaying new content and edited content on hundreds of nodes.

All of a sudden, no new node content will be displayed through Content Template. If I temporarily disable the Content Template, the node content will appear. When I turn it back on, nothing.

I wiped out my Content Template code thinking there might be some conflict in there. I replaced the whole thing with just one line:

<?php print $node->field_body[$node->language][0]['safe_value']; ?>

Nothing.

What's interesting is that any HTML or PHP in the Content Template code will still work… it's just the field variables that are not producing any values. And again, this is only for newly created nodes.

Some of the core node variables will still work (like NID and Title), but none of the custom fields. So, for example, this code works:

node: <?php print $node->nid ?>

title: <?php print $node->title ?>

This would produce the NID and the node title successfully on the page. But, the aforementioned $node->field_body… (which is a custom field), produces nothing.

In a further effort to troubleshoot, I've disable any recently activated modules (Entityforms and Rules). No change.


texts: Exporting nodes using Views Bonus Pack strips all formatting

texts:
I've exported all of my nodes using Views Bonus Pack Export CSV; it works rather nicely. The only trouble is that it strips all of the formatting on my nodes: no paragraphs, no bold text, nothing. The resulting node is a single block of text.

Is there any way I can work around this?


texts: Use migrate to populate entity_reference with nid

texts:
I am migrating a D6 site to D8. The D6 site used the "Node Relativity" module, which has been broken for a while. It was used to establish a link between two content types, which I will call meeting and recording.

Now I am trying to use the migrate module (and friends like migrate_plus) to establish an entity reference to recording in the meeting content type. Here is what I have done:

In the D8 site, specified the field structure for the two content types. In the meeting content type there is an entity reference for the recording called field_recording_link.
Exported the configuration into custom modules. I can now create a database from scratch and it creates the content types.
Connected my D6 database to import content. Textfields from the meeting content type do get imported.
Written a custom source module with a prepareRow() method that exposes the NID of the recording nodes (called recording_nid). I can see this NID in the migration.

In the migrate_plus.migration.upgrade_d6_node_meeting.yml file, added the following stanza in the process section:

field_recording_link: recording_nid

but this does not populate the field. I have also tried:

'field_recording_link/target_id': recording_nid

but that does not work either. I feel as if this ought to be straightforward, but I am pretty stuck.

Do I need to make a process plugin? If so what should it do? Use PHP to create an entity reference and populate it?
Do I need to call an existing process plugin? If so which one?
Do I have to write a separate .yml file just for this field? If so what would it look like? I have been looking around for examples but have not had much luck.

I would appreciate any advice you have, as well as links to examples of this.


texts: How to change value of hidden field on node publish?

texts:
My client has a system in which they allow nodes of certain content types to be created by authenticated users. The nodes are unpublished until they are reviewed by someone with the proper role and this all works correctly.

One of the requirements was allowing users to save a node as draft. I initially used the Save Draft module but found that was defaulting nodes to be published which caused problems. I worked around this by adding a hidden field called status that would change values based on which submit button was clicked via hooks.

Now, the issue comes when the node is reviewed. At that point, an admin will change the node to published. They would also like automatically like this hidden status field to change from "submitted" to "published". Normally, I would use a hook for this but through my testing, I can't seem to get form alter hooks to work in the admin section.

I suppose I have two questions here:

Is there an easier way to achieve my end result here?
Failing that, is there a way to automatically change the value of one field when a node is updated via the admin section?


texts:
How can I get current country pathPrefix in D8 ?

I know drupalSettings.path.pathPrefix gives that in JS, but how can I get it in preprocess hook ?

Following gives only the path alias, but without pathPrefix.

\Drupal::service('path.alias_manager')->getAliasByPath('/node/'.$nid[0]);


texts:
I have some doubts about the Video Conference module.

Can we integrate the video conference module in Drupal 6?
Can we use Dokeos for video conference?


texts: Get html of node programmatically with custom twig template applied

texts:
I am trying to get the html of a node("Destination" content type) and render it via a custom function.
My code looks something like:

$entity_type = 'node';
$node = \Drupal::entityTypeManager()->getStorage($entity_type)->load(31140);
$renderable = [
  '#theme' => 'node__destination',
  '#node' => $node,
];
$t =  \Drupal::service('renderer')->render($renderable)->__toString();

dpm($t);

Am I missing something in the process?


texts: Detect if the value of a cck field has changed when a node is edited

texts:
Drupal 6.25, CCK 2.9

I have a node of type EVENT. The EVENT node contains several CCK fields that allow users to submit events to our calendar which go in to a workflow. If the user requested IT support at their event, the IT support person is e-mailed. If they will be hosting an event with food, the catering staff is notified.

Everything works great except that we can edit the event later upon their request. If the edits that we make change one of these values that is used to notify staff, I need the system to automatically notify those people.

I know how to handle notification and everything else works well, but I don't know how to detect if the state of a single field is changing.

DETAILED EXAMPLE:

--- Event information... ---

Will you require IT support at your event?

I need my lecture recorded.
We will require someone on hand to assist with software installation.
Video conferencing
Special request

(multiple checkboxes)

--- More event information ... ---

If that EVENT node is submitted, approved, and later edited to change the value of that field so that one of the boxes is checked, I need to handle that.

I have a custom module to handle this in and have experience writing validation and submit handling, but I'm not sure what values of $form or $form_state are helpful to this task. I thought that I might store the value of the field as it was originally as a hidden field with a hook_form_FORM_ID_alter and then check that hidden value against the submitted value but it's hard to get CCK values in to hidden fields because you have to capture the value in an #after_build function and... I'm just getting stuck and thought I'd ask for help.

Thanks in advance for your time and consideration!

EDIT - My solution based on the suggestion from Jimajamma below:

function sitecustom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  // If we are saving an EVENT node...
  if ('presave' == $op && 'event' == $node->type) {
    // If the node already exists...
    if ($existing = node_load($node->nid)) {
      // If the FIELD_EVENT_TECH_SUPPORT value has changed...
      if ($node->field_event_tech_support == $existing->field_event_tech_support) {
        // Log the change.
        watchdog('event_edit', 'FIELD_EVENT_TECH_SUPPORT value did not change');
      } else {
        // Notify people accordingly.
        // TODO: Notification of staff of changed tech support for EVENT.
        // Log the notification.
        watchdog('event_edit', 'Event edited with FIELD_EVENT_TECH_SUPPORT value changed. Staff notified.');
      }
    }
  }
  // Handle other nodeapi uses, validation, etc.
}

And I'm not exactly sure if it's correct to do if ($existing = node_load($node->nid)) because that block seems to execute even when an EVENT node is being created from scratch. I know that I could use if ($existing->created != $existing->changed) but I haven't thought through everything yet and exactly what I want to test, etc. For now, using what I've shown above won't trigger the notification in this case IF the node is new.

I guess I just wanted to get something up here in terms of a solution in case people find this in the future. I will move on to exploring how to make this easier to do/find with RULES and ACTIONS as time allows.


texts: Command to list all media entities in console?

texts:
I have an issue in my site which is not allowing me to visit the /en/admin/content/media page.

I'm looking for an approach to list and delete media entities on the command line.

When I run drupal debug:entity media I get an error:

[ERROR] Notice: Undefined index: media in Drupal\Console\Command\Debug\EntityCommand-&gt;execute() (line 79 of /home/ubuntu/site/vendor/drupal/console/src/Command/Debug/EntityCommand.php
         ).
Drupal\Console\Command\Debug\EntityCommand-&gt;execute(Object, Object)
         (Line: 255)
         Symfony\Component\Console\Command\Command-&gt;run(Object, Object) (Line: 971)
         Symfony\Component\Console\Application-&gt;doRunCommand(Object, Object, Object) (Line: 248)
         Symfony\Component\Console\Application-&gt;doRun(Object, Object) (Line: 185)
         Drupal\Console\Core\Application-&gt;doRun(Object, Object) (Line: 64)
         Drupal\Console\Application-&gt;doRun(Object, Object) (Line: 148)
         Symfony\Component\Console\Application-&gt;run() (Line: 89)
         require(&#039;/home/ubuntu/site/vendor/drupal/console/bin/drupal.php&#039;) (Line: 4)

The docs of this command is also really uninformative.

What's the best approach to list and delete media entities on the command line?


texts: Feature creation of Print module for path to print stylesheet

texts:
Using the print module, I need to create a Feature to deploy in order to set the path to the .css file to my themes directory on my production site.

In Features, what do I need to check to make sure I get these settings?

When creating the Features, the closest thing I can find is a checkbox under permissions:

Thanks


texts:
I have installed Nginx and I have a Drupal site installed in a sub folder.
I also have a directory in /drupalpath/sites/default/files/books/ that stored some PDF in it.
I configure my nginx like this:

location /drupalpath {
    rewrite ^/drupalpath/(.*)$ /drupalpath/index.php?q=$1 last;
}

and it works nice.
But my problem is that the PDFs in /drupalpath/sites/default/files/books/ affected this rule and when I click to download my books it send 404 Error because this rule.
My question is that how to fix it?


texts: Cannot get JQuery plugin working on Drupal 7

texts:
I am trying to run a Jquery plugin QTip. The problem is that it is not running even though all the files are in the corect folders (plugin is both in info file and attched as a script below) and I took the code below from the plugin's website and pasted in the html section of WYSYWIG editor. Can anyone tell me why this is the case?

Why this not working


texts: Results in view page having multiple duplicate result

texts:
I am having a gallery view page taken from a content type which is displaying the results based on relationship and contextual filters. I am getting multiple fields of a node that seem to be duplicates, even though I have checked the reduce duplicate check box in contextual filter field.
Anyone can help on this issues to get perfect value.


texts: Custom form with Date textfield with jQuery popup

texts:
I'm making a custom form and I would like to render a field that is just like the form that gets rendered for a Date with a jQuery Popup when editing a node.

I can't figure out how to build the array so that it will get rendered by drupal properly. I've tried a ton of different attempts, but this is what I've got currently:

$form['birthdate'] = array(
    '#title' => t("Offspring Birth Date"),
    '#id' => 'edit-field-filter-birthdate',
    '#type' => 'date_popup',
    '#default_value' => '2015-01-01 10:30:00',
    '#date_type' => DATE_DATETIME,
    '#date_timezone' => date_default_timezone(),
    '#date_format' => 'm-d-Y H:i',
    '#date_increment' => 1,
    '#date_year_range' => '-3:+3',
);

$html = drupal_render($form);

The README.txt in the date/date_popup module says:

  To include a popup calendar in a form, use the type 'date_popup':

  $form['date'] = array(
      '#type' => 'date_popup':
      '#title => t('My Date'),
      ....   );

  Set the #type to date_popup and fill the element #default_value with a
  date adjusted to the proper local timezone, or leave it blank.

However, all that ever gets rendered is just the '#title'.

What am I doing wrong?


texts: How can I programmatically import configuration?

texts:
I try to import specific configuration. I use this :

$config_path = config_get_config_directory(CONFIG_SYNC_DIRECTORY);
$source = new FileStorage($config_path);

$config_storage = \Drupal::service('config.storage');
$config_factory = \Drupal::configFactory();
$uuid_service = \Drupal::service('uuid');

$configs = [
  'field.storage.config_pages.field_areas',
  'field.field.config_pages.configuration_implantation_page.field_areas',
  'core.entity_form_display.config_pages.configuration_implantation_page.default',
  'core.entity_view_display.config_pages.configuration_implantation_page.default',
];

$config_storage->write('field.storage.config_pages.field_areas', $source->read('field.storage.config_pages.field_areas'));
$config_storage->write('field.field.config_pages.configuration_implantation_page.field_areas', $source->read('field.field.config_pages.configuration_implantation_page.field_areas'));
$config_storage->write('core.entity_form_display.config_pages.configuration_implantation_page.default', $source->read('core.entity_form_display.config_pages.configuration_implantation_page.default'));
$config_storage->write('core.entity_view_display.config_pages.configuration_implantation_page.default', $source->read('core.entity_view_display.config_pages.configuration_implantation_page.default'));

If the field is created, the table is not created.

How to create the tables associated?


texts:
How can i loop through taxonomy in drupal 8.
I found this static function but TID is required, how can i loop through all taxonomy without using TID?

Drupal::entityManager()->getStorage('taxonomy_term')->loadAllParents($tid);


texts:
I would like to have the following field widgets:

I would like to give the user the possibility to give in 4 nicknames and select the default one that will be shown to other users.

Is there a module for this or something I can work with?

I've searched google but with no success ... .


texts: Rewriting the pager of Views in Drupal 7

texts: I have a Views which I am calling via views_get_view and view->preview. I am feeding the Views with a form via Form API - with no exposed filters - and the problem is that while the number of pages is correct, obviously, when I click on a page, I loose the POST variables and the pagination shows results which are not filtered. How can I rewrite the pager so I simply add as GET the parameters to the URL, so I can filter again when the user selects another page? I would prefer not to use exposed filters as I have some heavy PHP processing and would prefer just to make this modification which I would expect it to be easy but cannot find anything.


texts: Validate all instances of a field programmatically

texts: What is the best way(hook) to validate all instances of a field programmatically? I have a lot of content types having the same fields like field_phone. I want to programmatically validate field_phone everywhere it is used.


texts: build an admin view of all available rules (rules module), a better rules UI

texts:
is there a hook to build an admin view of all available rules (rules module) to build a better rules UI? it may be a table view, so we can apply filters and groups, and order them, like in weight, tag, event, etc. I have sites with 30-40 rules running and sometimes (too many) is difucult to figure out a map of a time-event-order-actions taken on site, seeking a better planification and manteinace. A view with the available elements could help a lot.
code is welcome.


texts: altering form with hook_form_FORM_ID_Alter

texts:
function dental_form_simplenews_block_form_2_alter(&$form, &$form_state, $form_id)
{
    global $user;
    $form = array();
    $form['#attributes'] = array('class' => array('newsletter'));
    /*$form['subscribe'] = array(
        '#type' => 'fieldset',
        '#title' => '',
        '#weight' => 5,
        '#collapsible' => TRUE
    );*/
    if ($user->uid) {

    }
    else {
        $form['mail'] = array(
            '#type' => 'textfield',
            '#title' => t('Email'),
            '#size' => 20,
            '#maxlength' => 128,
            '#required' => TRUE,
            '#attributes' => array('class' => array('text_ip')),
        );
        $submit_text = t('Subscribe');
        $form['action'] = array(
          '#type' => 'value',
          '#value' => 'subscribe',
          '#attributes' => array('class' => 'submit'),
        );
    }

    return $form;

}

Above is the code i am using to alter form produced by simplenews plugin. But i am getting various error messages.

Notice: Undefined index: #parents in form_builder() (line 1713 of /home/sjd/www/example.com/includes/form.inc).
Warning: implode() [function.implode]: Invalid arguments passed in form_builder() (line 1713 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: #tree in form_builder() (line 1743 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: #array_parents in form_builder() (line 1766 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: process_input in _form_builder_handle_input_element() (line 1904 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: complete form in form_builder() (line 1723 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: #tree in form_builder() (line 1743 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: #array_parents in form_builder() (line 1766 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: process_input in _form_builder_handle_input_element() (line 1904 of /home/sjd/www/example.com/includes/form.inc).
Notice: Undefined index: process_input in drupal_process_form() (line 817 of /home/sjd/www/example.com/includes/form.inc).

Can anybody tell me where i am going wrong.


texts:
I'm using the node's Summary field for article teasers. Although not mandatory, this field is being constatly populated by content editors for article content types. I'm trying to make it visible instead of Drupal's default collapsed state, but I've hit a wall on identifying the related JS function and how to modify it without hacking core files.

Any idea on achieving the desired UI modification?

EDIT: OK, seems like the /modules/text/text.js is the file in charge of adding the link that shows/hides the Summary field.

Since I don't want to simply comment out or edit core files, I think I'll have to make a custom module to unset this js file and not allow it to be loaded. I'm no JS expert but by looking into the code it seems to me that this file impacts only the text summary. Hence my updated question would be:  are there any side effects to unset this file?


texts: Pass variables through AJAX callback and update MySQL database

texts:
I have a form where the users submit a text. Here is the code:

$form['reason'] = array(
            '#type' => 'textfield',
            '#title' => '',
            '#size' => '200',
            '#attributes' =>array('placeholder' => t('*Reason')),
            '#prefix' => '
'
          );

    $form['newsletter_unsubscribe_submit'] = array(
        '#type' => 'submit',
        '#value' => 'Submit',
        '#attributes'=> array(
            'class' => ['btn', 'btn-primary']
        ),
        '#ajax' => array(
            'callback' => 'newsletter_unsubscribe_quiz_submit_driven_callback_share',
            'method' => 'replace',
            'effect' => 'fade',
        ),
        '#prefix' => '
',
        '#suffix' => '

');

    return $form;

I managed to get the input of the user on a variable using $_values = $form_state['values'];
Also, I have some other variables to read from the current path and get some values.

    $_path = $_SERVER['HTTP_HOST'] . request_uri();

    preg_match('~id=(.*?)&~', $_path, $id);

    $first = $id[1];
    $second = substr($_path, -5);

where the first is the user id and the second is another variable that is unique per user.
My only problem is that I can't pass the $first and $second variables through the callback, and have them along with $reason $_reason = filter_xss($_values['reason']);
So, in my callback I want to be able to get the variables $first,$second with the $reason I already have. Now I have the $_path variables above my form, in the same function.
Then I want to perform an update query on MySQL, something like

UPDATE users SET reason=$reason
WHERE first=$first AND second=$second

where the column users has only the columns first,second and reason . Is this possible? Thanks in advance!

EDIT
I actually managed to do the first part and get the variables. I created two form inputs and I give them default values, the two variables I want to get, and I will hide them afterwards.
I still haven't figured out how to update MySQL though, so all answers are welcome!


texts: How to programmatically access the allowed HTML tags in Filtered HTML

texts:
A bit of an oddball question. In Drupal 7, I have a comment form page that is required to show the allowed HTML tags available to users. The default list has been added to over time so now I have about 40 different tags.

I want to display it programmatically as part of the form, but I cannot give users the option to change the text format (I want them to use the default Filtered HTML) so I've hidden the Text Format portion of the comment form using the Simplify module.

So my question is how can I output the revised list of allowed HTML?

I've rummaged through the filter module, and tried to print the results of filter_filter_info() like so:

$filter = filter_filter_info();
print_r($filter);

but all it returns is the default list of tags that comes with vanilla Drupal, maybe 10 tags or so. It doesn't show my revised list of tags at all.

I've searched for quite some time but can't find any info on how to do this, so any help would be appreciated!


texts:
I am looking for a while to include a search results on a node.

Let me explain:

Administrator side, i wish i could, when i create a node, enter search criteria (eg "home + garden"-cellar), which generates me, when viewing the node, a list of nodes matching these criteria.

It will give : The title of my node, body, and below the result of my research.

I do not know if this is clear, but how could I do that?

I'm using Search API on my site, i should programmatically execute a search in the index from keywords ... but I'm stuck on this point.

Thank you in advance!
Joel.


texts: How can I theme a paragraph on admin edit pages?

texts:
I'm struggling to override the template on the admin interface for a content type. I'm going to need to do several modifications to the edit form to meet the editor's requirements, however, I seem to be unable to get this to override.

The page source gives me the following

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'paragraphs_summary' -->
<!-- BEGIN OUTPUT from 'modules/contrib/paragraphs/templates/paragraphs-summary.html.twig' -->

If I make a change to the twig file specified I can make my change, however, it's not my module so I shouldn't be making changes and I only want to override on specific content types so I have to go for a theme based override (which of course is the right way to do it)

I've copied this twig template to

themes/custom/my_theme/templates/paragraph--my-content-type-paragraph-type--paragraphs-summary.html.twig

and quite a number of combinations of this, rebuilt the cache with $ drupal cr yet the admin interface still gives the default template instead of my one (and yes, I have remembered to set the admin theme as my new theme).

I want to be able to have a different presentation in the admin interface to that of the anonymous visitor's view, hence looking at overriding the templates.

Any suggestions of how I can achieve this?


texts: How to programmatically set a file field to allow multiple uploads/values?

texts:
I have created a file field with field_create_field() and added an instance of it to my custom node type with field_create_instance() in my module's hook_install()function. But how do I set it to allow unlimited file uploads. I can do it in the drupal interface by going to structure > content types > manage fields and clicking edit for my file field. I can set number of values on that page but how do I do it programmatically? There must some settings key I suppose but could not find it online.

I am using drupal 7.


texts: How to programmatically display an image field in Drupal 7 + default value when needed

texts:
I've used field_view_field to display an image field for a specific entity in Drupal. The problem is when that entity doesn't have any value for field. I expect field_view_field to display the default image for field but it doesn't load default value of the field.

How can I do this?


texts:
I am creating a menu item using hook_menu() and what I want is to translate it when I am using a wildcard, because I have a multilingual site.

There is a solution, using t()[, but it's not the best approach.

$items['account/edit/%'] = array(
  'title'            => t('Edit account information'),
  'page callback'    => 'drupal_get_form',
  'page arguments'   => array('partners_add', 2),
  'access arguments' => array('edit account in partners'),
  'type'             => MENU_NORMAL_ITEM,
  'file'             => 'inc/partners.form.inc',
);

Does anyone know how to translate it using the Drupal interface?

Thanks in advance!


texts: Alias URL not changing when switching language in a View

texts:
I have a content node in 2 languages. When I use the language switcher while displaying the English content:

www.example.com/en/content/Article-on-relativity

it displays correctly the translated content in Spanish in this URL

www.example.com/es/content/Articulo-sobre-relatividad

However, when I include the contents filtered in a View, the language switcher only swiths the first part of the URL, but not the alias URL of the content itself, displaying Not Found

www.example.com/en/myView/Article-on-relativity

changes to

www.example.com/es/miVista/Article-on-relativity

instead of the desired

www.example.com/es/miVista/Articulo-sobre-relatividad

Thanks!!!


texts: Install and enable 'Real AES' module: Dependency with Defuse PHP-encryption library

texts:
I downloaded the real_aes-8.x-2.2.zip file from the Real AES project page, unzipped and copied it to contrib module folder (/var/www/html/modules/contrib).
While trying to enable this module using drush en real_aes, I get below error:

Module real_aes doesn't meet the requirements to be enabled.                                                        [error]
Please install the Defuse PHP-encryption library via Composer. See README.txt (Currently using Defuse PHP-Encryption[error]
library version Not Installed)

So now I ran the command composer require defuse/php-encryption to install Defuse PHP-encryption. I could see that it is downloaded to the location /var/www/html/vendor.
After this, even though the Defuse PHP-encryption is downloaded, if I try to enable the Real AES module using Drush command and also tried Drupal module interface, it still throws the above error.

Drupal version: 8.6.5
PHP Version : 7.0.32
Drush version: 8.1.18

Any help appreciated resolving this issue.


texts:
I require threaded comments with pager but instead of loading a new page when pager is clicked, I want the data to be loaded via ajax. There are 2 problems I have with page load -

Loading a new page itself
I have a number of contents with there comments on a single page and clicking a pager for any comments list takes me to a new page, hence a new page for all the comments lists on the page, not only the one I had clicked.

Any help is appreciated. Thanks.


texts: How to create a meal menu in a pop-up in Drupal Commerce?

texts:
For a take away restaurant, I would like to know if there is a way (modules) to have a pop-up that allow the customer to have more items options when he adds a product to his cart.

http://www.eatsushi.fr/shop


texts: Access to selected taxonomy terms on user profile field

texts:
I have a taxonomy vocabulary Area. The terms of this vocabulary are the main menu items. There are no other links in the main menu.

I have a term reference field on user profile.

For every user the main menu should only display those terms which are selected on their profile and have to access to those taxonomy terms only.

Is it possible with any contrib module? Or any idea how to achieve this functionality?


texts:
When user enter to searchbox "0", it is showed all results (likes when you submit empty searchbox). It's work like search remove "0" from search keys. Is it SOLR or drupal problem? How to avoid this?

update

<?php
function hook_search_api_query_alter(SearchApiQueryInterface &$query) {
  if ($_GET['search_textfield_value'] === '0') {
    $keys = $query->getKeys();
    $keys[] = '+0';
    $query->keys($keys);
  }
}

If add this code, it will work. But why?)


texts: Change Add To Cart To Buy Now drupal Commerce

texts: Hello currently I am making a online e store using drupal Commerce so i want to change add to cart button to Buy Now So Ho Can I able To Do Help It Out


texts: Send email to all users that are tagged with the same tag a node is when created

texts:
There is a lot of similar questions here but I am having a hard time wrapping my head around this.

I have a taxonomy term reference field called field_category. This field is available on user/*/edit and on node/add.

Category

1
2
3

What I would like to do is send an email when a node is created that has the same taxonomy term(s) that a user has specified in their profile.

I have tried to wrap my head around using the rules and view_rules module but every configuration I have tried fails.

Can anyone provide me with some direction? Thanks!

Drupal 7.65

Rules: 7.x-2.12

Views Rules 7.x-1.0

Edit

Using pinueve answer, here is where I am at. The actions/conditions section of his answer is still unclear to me. My holdup is trying to match his example in the actions section.

{ "rules_area_of_expertise" : {
    "LABEL" : "area of expertise",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "mail" ],
    "REQUIRES" : [ "rules", "rules_conditional" ],
    "ON" : { "node_insert--answers_question" : { "bundle" : "answers_question" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_category" } }
    ],
    "DO" : [
      { "CONDITIONAL" : [
          {
            "IF" : { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_category" } },
            "DO" : []
          }
        ]
      }
    ]
  }
}


texts: What is the right way of installing Drush?

texts:
The http://docs.drush.org/en/master/install page states:

  Drush 9 only supports one install method. It requires that your Drupal
  8 site be built with Composer and Drush be listed as a dependency.

and if you go to https://github.com/drupal-composer/drupal-project and follow the given steps, in particular run the composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction command, then:

You will have to create an empty directory (otherwise it will complain the given directory is not empty);
It will create Composer structure with Drupal 8 located in web sub-directory;
It will also create vendor sub-directory with lot's of other sub-directories as:

alchemy       composer           doctrine         fabpot          league       phar-io        sebastian    theseer
asm89         consolidation      drupal           grasmash        masterminds  phpdocumentor  squizlabs    twig
autoload.php  container-interop  drupal-composer  guzzlehttp      mikey179     phpspec        stack        vlucas
behat         cweagans           drush            instaclick      myclabs      phpunit        stecman      webflo
bin           dflydev            easyrdf          jakub-onderka   nikic        psr            symfony      webmozart
chi-teck      dnoegel            egulias          jcalderonzumba  paragonie    psy            symfony-cmf  zendframework

Now with regard the new way of isntalling Drupal 8 I have two questions:

Previously we would install Drupal 8 in document root set by control panel. Different control panel have different document roots, ours default them in /home/username/public_html.

Now, with the new way of installing Drupal 8 we end up with document root located in /home/username/some-dir/web, which does not play nice with our control panel's defaults. So I wonder what is the best recommended practice here?

Creating symbolic links between the old and new document roots also have its issues. For example, if you switch to /home/username/public_html (which is a symbolic link to /home/username/some-dir/web) and run the composer update command then it will give:

No composer.json in current directory, do you want to use the one at /home/username/some-dir? [Y,n]?

and we would really like to avoid this kind of extra steps, but at the same time respecting our control panel's default settings.

Changing the default setting for document roots in control panel is also not a good option as there could be lot's of old and non-Drupal websites on servers, so the old document root must be kept.

Do we have to have Composer structure with lot's of sub-directories like ones in vendor in every website's home directory? Please note that in my test setup Composer is installed globally. But when you run the composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction command it creates all those directories within a website's home directory.


texts: Do I have to activate a parent theme when I activate its sub theme?

texts: A sub theme relies on its parent. Does that mean I always have to activate both of them?


texts: Drupal front page blog entries custom sort order

texts:
I have two blog entries which as defaults displays in front page.

1.) Submitted by admin on Thu, 06/16/2016 - 13:32 displays second
2.) Submitted by admin on Thu, 06/16/2016 - 13:33 displays first

I would like to display these at any point of time in a custom order, probably using custom field


texts: How do I edit the label tags 'for' elements name

texts:
When I render my custom form in a twig there is a <label> above the element.

<label for="edit-children">CHILDREN</label>
<select id="ck_children" class="form-control form-select" data-drupal-selector="edit-children" name="children">

But as for the W3C standard, attribute for in the <label> should have the same value as the <select> tags id. But in this one for attribute has the value of data-drupal-selector s value. How to change the for attributes value to be equal as the <select> tags id.


texts: How to extend a view plugin style implemented by another module?

texts:
I have some requirements that leads me to extend the functionality of a views plugin style implemented by a contrib. module by adding some fields and validations in it's configuration form.

I started to implement a custom module to alter this by extending the contrib_views_plugin_style Class implemented by the contrib. module using the views API. I added the fields with no problem but I'm worried about the render method because I don't want to have a copy of the contrib. plus my custom code and I still not sure if this is the best way to do this.

I plan to post this to d.o by posting a patch or maybe another contrib. module but it would be nice if I could keep just the new code and didn't have to have any duplicated code.

Here is the contrib module code:

http://drupalcode.org/project/leaflet.git/blob/refs/heads/7.x-1.x:/leaflet_views/leaflet_views_plugin_style.inc

There is another way to achieve this goal?

PS. I prefer to start without hacking the contrib module but if there is no way to do this it's OK.


texts: I have written a form using the form API, and I want the user to preview the form before submission. How can this be accomplished?


texts: How do I prevent Drupal raising a segmentation fault when using a Node.js theming workflow?

texts:
Symptoms:
Some drush commands fail; Some Drupal pages are blank.
The failing drush commands report "Segmentation fault: 11"
The Apache log (e.g. php-error.log in MAMP) also shows the same error.
Background:
If you use a gulp or grunt workflow - to compile your theme's SASS etc. - you may run into a problem where drush commands throw a segmentation fault 11 as does Apache whilst serving Drupal pages as blanks (WSDs).
Probable cause
This is because files from your grunt or gulp workflow environment in  node_modules are erroneously being registered by Drupal itself as a bi-product of drush cache-clear all for example. There are dozens of these .js files and Drupal can't handle them ... it's possibly a PCRE regex that is the root cause as this is known elsewhere. Anyway ...
It doesn't always happen
It's not clear whether some modules (like Browser Sync for example) induce this error as a node.js style (i.e. gulp or grunt) workflow can work perfectly before failing in this way.


texts: Drupal show menu in English and Spanish with www in the URL

texts:
I use:

  Drupal 7.23
  i18n-7x-1.10
  Language icons 7.x-1.0
  APC 7.x-1.0-beta4

I have activated the Menu Translations sub module for translate the items of main menu.
My language negotion is by URL.

When I enter to my site with: http://domain.com, the menu translate works fine. It only shows the items for the active language.

But when I enter to my url with: http://www.domain.com, not work the translate. All main menu items appear (in all languages). No respect the Negotiation for URL.

Then, to inspect my settings on the main menu I have the following:

MULTILINGUAL OPTIONS
Translation mode
--- Translate and Localize. Menu items with language will allow translations. Menu items without language will be localized.

But, when I set this configuration (in mode admin) with the URL: www.domain.com
and then click on save button, appear the error:

PHP Fatal error:  Call to undefined method i18n_object_wrapper::strings_update() in /sites/all/modules/contrib/i18n/i18n_string/i18n_string.module on line 851

But, no appear when I save this configuration with the URL: http://domain.com

Moreover, with "www" option disappears the option for translate menu items. So, all items that were translated earlier are considered as a normal item menu and shows all.
This does not happen when only income, "http://"

Example

(http://domain.com/en - version english)
Item1-en Item2-en Item3-en

(http://domain.com/es - version spanish)
Item1-es Item2-es Item3-es

(http://www.domain.com - version spanish or english)
Item1-en Item2-en Item3-en Item1-es Item2-es Item3-es


texts: I can't fetch anything else than '1' to my PDO query

texts:
Here is my PDO request :

$query = db_select('review_ratings_table')
   ->fields('review_ratings_table',array('review_nid'))
   ->condition('loc_id', $loc_id, 'LIKE')
   ->condition('user_id', $user_id, 'LIKE')
   ->condition('valid', '1', '=')
   ->execute();
while($record = $query->fetchAssoc()) {
 drupal_set_message('
test '.print_r($record).'
');
}

I have tried many ways to get the result of this request (fetchAll, fetchField, fetchAssoc ...) and I keep printing "1" instead of the review_nid or anything else.

Thanks for you help.

Will

=> Hi,
If I use dvm($query) I get that :

  DatabaseStatementBase::__set_state(array(
     'dbh' =>
    DatabaseConnection_mysql::__set_state(array(
       'needsCleanup' => false,
       'target' => 'default',
       'key' => 'default',
       'logger' => NULL,
       'transactionLayers' =>
      array (
        'drupal_transaction' => 'drupal_transaction',
      ),
       'driverClasses' =>
      array (
        'SelectQuery' => 'SelectQuery',
        'DatabaseTransaction' => 'DatabaseTransaction',
      ),
       'statementClass' => 'DatabaseStatementBase',
       'transactionSupport' => true,
       'transactionalDDLSupport' => false,
       'temporaryNameIndex' => 0,
       'connectionOptions' =>
      array (
        'database' => '*******',
        'username' => '*******',
        'password' => '*******',
        'host' => 'localhost',
        'port' => '3306',
        'driver' => 'mysql',
        'prefix' =>
        array (
          'default' => '',
        ),
      ),
       'schema' => NULL,
       'prefixes' =>
      array (
        'default' => '',
      ),
       'prefixSearch' =>
      array (
        0 => '{',
        1 => '}',
      ),
       'prefixReplace' =>
      array (
        0 => '',
        1 => '',
      ),
    )),
     'queryString' => 'SELECT review_ratings_table.review_nid AS review_nid
  FROM
  review_ratings_table review_ratings_table
  WHERE  (loc_id LIKE :db_condition_placeholder_0 ESCAPE \'\\\') AND (user_id = :db_condition_placeholder_1) AND (valid = :db_condition_placeholder_2) ',
  ))

and

  Error message
  Recoverable fatal error: Object of class DatabaseStatementBase could not be converted to string in review_ratings_table_node_presave() (line 52 of C:\Bitnami\drupal-7\apps\drupal\htdocs\sites\all\modules\custom\review_ratings_table\review_ratings_table.module).

and

dvm($query->fetchAssoc()); gives me that

  array(
    'review_nid' => '2',
  )

Which is what I want but I don't know how to access it.

Thanks


texts: Change default option of installation profile

texts:
I've created a new installation profile name ABCD and it is showing on a "select an installation profile" Page

But it shows standard as a default option. How could i make ABCD as default.

I added hook_form_alter and hook_form_FORM_ID_alter in abcd.profile file but it's not working. As I've read in Drupal.org that bootstrap is fully loaded before reading .profile file but still form alter in not being executed in my case. Any idea ?


texts: Can a taxonomy term be loaded into an EntityMetadataWrapper?

texts: I want to load term fields in my application. Can I use  entity metadata wrapper with reference to terms?


texts:
Warning: array_key_exists() expects parameter 2 to be array, null given in QuickAccordion->add_attached() (line 100 of /sites/all/modules/quicktabs/plugins/QuickAccordion.inc).

After spending a while Googling I found some stuff related to AJAX and Views for this error in relation to quicktabs, but I cannot find anything on what's throwing this error on my site.

I don't know what's causing it nor do I know how to fix it.

I thought it may have something to do with the jquery version I'm using, but switching to various different versions didn't resolve it

I thought it might be due to a view on the same page, but not included in teh same view using AJAX, but disabling AJAX on the view did not resolve it.

I thought it may be due to the version of quicktabs I was using, but upgrading to the latest dev version did not solve the issue.

All other modules and Drupal core are all up to date on the latest version. This is the only dev module we're using.

Have you seen this before? Can you help me with this error?

Line 100 is:

if (!isset($qtkey) || !array_key_exists('qt_' . $name, $javascript['settings']['data'][$qtkey]['quicktabs'])) {
      $quicktabs_array = array('name' => $name, 'active_tab' => $this->quickset->getActiveTab(), 'options' => $options['jquery_ui'], 'history' => $options['history']);
      $attached['js'][] = array('data' => array('quicktabs' => array('qt_'. $name => $quicktabs_array)), 'type' => 'setting');
    }
    return $attached;
  }


texts: How to apply js and css to ajax loaded content?

texts:
When content get loaded through ajax, neither theme.css or js get applied. Below is code snippet,

controller

    $twig = \Drupal::service('twig');
        $twigFilePath = drupal_get_path('module', 'mythemename') . '/templates/test.html.twig';
        $template =  $twig->loadTemplate($twigFilePath);
      $markup = $template->render(array('gainerList' => $gainerList, 'loseList' => $looserList));

        $build = array(
            '#type' => 'markup',
            '#markup' => $markup,
            '#attached' => array(
                'css' => array(
                    drupal_get_path('themes', 'mythemename') . '/css/theme.css'
                )
            )
        );
        return new Response(render($build));

Is there any issue with above code?

Also below testing code does not hide the second .

 $build = array(
            '#type' => 'markup',
            '#markup' => '
Demo text content

Demo text content
',
        );
        return new Response(render($build));

Js file code snippet:

(function ($, Drupal) {
  'use strict';

  Drupal.behaviors.company = {
    attach: function(context, settings) {
        $.ajax({
                url: "get-top-performing-fund",
                type: 'GET',
                success:function(data, error){
                    console.log(data);
                    $('#topPerforming').html();
                    $('#topPerforming').html(data);
                }
        });
    }
}
})(jQuery, Drupal);


texts:
i'm new to drupal (just installed v9) and want to add a bunch of content.
like in the question asked years ago (Create taxonomy terms on the fly) i want to add taxonomy terms on the fly while adding new content and not having to add them first in the taxonomy module.
the links provided in the old thread are for v7 and v8 and seem not to work
if the code thats posted there is still a valid solution can one tell me where to add it?
thanks


texts: Can I relate a node with a taxonomy term via its description and not its name?

texts: I import xml files into Drupal. These files use numbers for location which I want later to be interpreted into names (like Spain, Greece etc). So I would like the taxonomy terms to have the name of the countries but then how could I relate the node to the taxonomy term? I was thinking to use the description or another taxonomy field to relate it with the node instead of the name. Is that possible? Thank you!


texts:
I have built a Drupal based web app product that I want to give (a trimmed down version) for free. I am expecting 100s and 1000s of subscribers. Each one should get an exclusive code base (drupal files) and database- thats my product's need.
I plan to use AWS- amazon web services.

1). I want users to visit my company site and click and install the product(the web app site) for themselves. This should automatically
       a. create a sub-domain,
       b. copy my main code base and database. How to do these?

2). For maintenance and upgrades management, I want to have a single
parent code base (probably at private github) and would want each of these sites to replicate that. This is to avoid upgrading 1000s of sites individually. How to do this?

3). Some of my subscribers may want to upgrade to paid version. So I may have to customize their instance. How to ensure the custom changes are not overridden on maintenance acts of above point.

I have a low budget so I cannot buy any service to do this. I am hoping that a module or some Drush way can solve this.


texts: Create a node type that acts like a PHP page?

texts:
Drupal 7.24, fresh installation

I'm fairly new to Drupal and I'm trying to figure out if it's possible to create a node type that acts like a PHP page. I have a code library that needs certain files required once in a node type that displays output.

I've tried using Full HTML and also created a new text format that had all vanilla Drupal options unchecked and the PHP snippets do not function.

I'm sure I'm mixing up terms and I hope you understand what I'm going for, like I said I'm fairly new. Do I need to look for a different text format?

Thanks for your time, and Happy New Year!


texts: Alternate to field_get_items() ?? CCK fields reconstriction?

texts:
After a long quest, finally I got the solution for splitting $content in Drupal 7 in node.tpl.php.

Previously i was using i was using :-

print $node->field_name['und'][0]['value'];

Which was giving a warning :-

Notice: Undefined offset: 0 in include() (line 24 of C:\xampp\htdocs\drup\sites\all\themes\myCustomTheme\node.tpl.php)

Now I am using the function below which works fine with no errors

$output= field_get_items('node', $node, 'field_name');
$output = $output[0]['safe_value'];
print $output;

Now the problem is I have more than 50 fields on the page , I don't think it would be efficient to call field_get_items('node', $node, 'field_name') function 50 times.

Whats the alternate ?
OR should I strict to the field_get_items function
OR should I strict to the print $node->field_name['und'][0]['value']; which I heard is not good to use in Drupal 7 as und is undefined. This though solves my problem but gives irritating warnings.


texts: After update 8.7.0 seven admin theme can't find icons

texts:
I updated my Drupal 8.6.15 > 8.7.0 After updated page not found error keep coming. (I attached photo below)

It happens only in Admin theme, when I change admin theme to default theme, errors are gone. I installed a new test site with 8.7.0. but no error has happened. I tried to change core folder, theme folder. and icon files are still in the same location. I'm really confusing now. I tried to revert older version of drupal core. when it happened errors are gone but my drupal has problem. (DB is still has information of newer version I guess..) I think path of icon is wrong. error shows me wrong location.

I guess nothing wrong with new core version. but something has happened with my previous settings which I never know. anyone can help me?


texts: Drupal Views Date Views - Today in History (month, day)

texts:
I am using Drupal 7, Views, Date Views, and Date module.
My database uses a field named "release date" which contains the date that specific items were released (Month/Day/Year)
I would like to customize my view to show only content with today's date (historically) basically showing all items that were released on this Month/Day in a block so that every day new content is displayed.
Can someone lead me in the right direction to accomplish this? Thanks


texts: $ is not a function but jQuery is loaded when adding JavaScript to a custom theme

texts:
I must have something set up incorrectly in my custom theme. jQuery is loading and works fine elsewhere on the same page in a views slideshow using jquery.cycle. My custom JavaScript however reports that $ is not a function.

The info.yml file includes the global-scripts property.

The libraries.yml file contains the following code.

  js:
    js/script.js: {}
  dependencies:
    - core/jquery

The content of js/script.js is the following.

$(document).ready(function () {
    $(window).on('load scroll', function () {
        var scrolled = $(this).scrollTop();
        $('#layer-1').css('transform', 'translate3d(0, ' + -(scrolled * 0.25) + 'px, 0)'); // parallax (25% scroll rate)
    });
});

The first line in script.js returns the error in the console. It is the only error I receive.

I checked the page source and confirmed that jQuery is being loaded before script.js at the bottom of the page below the footer.

Can anyone see what I have done wrong here?


texts: Webform module loosing language for referenced options

texts:
First I have content type "Quiz option" which is translatable.

Then I have a view that returns Entity references of that type. For language option I selected "Content language of view row" and also added filter "Content: Translation language = interface text language selected for page".

I translated (to German - original language is English) only one content of that entity and when I test view on view edit page it works well:

If I'm editing view on English view edit page I see all the content on English, except that German one. And when I'm editing view on German view edit page (with that "de" in path prefix) I see only one entity - the translated one and it's title is displayed well, on German.
So far, so good.

Now I have a webform with some select button where for options I'm using reference mode with that view for selecting elements. And on front-end I  always see content title on English? Why is that?
So on front-end if I'm on German page I see only one option - the translated one, but it's title is on English, not on German?!?

I tried removing language filter I mentioned above and then I see all the options, but again they are all on English.

So, when I test view everything seems fine and when editing webform field I have only option for selecting the view (and passing the parameters), but nothing related to language.

And even if i.e. I force strictly German as "Rendering language" in views options I still see my options on English on front-end.

Any idea why I'm getting entity titles in default language (English) instead of in language of the current page (German)?


texts: How do I change the original language of a product type?

texts:
On a multilingual site with commerce project I've created a product type while having one language selected as default but now I want to switch it to a different one. On /admin/commerce/config/product-types/producttypemachinename/edit/translate I see what the current original language is oviously but I can't edit it on /admin/commerce/config/product-types/producttypemachinename/edit. Is it ok if I edit it in the database? Does anyone have some ready SQL statements or at least know where it's stored?
I think product type is a Configuration Entity and I'm now searching where these are stored in the database.
I've found something in
SELECT * from `drupal_config` WHERE name LIKE "commerce_product.commerce_product_type%";
SELECT * from `drupal_key_value` WHERE collection="config.entity.key_store.commerce_product_type";

but the data columns there are longblob.
Update: with the next SQL I can confirm that original language is stored in the "config" table:
SELECT collection,name,CAST(data as CHAR) from `drupal_config` WHERE name LIKE "commerce_product.commerce_product_type%";

Update: even after editing the longblob value and setting langcode to en it's still not English original in the admin interface.
Update: just had to clear the cache, it's now changed.


texts: How do I separately get label and field?

texts:
For form fields, we have label and field (Text/Select/...).

How do I get the field title and its value separately in a template file?

{{ form.title }}

I need both separately, so I can properly style.


texts: To add fields to the User Registration one can directly use the admin/config/people/accounts page. However, I am required to some other fields to the User Registration like food choice which is to be selected from drop-down list of foods, Email and Confirm Email fields (which should check whether both are same and whether the email was used in db), country (If UK/US is selected, text field for state, postal code should appear). Now, I could add the fields to the user registration page, but how can I handle the validations for the fields and how do I show such dropdown list. Am I required to create my module that extends the User Registration form. If so, how do I do this? Thanks.


texts:
I have a blog that needs a poll attached to it.  I've looked at a few modules, but they seem to be buggy.

Any suggestions on a good poll module or methodology?


texts:
I am successfully migrating at least the bulk of my config from dev thru stage to prod. But the process could obviously be more robust.

Current procedure:

create central (bare) repository
create dev

clone to dev machine
perform set-up (usually standard template) using separate sites/dev.mysite.com settings. No content. No real settings beyond the defaults imported from the template and the install.php process.
export config to from_dev config dir
push all to central repository.

create stage

clone to stage
perform identical setup but using sites/stage.mysite.com instead.
import config from the from_dev config dir

use drush config-edit to change the freshly created UUID's for system.site and shortcut.set.default so they match the UUID's from the dev site.
use drush config-import to duplicate the config from dev.

Basically repeat this process for any other sites in the staging tree.

Problems:

All the sites now have identical UUID.

I'm not clear on the value/purpose of UUID but as long as they are all unique within a site; I'm not sure that's a problem?
The import process does not have the ability to modify existing config objects when the change is limited to UUID. If the UUID's differ, the old object is deleted and the new (otherwise identical object) is created from scratch. This has the side effect of also deleting any content associated with the old object.

In theory, this sort of delete/replace only happens during initial setup before the sites have any data; so there's no harm. However, great care is obviously required to guarantee that no "important" object will be deleted thru the entire life of the project.

Is this an intended D8 workflow?

Should the UUID (either in the live target stage site or in the configs from dev to be imported) be edited to match before the import?

Is there anyway to instantiate a D8 stage (prod) site that is genuinely "blank" (i.e.: an initial config import would require no editing of UUID and/or deletion/recreation of config objects)?

I've been using the standard template because it includes things like Configuration Manager which facilitate the config sharing process. Note that if stage is not built with the same template as dev than the import will fail with something like (paraphrase from memory): Unable to uninstall module 'minimal' because it does not exist; Unable to install module 'standard' because it does not exist. Is there a better template for this process?


texts: Trigger download after clicking on submit on webform

texts:
I'm looking for a way on how I could download an uploaded file from the node once the user has click submit on the webform.

Here is a sample of the webform

Confirmation settings doesn't offer a setting that can download a file after trigger. I can attach link to download the file but I would like the file to trigger automatically once user submits the form


texts: Comment Field, 'Your Name,' Will Not Accept Un-Registered Names

texts:
We want anonymous users to be able to leave comments with their names. However, even though I've set anonymous commenting on the appropriate content type to 'Anonymous posters must leave their contact information' (I've also tried "may leave...), when entering a value in the Your Name field, it will not accept it.

When it is a required field, it gives an error, "Your name field is required," anytime there is a value entered other than an existing user name.

Does anyone know how to allow anonymous users to leave their name?


texts: How can I display a "loading" icon while a slow page loads?

texts: I have a custom module whose front-end page is slow to load due to extensive database work (no forms, just a bunch of db queries to display some long tables). I want to add the little "loading" icon (similar to the iphone) while the page is loading, to show users the page is working. I've seen it on some of the Views administration pages, but I can't seem to find the code for it. Is the display code done with jQuery or a drupal module? How do I add the code to my module/page? Thanks in advance!


texts: How do I integrate queries to legacy databases?

texts:
I'd like to totally move to Drupal and was hoping for information.  I have an old classic asp site with webpages everywhere, not in a framework or cms or anything like that.  They're just set up like the "old way" of doing things.  Mixed code and presentation and so on.

I wanted to move to Drupal, but I need to know how to handle the legacy or new non-Mysql datasources.

For example, I have an asp page that hits a sql server database.  If I rewrite that in PHP, how do I get it into Drupal?  Do I create a module for each page I want to port over?  What do I do?  Should I not use Drupal if this is my need?


texts: Create a Block to display Titles - even pages, view-pages, articles

texts:
In my theme I need to hide the title of content, even the content-type pages and the Views page, and put it in a separate block placed in an other region than the content one.
I figured out how to pick the title from the content-type pages (plain-simple as is) but I figure some difficulties on the View Pages.

How can I hide the title of the node or the page view in the content and put in a block of another region?

Thanks for every answers!


texts:
I'm using the search_api extension (V 8.x-1.14) with the Database search (no solr, etc.)

I use the search block which is created by the search view (/search path)

I want to show the highlighted excerpts which are setup in the Manage processors for search index  (/admin/config/search/search-api/<x>/content/processors)

In the view I select Rendered Entity as show format and chose search result hightlighing input in the settings.

Everything works fine now, but ...

Consifer I have a page About us with this sentence written somewhere on the page.

  'We will deliver your quality product on time and safely at the location of your choice.'

When the user searches for time, this page will be hit and the correct highlight will be shown

  We will deliver your quality product on time and safely at the location of your choice.

Now this excerpt is cached and when I search for quality the excerpt stays the same with the wrong word highlighted.

  We will deliver your quality product on time and safely at the location of your choice.

I deactivated the cache of the view, but it didn't change anything


texts:
We've recently had a few problems with our server, which seem to have been all patched up by myself, my host, and the cPanel team. However, since then we have been having problems with sites/default/files. The problems are happening on the active site running D6, and our dev site, running D7 in a subdirectory at the moment. I'm assuming the problems are related, so after I figure out how to fix one site, I'm sure it will be a similar fix for the other.

On the D7 site, when I save a piece of content, I get the message:
The specified file temporary://filetLWqk4 could not be copied, because the destination directory is not properly configured

At admin/config/media/file-system, I'm seeing the error: The directory sites/default/files exists but is not writable and could not be made writable.

When clearing the cache, I get an error including: Warning: unlink(mysite/sites/default/files/js/wysiwyg/wysiwyg_tinymce_VxxRIlcaFmzHlghU8SsOGCZd5TC_PCxyhQAlqydMALE.js): Permission denied in drupal_unlink() (line 2197 of mysite/dev/includes/file.inc)

What I have read seems to indicate that this is the result of a permissions problem that people seem to have with some clean installs and server migrations. Neither of these cases apply to me, but I thought the solutions might. Most pages that I can find essentially recommend

chown -R www-data:www-data sites/default/files

and making sure that permissions are set to 755 or 775. I'm on centos, which uses apache instead of www-data, so I substituted it where appropriate, but I still have no luck.

I also just tried changing the permissions of sites/default/files to 777, and I'm still getting the error that it couldn't be written to.

Any ideas?


texts:
hi i'm using overlay paths module with overlay module.  i have 2 questions

how to set an overlay width , i tried as mynode/*|200px but it doesn't works.
is it possible to view a page in a overlay without header and footer .


texts: How to make a content visible only in the corresponding language it has been created on a multilingual website

texts:
I am buiding a website on drupal 7 in french and english.

I made french the default language because most users are french speaking at first. So English became the second language.

I am using Entity Translation.

In that website, people who have an account can create content. But I want the content not to be translatable apart from menus and some other stuff.

What I want is the content that is writen in french (in the french version) to be displayed only in the french version. And the content that is written in english (in the english version) to be displayed only in English.

I've tried that for days. But all the content is still showing in both languages.

Can you help me please ?


texts: How do I use PHP to manipulate the way a taxonomy term is displayed within a view?

texts:
My objective: I want to display a specific image when a node has a taxonomy term. All of my nodes are being displayed using the views module.

What I have done so far: I have a content type, it has a term reference field linked to the taxonomy vocabulary I desire. Within views I have linked my field with the view so it displays the taxonomy term text in the desired view.

What I need: I am thinking my next step should be creating a template file that connects with my view and write some php that states "If this taxonomy term is selected, then use this CSS but if this taxonomy term is selected use this CSS"

The CSS would have a background image of my choice which would connect with the term chosen.

I am doing this because I want to add product "for sale", "Free", "New" stickers to my products and I am trying to make it as automated as possible.

If anyone has a better idea on how to do this or can offer some help I would really appreciate it.

I am using Drupal 7.1 and  Drupal Commerce


texts: If I have 2 same name taxonomy term which is used with nodes. how to set only one instead of both?

texts:
I have 2 taxonomy terms with the same name (knight(2) and knight(6)) in my Drupal 8 Project; both terms have been used with nodes.
I want to replace knight(6) with knight(2) in all the nodes. I created the following custom form.

The submission handler code is the following one.
  public function submitForm(array &$form, FormStateInterface $form_state) {

  $values =  $form_state->getValues();
  $old_term = $values['old_taxonomy_term'];
  $new_term = $values['new_taxonomy_term'];
  $query = \Drupal::entityQuery('node')
    ->condition('type','a')
    ->condition('field_taxonomy_', $old_term, '=');
  $results = $query->execute();

  foreach ($results as $nid) {
    $node = \Drupal\node\Entity\Node::load($nid);
    $abc = $node->get('field_taxonomy_')->referencedEntities();
    foreach ($abc as $key => $value) {
      $value = reset($value);
      if ($key['tid'] == $old_term) {
        $node->set('field_taxonomy_',$new_term);
        $node->save();
      }
    }
  }
}

The code doesn't work.