texts: How to Add Taxonomy description or other field value in a textarea with WYSIWYG?

texts:
I want a content editor to be able to create re-usable content, then have access to that content through the WYSIWYG editor when editing the node body or other text field. The idea is that the information gets used in multiple locations through the site, and they want to both cut down on copy/paste errors and only have to edit this information in one place.

The best analogy I can give here is, think of a hotel chain that has several properties each with it's own page, and they wish to have a table on each page that has the room description, occupancy, and price, and based on those parameters, they want to set the price for all properties listed on different pages at the same time.

I'm thinking taxonomy is the simplest way to create re-usable content, so the question is, is there a module that allows simple selection/insertion of a taxonomy description directly into say a table that's being edited with the WYSIWYG editor?

There will be hundreds of items I believe, so the interface should ideally be as simple as possible (like a taxonomy reference autocomplete widget).


texts:
I am writing a module to generate a custom Atom feed, and I want to create URLs like http://drupalsite/node/20.atom or http://drupalsite/content/nodealias.atom.

I was trying to implement it as follows, but of course it is not correct.

$items['node/%.atom'] = array(
        'title' => 'atom node feed',
        'page callback' => 'atom_node_feed',
        'page arguments' => array(1),
        'access callback' => 'user_access',
        'access arguments' => array('generate atom feed'),
        'type' => MENU_CALLBACK
    );

Is it at all possible to create URLs like this in Drupal?


texts:
How can you pass / as part of a parameter in an Ajax call?

The address is http://studiga.delta-xray.co.uk/delete_favourites/%3Cspan%20class%3D%22remove-favourite%22%3E%26nbsp%3B%3C%2Fspan%3E%3Ca%20class%3D%22title%22%20href%3D%22http%3A%2F%2Fstudiga.delta-xray.co.uk%2Fproperties%2Fliverpool-property%22%3ELiverpool%20property%20Address%20line%201%3C%2Fa%3E%3Cspan%20class%3D%22address%22%3E%20Address%20line%202%20Town%20L2%206RE%3C%2Fspan%3E and I wanted just one parameter, but it is treating %2F as /.

function delete_favourites_permission() {
  return array(
    'access favourites content' => array(
      'title' => t('delete favourites via ajax'),
    )
  );
}

function delete_favourites_menu () {
  $items = array();
  $items['delete_favourites'] = array(
    'page callback' => 'delete_favourites_page',
    'access arguments' => array('delete_favourites_permission'),
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function delete_favourites_page($line) {
    echo $line;

    $result = "vvvv";
    drupal_json_output($result);
    exit();
}

echo $line; prints <span class="remove-favourite">&nbsp;.

How can I get it to work?


texts:
I want to create a menu with title "Edit" and path "user edit path". I tried to put user/%user/edit; user/%id/edit but no success.
Any idea?


texts: Add meta tags on a page generated by a custom module

texts:
I am trying to modify the meta tags of one of the pages of my web. For example, I want to change the title, the description and add the robots tag.

I have tried using the token and metatag modules to change this, but it is too generic and I do not see the option to change it individually on each page.

Also keep in mind that the page on which I want to change these tags is generated by a custom module: creating the Twig manually and generating the URL by routing.yml. There's the problem, that by not generating by the back, it does not recognize it as a page.


texts: How to redirect anonymous user to 404 instead of 403?

texts:
I'm new to Drupal so am struggling here. I've created a checkbox field and the goals is that when it is checked it redirects anonymous to the 404 page.

I have the following condition:

function page_module_preprocess_page(&$variables) {

 // code to retrive checkbox value

 if (user_is_anonymous() && $page_hidden_value == 1) {
    drupal_not_found();
  }
}

But this doesnt work.

However, interestingly enough if I do the reverse and check that the user is logged in (!user_is_anonymous()) it does work and does redirect to 404.

I can DPM the value of the checkbox ($page_hidden_value) so I know that's working correctly.

Would anyone know what could be going on here?


texts: Webform on 'hostile development' environment

texts:
A client has a 'hostile development environment' and, related to this, a list of 'blessed modules'.

One of the hard/fast rules is 'no Webform' module.

(The only answer given to 'Why?' so far is, "If the answer is Webform, you're asking the wrong question," by the Devops people who guard this hostile environment.)

Is this a justified exclusion in any way and how would you respond to this statement/exclusion?

Our use case is for a single, simple contact form which allows users to submit their email address, a Subject and a body (in plain text only).

And the reason I'm asking this is so I can explain to 'stakeholders' (also on the client side) what's going on. Devs on my side are mystified.


texts: How to Unit Test Entity Reference Field Value

texts:
I have been tasked with writing a Unit Test for a method where I pass in a Node object, modify an Entity Reference field value, and then return a Node object.

Since this is a Unit test, I am unsure as to how to write an assertion.

Note: just included relevant code.

class ClassIAmTesting {
    public function populateSymbols(Node $node) {

      $node->field_symbols->appendItem(['target_id' => $symbol_id]);
      return $node;
    }
}

I have created a mock for the Entity Reference Field:

$entityReferenceMock = $this->getMockBuilder(EntityReferenceFieldItemList::class)
      ->disableOriginalConstructor()
      ->setMethods(['appendItem'])
      ->getMock();

I have also created a mock of the Node Object

$nodeMock = $this->getMockBuilder(Node::class)
      ->disableOriginalConstructor()
      ->getMock();

$nodeMock->expects($this->any)
      ->method('__get')
      ->with('field_symbols_in_this_story')
      ->willReturn($entityReferenceMock);

The method returns a Node object but how can I assert that the Entity Reference Field Value has changed?

Edit: The class with more details:

class ClassIAmTesting {
  public function populateSymbols(Node $node) {

    $body = $node->field_body->value;

    $dom = Html::load($body);
    $xpath = new \DOMXPath($dom);

    foreach ($xpath->query('//span[@class="tooltip"]') as $xpathNode) {

      $symbol_id = $xpathNode->getAttribute('data-symbol');

      $node->field_symbols->appendItem(['target_id' => $symbol_id]);
    }

    return $node;
  }
}


texts: Collapsing Images contained in Fluid Grid View

texts:
Hi there. I would be very grateful for your help.

I have images contained in fluid grid (D7 module), all of them are initially collapsed (just like the img on the bottom left) upon site loading. What I need to do is to right-click the collapsed bar then it will be shown ('cause left-clicking will direct me to its link). This is happening on my chrome browser; FF works fine. I am currently using a sub-theme of Creative Responsive Theme.

What I already did to hopefully resolve the problem was to uninstall the module then re-install; undo changes to my .content a img {... }; clear all cache; but still no luck. Also, I have read docs about the theme and the module, there are no inclusions regarding this error.


texts:
I have a vocabulary Area for classifying maths problems, with two parent terms (Pure and Applied) and appropriate child terms (Geometry, etc.) under each. Problems (a content type) are tagged with the appropriate areas of mathematics that they cover.

I also have a table page defined in Views with filter criteria Type (= Problem) and Area (exposed), for listing all the problems.

The problem I have is as follows: If someone selects `Applied Mathematics', nothing appears, because Problems are only tagged with the child terms.

How can I get all the Problems to show up?

In Drupal 7 I should add!


texts: Sending newsletters of restricted content

texts:
We have a single Drupal site, which contains our public facing website, as well as our internal Intranet.

All of the Intranet content uses content types which are restricted to certain user roles.

Within the Intranet section, is a content type named "Intranet News Item", which is pretty much as it says on the tin! We would like to send a weekly email which contains a list of all the new news items.

I have created a view which does this, but when I try to use SimpleNews (with the Insert Views module), it sends blank. I have tried sending with a different view (of publically viewable content), which works, therefore suggesting that the reason the email is received blank is that the content is restricted by permission.

Is there any way to overcome this that you can think of?


texts:
I'm using Drupal 7, and Fivestar.

I try to display notes in the format of a pie chart.

If the note (= rating) is 5,2 on 10, I would like to have a circle of this type :

I tried Charts (with Google Charts as its charting engine) and Google chart Tools, but I do not manage to obtain what I wish (using the Views integration).

With Google chart tools, I have this problem (only one value is shown), and with Chart nothing displays (i do not use aggregation, just fivestar field in views).

Would you know a solution?

A tabular of the data which I wish to display :


texts: Can Views Bulk Operation be used to re-index specific nodes

texts: Can the Views Bulk Operations module be used to reindex nodes that fulfill some criteria (e.g. nodes of specific type)?


texts: Is it possible to have nested divs in content fields on a view?

texts:
I'm trying to create a view that displays certain content fields inside a div that are contained by other content fields.

For example. I am displaying an image, a title, a body, and a posted date.

I'd like to do something like this

      Title

         1/1/1999

         body text

Is this possible?


texts: How to get an anonymous user session id?

texts:
I am writing a chat module where anonymous users are able to chat with a logged in user via an external websockets connection.

I need an ID to uniquely distinguish the anonymous users and assign them to different connections and keep track of the status of the connection.

How do I (securely) get a unique user id or session id for an anonymous user ?


texts: Is there a limit of tags to associate with content?

texts:
I am currently wondering if this is the way to do it and would therefore like some input.

The idea is that I want to show content to specific users. However this can not be done by creating a view with categories because it may not be all in a group that I want to show the content to.

That is why I am thinking of extracting a list of users (where companies have filtered by their request) and implementing them as tags on the content. I will therefore have total control over who's going to see the content.

Does anyone know of any limitations that might hinder this setup? I do not want the tags to show on the content and to be automatic generated from the list. Is this possible?


texts:
I am trying to use  the group method hasPermission(permission_label, user). I found an example that  is the following:

$group->hasPersmission('administer members', $user)

I would like to know what all the different permissions types are. In particular I want to be able to differentiate whether a user can edit or just view a type of content.

How do I a get a list of the different types of permissions?

Thanks,

Olivier


texts: How to display rendered field dynamically

texts:
It may seem that my question is out of topic, yet if you read whole text, you'll find that not.

I've custom content-type

When I display content of that type, initially there isn't field_zdjecie_1. I want to dynamically display that field, e.g. after pressing the button. How can I do it?


texts: Group by taxonomy term, show node multiple times for every reference

texts:
I have a Content-Type called client and a Taxonomy term called Service. Inside the view I am showing content of type: node and grouping the nodes by the taxonomy reference field. Right now it is shown like this.

**Term Name1**
 node1
 node2

**Term Name2**
 node3
 node4

The problem is the term reference field is allowing multiple and I want to show the node referenced by more than one Term, under each term instead of views creating a new term grouping.

So say I reference node3 with Term Name2 as well as Term Name1 I get the following results:

**Term Name1**
 node1
 node2

**Term Name2**
 node4

**Term Name1, Term Name2**
 node3

How can I avoid this functionality and have the view show this instead?

**Term Name1**
 node1
 node2
 node3

**Term Name2**
 node3
 node4


texts: Filter view list items by user property and item property

texts:
I have a view where I want to output a list of content node teasers. At the moment all content nodes are used, but I want to filter the output to only contain nodes that have a certain value in a taxonomy field property they have, check if the current user has a certain role that is similar to the property and only then show them in the output.

So far I've tried to programmatically filter the output in the hook mytheme_preprocess_views_view_unformatted of my theme with the following code

function mytheme_preprocess_views_view_unformatted(&$variables) {
    $result = $variables['view']->result;
    $entity = $result->entity;
}

but that crashes the site and doesn't give me the results to filter.

Is there a way to filter the content nodes programmatically or view the view settings and if so how?


texts: Deoes any email is send when i open drupal webpage first time?

texts:
I heve a not nice "error/message" from time to time on the bottom of the page... It is sth like this:

SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "220 poczta1.www.www.pl ESMTP Postfix "
SMTP -> get_lines(): $data is "220 poczta1.www.www.pl ESMTP Postfix "
SMTP -> FROM SERVER:220 poczta1.www.www.pl ESMTP Postfix
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250-poczta1.www.www.pl "
SMTP -> get_lines(): $data is "250-poczta1.www.www.pl "
SMTP -> get_lines(): $data was "250-poczta1.www.www.pl "
SMTP -> get_lines(): $str is "250-PIPELINING "
SMTP -> get_lines(): $data is "250-poczta1.www.www.pl 250-PIPELINING "
SMTP -> get_lines(): $data was "250-poczta1.www.www.pl 250-PIPELINING "
SMTP -> get_lines(): $str is "250-SIZE 262144000 "
SMTP -> get_lines(): $data is "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 "
SMTP -> get_lines(): $data was "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 "
SMTP -> get_lines(): $str is "250-VRFY "
SMTP -> get_lines(): $data is "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 250-VRFY "
SMTP -> get_lines(): $data was "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 250-VRFY "
SMTP -> get_lines(): $str is "250-ETRN "
SMTP -> get_lines(): $data is "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 250-VRFY 250-ETRN "
SMTP -> get_lines(): $data was "250-poczta1.www.www.pl 250-PIPELINING 250-SIZE 262144000 250-VRFY 250-ETRN "

The strange thing is that this happens only from time to time and is displayed on the main page at the bottom (usser is not logged in). When user visit the page again (F5), information disappear, does that mean that the web template  have hidden code to send an email about web template usage?


texts: hook_field_presave() isn't getting called

texts:
Summary

I need to edit some data before it gets saved, and hook_field_presave() looks like exactly what I need, but it doesn't get called for some reason.

The Scenario

I'd like to edit data coming from changes to the location field (location module), so that I can look up latitude and longitude information when none is provided and make sure it gets saved.

The implementation

At the moment I'm just adding the hook to the location.module for testing purposes before moving them into a separate module. The code I'm using is this:

function location_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  watchdog('location', 'testing location_field_presave', array(), WATCHDOG_NOTICE);
}

However, the dblog is never updated with my message; the code never runs.


texts: Flag a node but create a view of the nodes that reference it

texts:
We want our logged in users to be able to Flag/Follow our "Fisheries" content type nodes. Users can then create a "Catch" node in the Catches content type and use an entity reference field (Fisheries) to tag the Fishery in which it was caught.

I therefore want to be able to produce a view which shows what's being caught in the Fisheries that the user follows. If they follow 10 Fisheries the View would contain the latest catches from those 10 lakes in date order.

I can see what Fisheries the user is following with this View:

but I want to see what other content type nodes are referencing this node instead. I hope that makes sense!


texts: Commerce - Hide Add-to-Cart form from Anonymous users

texts:
I am constructing a site that will serve mainly agents (authenticated users), but should still show all of the products (without prices) for anonymous users. When logged in, only agents should see the Add-to-Cart form on the product display page, and anonymous users should instead see a link to an "Ask a Question" page.

Is this possible? I looked through the permissions table and could not find a way to prevent access to the cart form by anonymous users.

The only thing I can think of doing is customizing my node--product-display.tpl.php file:

<?php
    if ($logged_in) {
      print render($page['content']);
  } else {
      // something else
  }
?>

I'll have to print the rest of my fields out manually, but as far as I know, this is the only way to print the Add to Cart form. I'm a bit uneasy about this, so I'm humbly looking here for another solution.  thanks


texts: Possible to have variables in migration configuration?

texts:
We are running a continuous migration (using migrate_plus) from a JSON API which supports last_modified_since as a query parameter. I would like to run this job every hour, and use the time of the previous run as parameter.

What would be the best way to achieve this? I tried tried overriding the variable by adding to the $config array in settings.php, but that is probably not even supposed to work.


texts: How can I create a programmatic Search API query which uses a date field

texts:
I'm trying to create a programmatic Search API query. I've successfully created one which looks for all nodes which are published:

  $index = search_api_index_load("node_index");
  $myQuery=new SearchApiQuery($index);
  $myQuery->condition('status', '1', '=');
  $data=$myQuery->execute();
  $results=$data['results'];

However the condition that I want to search for is to find all nodes with a certain date on a date field.

The problem is I can't work out how the Search API stores dates. I've tried UNIX time stamps:

  $myQuery->condition('field_application_end_date', '1411084800', '=');

And the PHP date format that is stored on the nodes however neither returns any results.

  $myQuery->condition('field_application_end_date', '2014-10-01T00:00:00', '=');

Can someone explain how the Search API stores dates?

I've been digging through the module to try and work out how it's done, but it's a little out of my league.


texts:
I've got a view where I approve webform submissions, update a table column programmatically and send out e-mails through its tpl file. However, somehow I'm getting wrong and $uid and therefore e-mails go out to the wrong people.

I tried to debug this using dpm(), that's how I know I'm getting wrong values. I first thought I am setting variables in the wrong place but I doubt that because it's the same even though I changed the lines. Can you help me? Below are my codes for setting variables and sending out e-mails:

<?php

if(isset($approve))
{
  $uid=$submission->uid;
  $nid=$submission->nid;
  $sid=$_POST['sid'];
  $sponsorid=$_POST['sponsoruid'];
  dpm("uid:".$uid);
  dpm("nid:".$nid);
  dpm("sid:".$sid);
  dpm("spid:".$sponsorid);
  if (empty($sponsorid))
  {
    $sponsorid=0;
  }
  $url="/proje-basvurulari";
  $num_updated = db_update('webform_submissions')
    ->fields(
      array(
        'approval' => '2',
        'sponsorid'=>$sponsorid,
      ))
      ->condition('sid', $sid, '=')
      ->execute();

  $date=date('d-m-Y', $submission->submitted);
  $fdetails = db_query("select * from {users} where uid=$uid")->fetchAll();
  $sdetails = db_query("select * from {users} where uid=$sponsorid")->fetchAll();
  dd($fdetails);
  dd($sdetails);

  foreach($sdetails as $s) {
    $semail=$s->mail;
    $sname=$s->name;
  }
  foreach($fdetails as $f)
  {
    #$femail=$f->mail;
    $fname=$f->name;
  }
  $femail = $submission->data['4']['0'];
  ...
  ?>

$uid and therefore $fdetails are set wrong. Isn't $submission->uid supposed to be the uid of whoever filled out the webform?


texts:
I have a java application that will send a CSV file to a Drupal 7 site through using POST method.

how i receive file on drupal side by using custom module

I need to parse the file to add data into a custom table.


texts: Passing a value from a custom controller to a specific template

texts:
I'm trying to update the user profile template with information from a custom module.

For example, in the controller, I am using the following code.

$build ['send_data'] = array(
  '#theme' => 'my_custom_template',
  '#content' => $result,
);

I also implemented hook_theme() using the following code.

function my_custom_theme($existing, $type, $theme, $path) {
  return [
    'my_custom_template' => [
      'variables' => ['content' => NULL,]
    ],
  ];
}

It works perfectly in the custom template when I use {{ content }}

But now, when i try to send value to 'user template'
i got no result on my page

i am using the following code

.controller (current module) :

$build ['user'] = array(
        '#theme' => 'user',
        '#campagne' => $result,
    );
return $build

.module (current module) :

function my_module_theme($existing, $type, $theme, $path) {
  return array(
    'user' => array(
      'template' => 'user',
      // This array contains the default values.
      // You should not use a PHP variable.
      'variables' => array('campagne' => NULL),
    ),
  );
}

function hook_preprocess_user(&$variables) {
   $variables['campagne'] = $result;
}

user.html.twig (external module template)

{{ campagne }}


texts: I have my test server installed locally with MAMP and so far everything is going fine but one concern I am having is how will I deploy my server remotely once I want to have a live server.  Is there an easy workflow to export all your content, fields and views so that I can move them to a remote server using ftp maybe?  How does this type of workflow normally work?


texts: Node reference count does not get updated when adding referrer content

texts:
I am using:

Drupal 7.41

Entity Reference Count 7.x.1.dev

I have two content types say A and B. The content type B has a field that refers to content type A.

I have added count field to content type A ( to get the count of how many content of type B refers to A ).

When I add a content of type B and refers to some content of type A, the count field in content type A does not get updated. However when I edit that particular node of type A and save it, the count updates.

I have used the count field to display on view and unless I explicitly save the content type A, I do not get the updated count.

Update:
The node reference is set in commerce product type, which is further rendered as inline form using product reference in the content type B. The node reference refers to Content type A and the products are added as content type B. I need to get the count of how many products are actually referring to content type A.

Please suggest.


texts: programatically adding field collection items on form submit

texts:
I need a help in creating field collection item dynamically. here is the use case.

while editing a node, i've some media files to be uploaded to third party using their api (ajax file upload), after I get response, i need to add an item to existing field collection. when we are doing this by using entity_create, setHostEntity, collection item save etc it is not working. If we save it to the default collection item available by using index 0 it works but unable to create other items on form submit.

please share your inputs, if we are missing something or this needs a different treatment/customization etc.

thanks in advance


texts: Table form valueCallback strange behaviour

texts:
I am creating a table form using the table element. I do not push sub elements into #rows. I work as with children elements. But valueCallback does not map values right. I am looking inside. It looks very strange. Especially:

return is_array($input) ? array_combine($input, $input) : [];

$input always is array. So combining result is weird with "array" key
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21Table.php/function/Table%3A%3AvalueCallback/8.5.x

public static function valueCallback(&$element, $input, FormStateInterface $form_state) {

  // If #multiple is FALSE, the regular default value of radio buttons is used.
  if (!empty($element['#tableselect']) && !empty($element['#multiple'])) {

    // Contrary to #type 'checkboxes', the default value of checkboxes in a
    // table is built from the array keys (instead of array values) of the
    // #default_value property.
    // @todo D8: Remove this inconsistency.
    if ($input === FALSE) {
      $element += [
        '#default_value' => [],
      ];
      $value = array_keys(array_filter($element['#default_value']));
      return array_combine($value, $value);
    }
    else {
      return is_array($input) ? array_combine($input, $input) : [];
    }
  }
}

For me $input already is ready to move into #value. It does not need altering here.
I hope it works well and I do something wrong. But not it seems weird for. Clarify it, please.


texts: How can I change css checkboxes of facet Api module of drupal?

texts:
I am using facet API, in left sidebar list of check boxes showing with padding in UL. I want to remove that. I search a lot and I found that it's come from java script.

Fields of study

Configure

Configure facet display

Configure facet dependencies

Configure facet filters

Configure block

<input type="checkbox" class="facetapi-checkbox">Business administration / Management (1)Apply Business administration / Management filter

<input type="checkbox" class="facetapi-checkbox">Education science (1)Apply Education science filter

<input type="checkbox" class="facetapi-checkbox">Visual arts / Design (1)Apply Visual arts / Design filter

This is  div example it's calling css from live of bootstrap itself. Here using facet API. May I guess you can understand my problem. I can't able to change any CSS.  Its using Drupal module  to implement CSS.


texts: How can I embed a View inside a content of a node?

texts:
How can I embed a view inside a content of a node in Drupal 8?

I found something similar, for example in the question about "How do I embed a view inside a node?" or the Viewfield module, but it is all for Drupal 7.

I tried with an Entity reference field pointing to a View but it display only a label and from the Manage Display tab I can choose only from Label and Entity ID. I need something like the "Rendered entity" option that is present on Entity reference fields pointing to other nodes.


texts: Prorgrammatically generated quicktab does not display content

texts:
I have programmatically created a quicktab but the contents of the tab do not display. I have followed the instructions and have looked at this related question but it does not work for me. I suspect I must be missing something simple. Here is the code for creating the quicktab:

function create_quicktabs() {

  $block_ids = array(
    'Books & Journals' => 'books_journals_search',
    'Articles' => 'articles_search',
    'Archives' => 'archives_search',
    'Databases' => 'databases_search',
    'Course Reserves' => 'course_reserves_search',
    'Institution Repository' => 'repository_search',
  );

  $tabs = array();
  foreach ($block_ids as $title => $block_delta) {
    $block = block_load('catalogue_search', $block_delta);
    $tabs[] = array(
      'title' => t($title),
      'type' => 'block',
      'bid' => $block->bid,
      'hide_title' => TRUE,
    );
  }

  // Configure the QuickTabs options
  $quicktabs_options = array(
    'style' => 'Bullets',
    'ajax' => FALSE,
    'sorted' => FALSE,
  );

  $quicktabs_name = 'catalogue_search';
  $quicktabs = quicktabs_build_quicktabs($quicktabs_name, $quicktabs_options, $tabs);
  return $quicktabs;
}

I get no errors when this is run, but it seems as though quicktabs can't find the block to display. I have verified that the blocks do exist and the block ids are valid. I have also tried using block_delta for the bid value - again same result. This is for Drupal 7 by the way. What am I doing wrong?


texts:
There are no shortages of options for slide shows in Drupal: views, modules, themes, etc. However, I need an option for inside the Body Field. I'm dreaming of an option that

Content editors can assemble without manually entering Javascript or CSS in the body or Code Per Node field
Accessible to screen readers (Jaws, Voiceover, Orca) by having Aria roles and landmarks in place
Is a module which, perhaps, employs an input filter.

Does such a solution exist? Is this a time to begin exploring Polymer more deeply?

In all my searches, I've seen blocks and views, but nothing that can be dropped into the Body Field.


texts: Drupal 6 to Drupal 7 content type migration using feature module?

texts: We have to upgrade Drupal 6 site to Drupal 7. We know that we can use migrate module for importing Drupal 6 content. But I'd like to know if we can use Features module for importing content types, taxonomies and blocks from Drupal 6 to Drupal 7?


texts: Pass variable to field template from theme_preprocess_field()

texts:
I'm stuck trying to pass variables from my theme_preprocess_field function to my template file. I want to have a variable for each of the fields I am printing out to my template.

I'm using the Paragraphs module in Drupal 7, so that might be throwing me off, but I feel like I'm really close. Here's a simple example:

Preprocess function in my template.php:

function merge_preprocess_field(&$variables) {
    $element = $variables['element'];
  if (isset($element['#field_name'])) {
    if ($element['#field_name'] == 'field_title') {
      $variables['test_title'] = $variables['items'][0]['#markup'];
    }
  }
}

The name of the template I am using is paragraphs-item--full-text.tpl.php.

field_title is the name of a field inside a paragraphs bundle called full-text.

Everything that I have read so far indicates that I should be able to access the $variables['test_title'] variable in my template this way:

<?php print render($test_title); ?>

It doesn't print, even after clearing the cache. It's even showing up in the array when I krumo($variables);. Am I missing something?


texts: How do I display three months in the event calendar view?

texts:
I used calendar and views template module to create a calendar view for my Drupal 8 site, but the view returns only one month.

I want to display three months. How can I get this?


texts: How to show/hide fields based on visitor's country?

texts:
I have two fields (consider field_A, field_B). Anyone should see only one of these 2 fields based on their IP address:

If users from US access the page, only field_A should be visible.
For other countries, field_B should be visible.

How can I achieve this?


texts:
I’m setting up a dual language site (English default / Chinese, Simplified) where Taxonomy translation mode is “Localize”.

I modified the Taxonomy term in Views.

I get results with preview in both default and translated language.

In page views, English is okay. However, Chinese page return “Page not found”.

I have tried Content: Has taxonomy term ID (translated) & Content: Has taxonomy term ID (with depth, translated) and a different validator "Taxonomy term (i18n)".

What did I missed? Please enlighten.


texts:
I'm trying to achieve this...

A Views that shows as result the names of people who do not appear in list of published nodes of a content type.
(List of people who will not attend an event...)

Configuration:

Content Type Event:
Person field, supports adding more than one (multivalue), using autocomplete.
This field is of the entity reference type and displays the list of possible names obtained from the result of a view.

Assuming that the list of persons is total A B C and D.

I create 1 node of event type
And I included people A and B.

The result of the views should be...
People C and D.

Is this achievable?


texts:
Getting an error while installing drupal 7 using xampp

  An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path:
  http://localhost/tes/install.php?profile=standard&locale=en&id=1&op=do
  StatusText: OK ResponseText: Fatal error: Maximum execution time of 30
  seconds exceeded in C:\XAMPP\htdocs\tes\includes\database\database.inc
  on line 2171

I also tried reinstalling xampp but still didnt work out


texts:
While working with Drupal 7 we've got a problem, I'm not sure if it's a known bug or our personal issue. Anyway, I couldn't find such an issue while searching.

The issue is actually about order of threaded comments. Once activated, the order of comment answers goes wrong. For example (every next post is an answer to a previous post):

|| original comment
   || first answer
      || second answer
         ...
            || 12th answer
               ||13th answer (at this point is alright)
               **! here starts the problem**
                  || 15th comment
                     || 19th comment
                        || 18th comment
                           || 17th comment
                              || 16th comment
                                 || 20th comment
                                    || 14th comment

We first thought that it's our theme issue, but it's reproducible in Bartik as well. Any ideas?

Thanks in advance.


texts: Drupal 7 + Commerce + Addressfield remove specific  from form markup

texts:
i use drupal + commerce + adressfield and i am cleaning up the checkout-page form markup (at least i try).

i am familiar with the theme functions of form.inc and have removed some divs aleady using this functions but one of the divs i dont know were it is defined.

dpm(); says it resides in  $element['#children'] but ['#children'] is the whole markup including the div i want to remove.

to be clear: i want to remove the red marked outer div only!


texts: Handle nested Exceptions in delete hook & Ignore DrupalKernel Exception handler

texts:
I have functionality that checks if entities can be deleted or not.
These entities are vast and most of them are linked together with EntityReference fields.

Now in some cases I want to check if an entity can be deleted, and that all depends on the existence of related entities.

Probably better to explain with an example.

I have entities related like this:

Entity1
└── Entity2
    └── Entity3

(So Entity3, has en entity reference field to Entity2, and Entity2 has one to 1).

The rules:

If Entity1 has entities of type Entity2 related, automatically delete all related entities of type Entity2.
If Entity2 has entities of type Entity3 related, The entity of type Entity2 cannot be deleted. And thus if the delete happens through a cascading delete from Entity1, that Entity cannot be deleted.

The code is quite a lot more complicated, but the gist of it is:

I added a delete hook on Entity1, that queries all the related
Entity2 records and deletes them.

    function hook_entity_entity1_delete($entity)
    {
      try {
        $connection = \Drupal::database();
        $transaction = $connection->startTransaction();
        // Query entity2 entities and delete them
      } catch(\Throwable $t) {
        $transaction->rollback();
        throw $t;
      }
    }

I added a predelete hook on Entity2, that queries all the related Entity3 records, and if records are found. Throw an Exception.

    function hook_entity_entity2_predelete($entity)
    {
      // Query entity3 records and if found:
      throw EntityHasRelatedRecordsException();
    }

This all works under perfect circumstances, however, in case someone that uses my module writes a custom predelete hook for Entity3. And does something that causes an unhandled exception. The unhandled exception is catched by the default Drupal Exception handler defined in DrupalKernel.php and enters the exception handler here in bootstrap.inc

Now Drupal does not throw that exception again. And because of that the code can never enter the catch on hook_entity_entity1_delete. And my transaction gets commited to the database. So the Entity1 is deleted, but all related Entity2 and Entity3 records stay in the database.

How can I make sure my logic is safe for custom implementation that might contain unhandled exceptions or runtime errors?
Is there a way of defining my own exception handler?


texts: I have a view with user-reference. In the field 'data' in the table 'user' there's a serialized array with one element, named 'department'. I managed to show the department-value in the referencefield in the backend. I can't manage to show the department-value in the front-end. Which setting or code-changing do I have to change?


texts:
I have a simple content type, which contains the fields:

Title
Body

In my view the titles of the above content type are listed. When I click on a title, I want the body of the corresponding node to be loaded with AJAX and appended after the title.

Has anyone a hint for me, how to accomplish that?


texts: Views: Display Total number of products in commerce kickstart shopping cart

texts:
I'm using menu badges to display the total number of products in the commerce kickstart shopping cart. However I cannot simple use aggregation to count the total number or products using line item ID because I need to multiply it by the quantity, and add it to the total.
Since the shopping cart already displays the total number of items, I though it would have been easy to do some reverse engineering but I couldn't find it.


texts: Output based on taxonomy term value, also if a field has value

texts:
I have a View which I need to alter the output depending on whether the field (taxonomy term) has a certain value. If the value of the taxonomy field is "Yes", I want to add a surrounding  to the view so that it links to a details page. If the value is "No", I want to output without the surrounding  so there isn't a link to a details page as not all of the nodes in the view will have a details page.

Normally in a node template file I'd use "if(!empty($node->field_subtitle['und'][0]['value'])) {" etc but that doesn't work in Views.

Any ideas guys? I've looked through many articles online but can't figure it out.

Kind regards
Liam


texts: Creating Drupal nodes from Javascript (Drupal 7)

texts: We have a page inside our Drupal site that contains two canvases (one webGL).  When the user presses the save button, we create a dataURL (about 300kb) and would like to send this png to drupal (from Javascript) to create a Drupal node.  What would be the best way to accomplish this?


texts: My custom preprocess function works as soon as the cache is cleared, then stops working

texts:
I have a custom Drupal 6 module, with a custom theme function. I have implemented hook_theme in my mymodule.module (main module file) as follows:

function mymodule_theme() {
  return array(
    'mymodule_template_regions'   => array(
      'arguments' => array('template' => array()),
      'file'      => 'mymodule.theme.inc',
      'path'      => drupal_get_path('module', 'mymodule') . '/templates',
      'template'  => 'mymodule-template-regions',
    ),
  );
}

I have implemented mymodule_preprocess_mymodule_template_regions() in a file called mymodule.theme.inc, in the main module folder.

I have placed mymodule-template-regions.tpl.php in the templates subfolder inside my main module folder.

This all works fine when the cache is cleared. As soon as the page is refreshed after the initial cache clear, it stops working.

The offending line is line 696 of theme.inc in Drupal Core version 6.19, which states:

if (function_exists($preprocess_function)) {
  call_user_func_array($preprocess_function, $args);
}

When the cache is cleared, the mymodule_preprocess_mymodule_template_regions function exists, so it gets called because the 'if' statement yields TRUE. However, on each subsequent page request, the function does not exist. I presume this is because, for whatever reason, mymodule.theme.inc is not being included.

This is where my knowledge of Drupal breaks down, as I'm unaware of what else is going on here and how to track down why the function is not being included. It looks like the theme registry is still aware of mymodule_preprocess_mymodule_template_regions, but that it's simply not being called because it's not included.


texts: bypass a character limitation rule (webform)

texts:
Maybe someone could help me ...

Ive got a webform with an input (postal code). I want its maxlength to be 5.

When users fill it, once the 5 digits entered, an autocomplete callback retrieves corresponding cities.

When a city is chosen, the input content is rewritten like "XXXXX - CITY".
Now the field length is more than 5.

When the form is submitted, it is not validated.

I would like to bypass the validation of this specific property (maxlength) ...

Is it possible ?


texts: Embedding the s3slider jQuery plugin in a block

texts:
How can I add a custom image slider similar to this one in a block?
I tried integrating it in a block, but it doesn't work.

What is the best image slider for Drupal 7, excluding the View Slideshow module? I tried using it, but it only displays the last image of the slideshow.


texts: Set the role of users when you're not the administrator user

texts: Is it possible to do this? I can't see any permission I can grant for roles. I want to let a user create other users, but only of a specific role.


texts: How to detect when $form_state data have expired (and gotten deleted)?

texts:
Problem: a user opens a multi-page form and fills out several sections – submitting each time – before returning hours later to finish the remaining parts, leaving their browser open (perhaps needing to look for additional documents or consult with a colleague). When they come back, they are still logged in, but the hard-coded 6-hour limit on storage of their $form_state data has elapsed, and the values they submitted in the previous sections of the form will not load on their next navigation-action since they have been deleted.

Background: for multi-page forms, Drupal stores working $form_state information in the cache_form table until the final submission-step is complete, but its "expire" column is set so that deletion occurs 6 hours after creation. Even if this value is changed, sites featuring multi-page forms may still encounter the above situation, wherein an in-progress form is submitted after $form_state information has been discarded.

How can one detect when this circumstance arises (so the user can be informed of this or so that recovery-actions can be silently taken)?

Note: Though you're welcome to post a Javascript answer if you have one, I won't assume Javascript is always available, and therefore do not consider answers which rely on Javascript to be robust.


texts:
I'm re-implementing an old Drupal 4 site with Drupal 8 and I'm stuck with what I thought was a simple task.

I want to insert some images into an article inline and be able to click on them to see a larger version. Preferably the image is shown in some kind of popover/overlay like Lightbox but even loading a new page or just the image in its original size would be OK.

With Drupal 4, I had Gallery 2 integration and this was piece of cake: just enter a placeholder like [G2:1963] in the body text (with 1963 being a Gallery 2 image identifier) and that's it: the image is now shown as thumbnail and when I click on it, the corresponding Gallery 2 page is opened.

I don't need Gallery 2/3 integration (and AFAIK there is none for Drupal anyway as Gallery is going the way of the Dodo). Drupal 8 has support for adding images to an article. But there doesn't seem to be a simple way of adding them inline.

In the CKEditor, I can add an image inline. But there's no way have it shown as a thumbnail and get the large version when clicking on it.

Then there's the image field: it allows me to add images, but they are all shown in some kind of gallery and the end (or wherever you place the field). Not what I want.

The workaround I've come up with is to hide the image field and then add the necessary HTML myself, like:

But this is very cumbersome and feels so very wrong. So, how can I solve this in Drupal 8?


texts: How to create custom date display format in drupal 7?

texts:
I have created content type for an events in which I mentioned multiple values for date field. I want to display date like Nov. 2, 6 & 8   or Nov. 2-5, 12 2014 & Jan 22 2015

After some research I am able to create a view of event date field like

Nov 23 2014, Nov 26 2014, Nov 30 2014, Jan 03 2015 to Jan 05 2015

But still not getting format I want like

Nov 23, 26, 30 2014 & Jan 03-05 2015


texts: How to import nodes that reference each other using Feeds?

texts:
I have a content type that references nodes of the same content type (using References module).

So example nodes might look like this:

Title   Body       See also (Node reference)
AAA     Testing    CCC
BBB     Testing
CCC     Testing    AAA, BBB

I'm pulling all of this information from an XML feed using Feeds Node processor. The problem is that when creating node AAA, node CCC hasn't been created yet so the reference field doesn't populate.

Do I need to create a second importer - but can two importers update the same nodes? I also had a look at Feeds Self Node Processor but don't think that's the answer.


texts:
I have ported a drupal 6 site to 7.

I have a client who has the ability to add links to a menu structure.

The structure is outputted using the module tb-mega-menu.

Twice since allowing the client to administer the menu there has been incidents where some of the menu items do not appear.

I was wondering if anyone knew of any bugs related to this scenario?

The solution I've already got is to just export the menu to a .txt file and import it again using the module import_menu. But this is ideally just a short term fix.

Can anyone advise me on a bug or a solution to this problem?

Thanks in advance.


texts: How do I upgrade the security updates for the open deals distribution?

texts:
I have recently installed the Opendeals distribution and am trying to install the security updates required.  I have tried the suggested method of overwriting all files but those in the /site folder but this does not work.

I have read the drush guidance but am not clear on this, are there any other suggested ways of updating drupal core with a distribution?


texts: How to create a rule that loops the line items of a completed order and do a data comparison on a custom field that's on a product?

texts:
I'm trying to create a rule that triggers on the event 'Completing the checkout process' that will then loop through the line items of the order. For each line item I'd like to do a Data comparison on a custom field that's on a commerce product.

This is the rule I created:

"LABEL" : "User needs approval for anything over 500",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
  { "entity_has_field" : {
      "entity" : [ "site:current-user:profile-educator" ],
      "field" : "field_borrow_level"
    }
  },
  { "AND" : [
      { "data_is" : {
          "data" : [ "site:current-user:profile-educator:field-borrow-level" ],
          "value" : "need_approval_greater_than_amount"
        }
      }
    ]
  }
],
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : []
    }
  }
]

And this is the component that I was trying to run through the loop:

"LABEL" : "Check price of each line item",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_price" ],
"USES VARIABLES" : {
  "current_line_item" : { "label" : "Current Line Item", "type" : "commerce_line_item" },
  "current_product" : { "label" : "Current Product", "type" : "commerce_product" }
},
"IF" : [
  { "entity_has_field" : { "entity" : [ "current-product" ], "field" : "field_purchase_cost" } },
  { "AND" : [
      { "commerce_price_compare_price" : {
          "first_price" : [ "current-product:field-purchase-cost" ],
          "operator" : "\u003E=",
          "second_price" : { "value" : { "amount" : 50000, "currency_code" : "USD" } }
        }
      }
    ]
  }
],
"DO" : [
  { "drupal_message" : { "message" : "You need School Administrator approval to check out any item valued over $500." } }
]

For some more context: This site is a library for special education teachers to be able to check out software and hardware for their use in the classroom. Which means that the price for each item is zero since the site is loaning out items at no cost to the teachers. The hang up in this case is that there are three different ‘borrow levels’ for a teacher. The ‘borrow levels’ are: 1. You can check out any item. 2. You can check out any item up to a $500 value. If an item is above $500 you need approval from your school administrator before the order is approved. 3. You need approval from your school administrator to check out anything.

My question here pertains to users with a ‘borrow level’ of 2. Since the products all have a price of zero we added a custom field to the commerce product that has the replacement cost of an item. So, when an order is placed and the user is borrow level 2 I need to look at each item in that order and determine if the replacement cost is over $500. If nothing is over $500, then the order can be flagged as approved. If there’s one or more items that have a replacement cost of $500 or more we need to send an email to that teacher’s school administrator telling them they need to log in and approve or deny the request the teacher has made.


texts: How can I enable search on parts of a word and autocomplete suggestions?

texts:
I'm using Search API in Drupal 8.

I tried with Search API pages and even views, but I didn't find %like% function query

Can I do %like% in Search API or Views?


texts: add same class to book and it's child pages

texts: I have book node with assigned article nodes as child pages. On certain books I want to be able to use different theming. Using context I can print additional css class on book page according to taxonomy. Is it somehow possible that the class can be passed to all child pages as well? I can not figure out some easy solution. The only way I can think of would be to mark child nodes too. Any ideas? Thank you.


texts: How do I remove the appended string from image and Javascript URLs?

texts:
I have a Drupal 8 website. I have installed the Advagg module. The URL for the JavaScript file has a string appended.

https://example.com/libraries/superfish/superfish.js?pzw4cp
https://example.com/libraries/superfish/superfish.js?pzy2r8
https://example.com/libraries/superfish/superfish.js?pzzsmo
https://example.com/sites/default/files/js/optimized/js_rKIkMy4-wmUaGP59iZKW9XJMLcVwjsfB0SXmAPmdK1I.sEln9qPOr9xw2O4-sGx2Wja5YU2bXXCG59CPiBDxwUY.js?q0emwu

The same happens for the URLs of the uploaded images. Sometimes, the browser doesn't display the image, when its URL has that string. If I remove the string, the image is displayed. Google search console reports such files as malware.

How do I remove those strings from the end of the URL?


texts: Adding Background image in Views template file

texts:
How to add background in Drupal 8 views-view-fields.html.twig' files.

I try like this but it's don't work. Using views I just output image paht.

 <div class="cover-img" style="background:url('{{ field_image }}');">
    </div>

Thank you


texts: Send E-Mail When User Profile Fields Updated

texts:
I am looking to update my brain regarding a set of rules in Drupal 7. What I am wanting to do is:

Send e-mail to arbitrary e-mail address (mine) when a user updates any of their user profile fields.
I want the updated fields to appear in the e-mail template.
It would be helpful to have the old information showing the new updated field information.
Avoid sending e-mail when password is reset or changed.

I am probably missing something basic here with data comparison but thought I would seek out some thoughts on this.


texts: How do I configure a view that gets a taxonomy on a node, and retrieves fields from the taxonomy?

texts:
I have a view, which only appears when you navigate to certain nodes.

Each node which it appears under, has a taxonomy with a field called 'related_content_entity' referencing some related content. The node only has one taxonomy. I need the view to display data from the related_content_entity for the current node's taxonomy.

The brick wall which I have seemed to hit, isn't the entity reference, but filtering the results down to the one field referenced in the taxonomy associated with the node.

I get expected behaviour up to this point; creating a required relationship to the entity reference like this:

Gives me this result:

Which is entirely expected. But specifically what I can't figure out it how to filter these results down to the current node's taxonomy field. There's not a single contextual filter which I've tried which would filter the result down to only the node's taxonomy's field.

To put what I'd like to acheive more clearly:

Node-1 is under taxonomy-1, and taxonomy-1 has node-2 as an entity reference (though the entity reference module) in one of it's fields.

When view-A appears on Node-1, I'd like view-A to display the entity reference.

How do I do this?

Edit: This is my current set-up. This the input:

And this is the output:

@rooby, thanks for your help, but I don't actually get any results if I add any contextual filter under the sun.


texts:
The first time that the user login to the page, have to be redirected to the user edit profile to fill a field (Id) that is mandatory at the first login, I tryed using drupal_goto at hook_user_insert and hook_user_presave and don't worked. How can I do that? In which hook I can do that?

EDIT: I am using LDAP Authentication, user don't have to fill a form registration.


texts: find out object properties passed to a function

texts:
which is the best way of debugging codes in drupal?
for instance in election module there is a submodule called conditions, and there is a function:

function election_example_conditions_access_gmail($post, $account) {
  if ($account->uid == 0) {
    return FALSE;
  }
  return (bool) preg_match('/g(oogle)?mail\.com$/i', $account->mail);
}

in the above code, what is the easiest and fastest way to find out what is the $account object passed to function?


texts: Permission Issue with created actions and VBO

texts:
I’ve created a new action in a custom module using hook_action_info()

/**
 * Implementation of hook_action_info().
 */
function recruiteractions_action_info() {
  return array(
    'applicationentity_recruiterfillposition' => array(
      'type' => 'application', // <-- New entity type here
      'label' => t('Application Postion Fill Action'),
      'behavior' => array('changes_property'), //<-- Triggers an entity save.
      'configurable' => FALSE,
      'vbo_configurable' => FALSE,
      'triggers' => array('any'),
    ),
  );
}
function applicationentity_recruiterfillposition(&$entity, $context = array()) {
  $app_wrapper = entity_metadata_wrapper('application', $entity);

 $app_wrapper->field_job_status->set(‘1');
 $app_wrapper->save();

}

After enabling in VBO this all works fine and as it should.  The issue being when i set this to the role I need it to be set on.

the ‘Actions permissions (VBO) module is activated. and I can see the action; and have ticked the roles needed but with no joy.

I’ve also checked the ‘field_job_status’ permissions for the role I wish to allow to make changes.

On Drupal hook_action_info page https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_action_info/7  there is a post regarding 'behavior's impact on permissions and specifically mentions VBO.  however I'm not sure on what I need to do.  Has anyone got any examples for this.


texts: How to interpret the code: module_invoke_all('user', 'logout', NULL, $user);?

texts:
How to interpret this line of code?

module_invoke_all('user', 'logout', NULL, $user);

Obviously, it logs out the current user, but how do the four arguments make it happen?

I read through the doc, but I can't find information about the four parameters.

Can anyone explain?

From Documentation:
module_invoke_all()

Invoke a hook in all enabled modules that implement it.

Parameters
$hook The name of the hook to invoke.
... Arguments to pass to the hook.


texts: How to manage correctly file security permissions in windows

texts: In "Securing file permissions and ownership" there is a little bit of what to do to manage security in windows, but it isn't step by step enough... Has anyone already done these configurations in windows ? How do we exactly and explicitly do ?


texts: Module's new release not showing link to download

texts:
I created a new branch for a module I co-maintain, today. I followed the instructions and the branch is showing up. But, the problem is that the download links and dates are absent.

How do I create them? What extra work needs to be done?


texts: Parsing the 'q' in drupal to get the current URL

texts:
So I am attempting to parse out the URL, so that I can get a specific page template to be used for a specific URL; if the URL is example.com/team, then use page-team.tpl.php.

However, when I do this, the URL I am getting (via $_GET['q']) always seems to be the URL from where I was, not the one where I am currently at. If I directly navigate to example.com/team/surf, it gives me "team/surf"; if I go to example.com/team it gives
"team/surf." If I refresh the page, it will then give me the desired one.

I dropped this code into my template.php file.

function theme_preprocess(&$vars, $hook) {
  switch ($hook) {
    case 'page':
      $normal_path = trim($_GET['q'], '/');
      $path_alias = drupal_get_path_alias($normal_path);
      $alias_parts = explode('/', $path_alias);

      if (($alias_parts[0] === 'team') && (count($alias_parts)) == 1) {
       $vars['template_file'] = 'page-team';
      }
      break;
    }

Do you have any idea on what is going on here?


texts: How can I tablesort by term weight instead of term name?

texts:
I've got a View for Nodes and display some fields as column.
All columns should be sortable.

One field is a term reference. In order to sort the terms by names I create a relationship on the reference field and add a field Term Name with reference to this relationship.
As a result I get the name and I can alphabatically sort the names.

But even more I would like to sort on the term weight instead.
Is there any solution out there?


texts: How do I programmatically attach a file to a file field in a node?

texts:
I have a custom content type with a file field. I am trying to attach a file uploaded through a custom form to the custom content type. I am able to load the node and update all the other values of the node except the file field.

I found Realityloop: Programmatically attach files to a node in Drupal 8,  but it doesn't seem to work.

This was what was suggested in the above link

$node = Node::create([
  'type' => 'article',
  'title' => 'Druplicon test',
  'field_image' => [
  'target_id' => $file->id(),
  ],
]);
$node->save();

This is what I have tried inside submitForm

$fid = $form_state->getValue('file_field_name')[0];
$file = File::load($fid);
$file->setPermanent();
$file->save();
$node = Node::load($nid);
$node->set('file_field_in_node', $file->id);
$node->save();

That was setting the file as permanent in the files table but the node did not have the file.

I also tried to save with

$node->set('file_field_in_node', $file);

That did not help either. I am also curious as to which is the file/function that handles the set function for the file field.

UPDATE:

[SOLVED] Not sure what was wrong earlier. Both the approaches seems to be working correctly now. So setting the file_id or the file object into the file field for the node seem to be saving the node correctly with the file attached to it.


texts: Config import conflict, how to remove lock

texts:
I am trying to import config on my staging site, and I repeatedly get the following message:

  Another request may be synchronizing configuration already.

I know that there are no other processes currently importing config, so there is some rogue lock.

I am using config_split module on the site, but both methods of config import report the lock.
I have updated the site to Drupal 8.6.1 but the issue may have existed prior to the update.

Question: How can I remove the lock using Drush or some other method?


texts: Re-Indexing on Search setting, What for?

texts: What is the function of re-index in the search setting in Drupal? And if not re-indexing, what happened? What different with run cron?


texts: The cutom filter block disappears when new search key is entered

texts:
I am using the Search API, I have created a /search page for observing the search results based on three entity types. I have two exposed filter: The "Fulltext Search" filter is located in the navigation bar, and "Filter by content type" is located in the content region. (To split two exposed filters into two different blocks, I had to dublicate a /search page).
The issue for me is that, whenever the user enters a new search "key", the "Filter by content type" disappears. The "Clear Cache" solves the problem, but in the build() function, I set the max-age to 0, so the reason is not a cache. Why does it happen?

public function build(){

if($this->search_filters){
  $render = '';
  foreach($this->search_filters['value'] as $key => $value){
      $block = $this->renderFilter($value, $identifier);
      $render .= render($block);
  }
  return array(
    '#type' => 'markup',
    '#markup' => $render,
    '#cache' => array(
      'max-age' => 0
    ),
  );
}

}


texts: Can't access to my database while installing the site

texts:
When I try to install my Drupal site, I pass throughout the first 2 steps. When I type the name of database, username, and host, nothing happens. I only see the errors about username, database, and host being required.
When I looked into the error.log file, I found this error.

XAMPP Error: www.example.com:443:0 server certificate does NOT include an ID which matches the server name.


texts: Custom Content Type with Custom Fields creation

texts:
I followed the examples given at: https://www.drupal.org/node/2629550  to create a new content type.  No problems there, the content type exists after I install the module.  However, when I uninstall, and re-install with the custom field yml files it says to have, I get errors saying that the field storage doesn't exists.   So I dug into core/modules/node/config/installand copied the field.storage.body and modified it for the field I wanted (username).  The field created, however, when I install the module now... It says:

Drupal\Core\Field\FieldException: Attempt to create a configurable field for a non-configurable field storage. in Drupal\field\Entity\FieldConfig->__construct() (line 94 of C:\xampp\htdocs\drupal-8.4.4\drupal-8.4.4\core\modules\field\src\Entity\FieldConfig.php).

Here is the yml for the custom content type:

#node.type.faculty_bio.yml
langcode: en
status: true
name: "Faculty Bio"
type: faculty_bio
description: "Faculty Bio"
help: ''
display_submitted: true

and the code for the custom field:

#field.field.node.faculty_bio.username.yml
langcode: en
status: true
dependencies:
  config:
    - field.storage.node.body
    - node.type.faculty_bio
  module:
    - text
    - node
id: node.faculty_bio.username
field_name: field.storage.node.username
field_storage: username
entity_type: node
bundle: faculty_bio
label: Username
description: 'The username'
required: true
translatable: true
default_value: {}
default_value_callback: ''
settings:
  display_summary: true
field_type: text


texts: How can I refer to a table to make a level system?

texts:
I'm working on a RPG website. Users are awarded userpoints (named XP for the need of the "game") depending on their actions.

I want to make a level system based on these userpoints. I already made a table using Drupal Data, which stores values for each level (level number, minimum XP, maximum XP, and some ratios to apply when a user is earning points).

My question is : How can I refer to this table to check a user level (and all the values attached) depending on the user's amount of XP?

I tried with Rules, but no success.


texts: Programmatic equivalent of edit save without making changes?

texts:
Background
This is a little unorthodox but we have a custom avatar builder based on the avatar selection module, where users can build their own avatars. The information about which images are selected to compose the avatar are stored in a blob in imported user but once the profile is saved, the blob is converted into an image and stored with a reference in the file_managed table.

I "migrated" over the user table from the legacy Drupal 7 website to a new Drupal 7 website in order to preserve the blob, but ignored the image reference in the picture field, for reasons I'm not going to get in to here.

As a result, the user now has a default image until either they or an admin clicks to edit their profile, at which point their avatar selection loads on it's own and the user or admin just has to click save, then the default image updates to the correct avatar.

Question
My question is: is there a programmatic equivalent to clicking "edit save" for all user profiles?

What I've Tried
I added bulk operations and modify entity values to a user search view and tried modifying something in the profile, such as editing a custom field. What ended up happening is that not only was the image not updated, but the edit save method will not work to pull up the blob and the blob information disappears.

This seems to be the case with simple edit user role, make active, or any other bulk edits. It seems that you have to actually have the avatar builder open in order for it to rebuild.

Thanks!


texts: Recommended taxonomy/structure for destinations site

texts:
I am building a site with the primary goal of capturing detailed information about different destinations around the world. What is the recommended site structure for something like this using drupal 7?

So far I envision: my nodes would be a custom location type with the location's details expanded out using fields. I would then replicate the location hierarchy into a hierarchical vocabulary (Continent > Country > City, etc.) so users could search for a specific location. Should the hierarchy be flat (one vocab for Countries, another for Cities, etc.)?


texts:
I have a table in my site that I build in my own module with theme table. I want to be able to have a sort of link in each even row (the ones with the color buttons) that allows me to collapse those rows. In fact, when loading the page, those rows should be already collapsed and only visible if the user wants.

Is this even possible using theme table? Is there any alternative I should use to do it?

Thanks


texts: Get the last revision id of any given entity?

texts: Is there a single, unified method in Drupal 7 to get the last revision id for any given entity object?  If so, what is that method?


texts: Which table stores the content type fields?

texts: I have a content type in drupal 8 and which table stores the content type fields and type in drupal 8 ? Unlike in drupal 6 (in which there will be tables specifically for content types) like content_type_contenttypename its not creating the table and fields . Where will be these fields and data types stored in drupal 8 ??


texts:
I am trying to create a module which will easily allow me to set up basic sites with specific settings on the fly for a project I'm working on. I am having trouble creating a new user role. I have tried the following code within hook_update_N(), but it doesn't seem to work.

$role = new stdClass(); // create your Class
$role->name = 'editor';
user_role_save($role);

How do I programatically create a new role?


texts: How to override ViewsExposedFilterBlock with my own class?

texts:
I want to add an additional form element in the configuration form for core/modules/views/src/Plugin/Block/ViewsExposedFilterBlock.php by adding

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildConfigurationForm($form, $form_state);
  $form['my_new_form_element'] = [...];

  return $form;
}

If I hack core and add that code in the file, it does what I want. But of course I don't want to hack core. So I'm trying to figure out how to make it so that my custom module's block class is used instead of ViewsExposedFilterBlock.php.

So how do I alert Views to use my class, ExposedFilterImagesBlock.php?

Information that I've found that might help you help me:

ViewsExposedFilterBlock.php has deriver = "Drupal\views\Plugin\Derivative\ViewsExposedFilterBlock" in its annotation. So I'm assuming the deriver plays an important role...just one that is unclear to me.

Thanks in advance for any help you can provide!


texts: use drupal_add_js for file outside drupal dir

texts:
I would like to add a js file thats outside my drupal installation dir, but keep it relative to that dir.

mysite
  |-- drupal
  |-- dirWithJsFile
      |-- thisfile.js

i have already tried things like

/../dirWithJsFile/thisfile.js
../dirWithJsFile/thisfile.js

but add_js seems not be able to go outside the drupal dir or is there an option i must set?


texts: How to skip "Checked available update data for" all modules when I just want to update core or a specific module?

texts:
I'm upgrading a lot of my Drupal sites to 7.32. Unfortunately it takes a lot of time for each site because of some update check that I don't need.

On How to upgrade only core with drush? I learned I can use drush up drupal to only upgrade core. But unfortunately drush is still checking a lot of statuses, which takes a long time for every site:

Checking available update data ...
Checked available update data for Administration menu.
Checked available update data for Admin VBO Views.
Checked available update data for Advanced CSS/JS Aggregation.
Checked available update data for Block.
...

How can I skip this? I just want drush to fetch 7.32, check if the site is still functional and head to the next site.


texts: Is it possible to declare option inside drupal_add_js?

texts:
I'm stuck on including an external JavaScript file on a custom page. The API service requires the HTML to be formatted as below

<script type="text/javascript" src="//platform.example.com/api.js">
api_key:   [key]
</script>

No idea if this can be done the Drupal way. I tried:

// load SDK
drupal_add_js('//platform.example.com/api.js', 'external');
drupal_add_js('api_key:   [key]', 'inline');

But without success. The API_key declaration need to be done inside the first  tag that links to the external JS. I know you can add extra parameters like documented on https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_js/7.x but this case is not described.


texts: How do I remove a validation handler from a form?

texts: I am using the Invite by e-mail module, which has its own hook_form_alter() with a validation handler. I wish to remove its validation handler and use my own validation handler.


texts: Different User Points for different nodes

texts:
I am using the User Points module to assign points to users if they post some content and so on. Works great. Now the admin can set some tasks to the users in the form of nodes. To be clear, a node would describe to perform some tasks and then upload a blog about it. IN that node the admin would assign a field CREDITS which tells how many points a user would get for creating a content related to this node. To relate the nodes i am using References module which works fine. So my question is is there any way to do this, i.e, when admin uploads a new node he can provide the user points in a field which would be the user point assigned to the users when they post a content about this node. I hope i am clear. If any doubt please ask i would only be happy to clarify my doubt.

Any suggestions?


texts:
I am using Drupal 7.
I have installed Boost module and configured properly as per the guidelines from Drupal.org site and other sources.
As per my knowledge to test whether boost is working or not we have to check html source code of any page because Boost module adds Boost tags in the html output generated by drupal.
When i check page source i don't find any boost tags.
I also have one doubt regarding the configuration, in .htaccess generation page there are three options

%{HTTP_HOST}
%{SERVER_NAME}
localhost

which one should i enable when i am configuring on the site like http://xyz.com/mydrupal
where mydrupal contains drupal setup and all the files


texts: Unable to set content access for specific group in each content type in openatrium

texts:
I have installed openatrium 7.x-2.12. I have created a private group and added some users to that group.

I tried to create a content page which should be accessed only to the users who belongs to that private group.

But in content page, under group audience, field "your groups" lists option "None" always. I am unable to set my group.

Same problem occurs for event content type also.

Is there any other way to give content access only to group members? It will be helpful for me if any solution is there to solve this.

Please tell me if anybody knows the solution for this. Thanks in advance


texts: Custom Fivestar widget does not appear on display settings

texts:
I need to create a custom wiget for Fivestars. I create module, and implement hook_fivestar_widgets(). I create css file, images. And it works on Open Server on my PC. When I upload this module on hosting and turn it on I see my widget in admin menu but it does not appear on node display settings.

/**
 * @return array with pair - widget css path, widget name
 * implements hook_fivestar_widgets()
 */
function fivestar_widget_fivestar_widgets() {

  $widgets = [
    'sites/all/modules/fivestar_widget/style.css' => 'squares',
  ];

  return $widgets;
}


texts: Best way to trigger multiple Feeds importers?

texts:
I have three importers set up and working fine; all creating nodes from an XML file using HTTP fetcher.

The created nodes reference each other (using Node Reference), so the importers must run in a certain order.

To automate this, I'm not using the periodic import option as it won't keep things in sync. Instead, I created a simple Rules action:

<?php
function my_import_action_import($importer_name, $feeds_node) {
  while (FEEDS_BATCH_COMPLETE != feeds_source($importer_name, $feeds_node)->import());
}
?>

Then I created a rule that runs on cron with three actions (one to trigger each importer).

As far as I can tell, it seems to work. But I get a warning notice that doesn't happen when I run the importers manually:

  Notice: Undefined offset: 2 in references_feeds_set_target() (line 203
  of
  /home/mysites/drupal7/sites/default/modules/references/references.feeds.inc).

I also have a feeling that Feeds was meant to use job scheduler for a reason, and not run on cron in this way?

Thanks!


texts: Migrate theme settings between multisite installations

texts:
I have set up a second site on a multisite development instance of Drupal 7. We're using a subtheme based on Adaptive Themes. Being that plans call for about a dozen sibling sites, I would like to copy this over theme settings from the first site to each subsequent sibling sites.

What tools would be recommended for this arena?

Someone suggested using Features. However, of the options I don't see a way to package up theme settings.


texts: Theme the login page for Maintenance mode

texts:
I've created my theme as subtheme of ZEN, and I have created my maintenance page template, which works when I enable the maintenance page.

If I try to visit example.com/user, the login page is shown with the standard template, and not with the maintenance-page template.

How do I make Drupal 7 use the maintenance page template also for the login page?


texts: Trying to edit css, php files without ftp access

texts:
I am trying to be able to edit files of my Drupal site without having to go in the 'back way' (such as SFTP, via PuTTY & Vi or Nano, etc).  Specifically to edit the theme and template files (e.g. http.tpl.php)

I read a suggestion for the elfinder File Manager module but ran into trouble when trying to enable the module.

Seems elFinder requires elFinder BUEditor integration and elFinder File Field Source.

But elFinder BUEditor integration and elFinder File Field Source requires elFinder.

So it fails to enable each time!

I'm not even sure that this will allow me to edit the .php files through the browser, or if there is any means to do that.

Thanks!


texts: Views Table - Show Taxonomy Term with Specific Depth

texts:
I currently have a view that show as table with a list of stores and information about the store (address, phone number, etc.).  Each store is a node that also has a field containing a taxonomy term describing the store.  The taxonomy looks something like this:

Stores
-Convenience
--Chain A
---Midwest
---South
--Chain B
---Midwest
---South
-Grocery
--Chain C
---Midwest
---South

I would like to display the hierarchy in columns in the table.  For example, a store in the South from Chain B should look like this:

Entity Type        Store Type         Chain        Region      Address                  Phone Number
 Stores               Convenience     Chain B    South        123 Example Blvd     (123) 456-7890

Currently, I can't figure out how to get any of the parent taxonomy terms to show, I can only get the term "South" to show.

Using Drupal 7, Views 3.  Any help is appreciated!


texts:
In my Drupal site, only administrators create users. And users are created without an email. Users can edit themselves some of their account fields, but the email is not one of them.

But the user module adds a UserMailRequired constraint to the User entity email field. On submit, the user module's validator UserMailRequiredValidator adds a violation if the current user is not an administrator :

class UserMailRequiredValidator extends ConstraintValidator {

  /**
   * {@inheritdoc}
   */
  public function validate($items, Constraint $constraint) {
    /** @var \Drupal\Core\Field\FieldItemListInterface $items */
    /** @var \Drupal\user\UserInterface $account */
    $account = $items->getEntity();
    $existing_value = NULL;
    if ($account->id()) {
      $account_unchanged = \Drupal::entityManager()
        ->getStorage('user')
        ->loadUnchanged($account->id());
      $existing_value = $account_unchanged->getEmail();
    }

    $required = !(!$existing_value && \Drupal::currentUser()->hasPermission('administer users'));

    if ($required && (!isset($items) || $items->isEmpty())) {
      $this->context->addViolation($constraint->message, ['@name' => $account->getFieldDefinition('mail')->getLabel()]);
    }
  }

}

So, none of my user can edit its profile. On submit, they get an error message "Email field is required". Even if the field's #required property is set to false (using hook_form_alter) and the field not displayed (#access = false) in the form render array.

How can I drop this constraint from a custom module ? (using a hook for example)


texts: How to show users Online and with Photos filter on views

texts:
want a view that will have this functionality:

https://www.thaifriendly.com/browse.php

There is a radio box to see users that are:

Online
With Photos

I have played with views but can't find a way to make it work, the current_user field works, but it only displays the user that is logged in at the moment, not ALL logged in users

There is not current_user filed in sort either.

Thanks,
Bruno


texts: What would be the best way of creating a drop down menu - selected go to page

texts:
I would like to create a drop down menu that does two things and I am still new to Drupal and i am trying to figure it out. The two functions are:

automatically grabs the title of the pages i am trying to list.
When an item is selected it will navigate to the corresponding page.

I feel like this has to be doable, but i am just not sure how i would go about it. Would anyone have any ideas on how i would go about doing something like this? any help would be much appreciated! Thanks!


texts: How do I use form_set_error() the right way?

texts:
In my Drupal 7 module, I have a form and its validation handlers. I call my form from a field.tpl.php with print render(drupal_get_form('my_form')); it works as expected.

The problem is in case of wrong input value.

It requires two incorrect submissions before displaying the error message: The first time, there is red border around my wrong input, and the second time, the error message is displayed (with the red border).

So, what's the right way to use form_set_error()?


texts: getting error when doing the composer install

texts:
Drupal version was 8.6.2 and moved to new server.
When doing the core update , getting an error like below.

 Problem 1
- remove drupal/drupal No version set (parsed as 1.0.0)|remove drupal/core 8.6.3
- don't install drupal/core 8.6.2|remove drupal/drupal No version set (parsed as 1.0.0)
- don't install drupal/core 8.6.3|remove drupal/drupal No version set (parsed as 1.0.0)
- don't install drupal/core 8.6.x-dev|remove drupal/drupal No version set (parsed as 1.0.0)
- don't install drupal/core 8.7.x-dev|remove drupal/drupal No version set (parsed as 1.0.0)
- don't install drupal/core 8.6.3|remove drupal/drupal No version set (parsed as 1.0.0)
- Installation request for drupal/drupal No version set (parsed as 1.0.0) -> satisfiable by drupal/drupal[No version set (parsed as 1.0.0)].
- Installation request for drupal/core ^8.6.2 -> satisfiable by drupal/core[8.6.2, 8.6.3, 8.6.x-dev, 8.7.x-dev]

i have tried the composer install by removing composer.lock, vendor and core. Still getting same error.

Updated with my composer.json

{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type": "project",
"license": "GPL-2.0+",
"require": {
    "composer/installers": "^1.0.24",
    "wikimedia/composer-merge-plugin": "^1.4",
    "drupal/core": "^8.6.2",
    "drush/drush": "^9.2",
    "drupal/s3fs": "^3.0",
    "drupal/csv_serialization": "^1.4"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
    "preferred-install": "dist",
    "autoloader-suffix": "Drupal8"
},
"extra": {
    "_readme": [
        "By default Drupal loads the autoloader from ./vendor/autoload.php.",
        "To change the autoloader you can edit ./autoload.php.",
        "This file specifies the packages.drupal.org repository.",
        "You can read more about this composer repository at:",
        "https://www.drupal.org/node/2718229"
    ],
    "merge-plugin": {
        "include": [
            "core/composer.json"
        ],
        "recurse": false,
        "replace": false,
        "merge-extra": false
    },
    "installer-paths": {
        "core": ["type:drupal-core"],
        "modules/contrib/{$name}": ["type:drupal-module"],
        "profiles/contrib/{$name}": ["type:drupal-profile"],
        "themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/contrib/{$name}": ["type:drupal-drush"],
        "modules/custom/{$name}": ["type:drupal-custom-module"],
        "themes/custom/{$name}": ["type:drupal-custom-theme"]
    }
},
"autoload": {
    "psr-4": {
        "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
    }
},
"scripts": {
    "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
    "post-autoload-dump": [
      "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
    ],
    "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
    "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
},
"repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    }
]

}


texts: Change / Set Node Reference field in hook_form_alter

texts: I am trying to set the value for an existing Node Reference drop-down field in a content type via hook_form_alter as part of an AJAX call.  The form needs to set values based on a selection, which is does correctly for dozens of fields, but I can't get or find the array structure to change/set the value for a Node Reference field. I've looked around and tried every permutation I can find, including dozens of guesses at what the array structure should look like without any success. Any help would be appreciated.


texts: Selecting the taxonomy terms to use using a textfield to search them

texts:
My Drupal 7 site has almost thousand of taxonomy terms. So it is a hard work for my users to pick their desired category from thousand of taxonomy terms.

Is there any way to select a taxonomy term by using a small search box to choose the exact category and sub-category?


texts: Should I not update from 8.4.2 straight to 8.6.13?

texts:
Due to someone leaving the company I work for I was handed the "webmaster" duties of a website hosted off-site running on Drupal 8.4.2. When I first logged in to the admin panel I discovered a host of problems, the most important one being the security updates. I first thought it wouldn't be much of a problem, as the hosting company has the handy interface to install and update/upgrade a number of web applications. But it turns out the that person before me installed Drupal manually (I have no idea why) so I'm wary of doing the "one click install" of Drupal 8.6.13. Furthermore, I don't know enough about Drupal to know if it would be a bad idea to update from 8.4.2 directly to 8.6.13. Would it be a better idea to first update to 8.5.14 and then to 8.6.13?

I've read through a lot of the release notes (8.5.0, 8.5.14, 8.6.0, 8.6.13, & a few others in that range) so I'm aware of the need to upgrade to PHP 7.3. I'm also very comfortable with the command line (it's running on Linux) and I've read (and re-read) the Drupal docs for updating via the command line.

I contacted the hosting provider with this same question but their "yeah, it'll be fine" answer to using their "one-click installer" wasn't very reassuring, so I thought I'd pose the question here before I take the plunge. Thanks for any words of advice or warning.


texts: Can a subgroup of a public group be private and hidden?

texts:
I'm building my first Drupal Organic Groups site, and running into problems.
Problem:
My goal is to have top-level Groups that are visible to the public, but only members can participate in them. There will be public subgroups too. Additionally, there must be invisible private groups that only members can see. All non-members, even logged-in site users, should not even see the group exists.
Since OG doesn't support sub-groups in the core and the OG subgroups module is an alpha release,  I tried making my own sub-group solution. (see description below)
A browser session not logged into the site does not show the private subgroup, as needed. However, a logged in user who is not a member of the group can see, not only the group name, but the member list and description (body field). The content is successfully hidden, stating "There is no content in this group."
Does OG support what I am trying to accomplish?
I have read these and other pages:

https://drupal.org/node/2014987
How to make a OG private?

My configuration matches what is shown on those two references.
(See screen captures below)
System and method description:
Fresh install of Drupal 7.26 and OG 7.x-2.5.
I created a new content type called "Subgroup" and assigned it all the OG fields (group_access, og_roles_permissions, group_register, group_content_access, group_theme), and marked both "Group" and "Group Content" in the Organic Groups tab in the Content Type creation form. The Subgroup content type also has an Entity Reference field type named "Parent Group." That is set to Target type "node"; Entity Selection -> Mode = Organic Groups; Target Bundles = Group; no sorting; OG membership type = default.  "OG behavior" is checked under "Additional Behaviors.
To test, I created a Subgroup node titled "Drupal theming (PRIVATE)", with both Group Visibility and Group Content Visibility set to "Private - accessible only to group members". Other OG settings were: "Override default roles and permissions" (since my site OG default is to be public) and "Do not show on registration page." The site is using the default OG Node template panel for Groups.
I verified that the "non-member" role of the private subgroup has no permissions boxes checked in Subgroup > Group tab > Permissions panel.
In case it may be a clue, whenever I try to save an update to a Subgroup content type node, the system displays this error:

Notice: Undefined index: field_mode in OgBehaviorHandler->validate()
(line 254 of
/my/domain/path/sites/all/modules/og/plugins/entityreference/behavior/OgBehaviorHandler.class.php).


texts: How to trigger Views exposed filter AJAX autosubmit?

texts:
Drupal 7: I have a set of exposed filters on a View which are set to autosubmit and the View is set to use AJAX to update.

I want to trigger the autosubmit from Javascript code. Suggestions appreciated.


texts: View all nodes of a content type using a filter

texts:
I have a content type called "Building", which contains a field called "Size". I also have an exposed filter that filters through the size chosen by the user, so the view only displays that size.

What I would like is that the view sorts and displays all the nodes in order of relevancy, i.e. if I choose 5-10 meters, the 5-10 meter buildings show up first, and then the rest of the buildings are also shown.

Thanks, and please feel free to comment critically on this post so I can improve on my questions for the future.


texts: User Import: Possible to use other variables in the user notification email?

texts:
We are using the User Import module to populate the User list, and having it send out a notification email with a temporary login URL. In the notification email section of User Import configuration, it is stated:

Customize the body of the welcome e-mail, which is sent to imported members. Available variables are: !username, !site, !password, !uri, !uri_brief, !mailto, !login_uri, !edit_uri, !login_url.

In this site we have some custom fields added to User which are being populated via User Import of .csv files. We would like to include a variable in the message body that picks up a numerical value from those fields. There is a set of fields of the name pattern "field_schools_owned_zone_1" which goes from 1 to 6; then in a View we have a math field that sums up those 6 field values for each user. It is that sum that we want to use.

Can this email form accept variables other than those listed? If so, how can we determine the replacement string for that math field value so it can work in the email message?

--Thanks--


texts:
I'm trying to display the taxonomy term (filter (Better Exposed Filters) on Views) as an image. I added an image field, upload an image (marker). Create template views-view-field--maps--field-type.tpl.php. I found example how to make theming of taxonomy-term here: http://www.milesjcarter.co.uk/blog/web-design-development/drupal-views-templating-tutorial-outputting-respective-image-fields-multiple-taxonomy-term-references

My code looks like:

if(isset($row->field_field_type)) {
    $term = $row->field_field_type;
    foreach($term as $type){
        render(field_view_field('taxonomy_term', $type['raw']['taxonomy_term'], 'field_marker', array('label'=>'hidden', 'settings' => array('image_style' => 'thumbnail'))));
    }
}

For some reason, the code does not replace taxonomy term, it just show me messages:

  Notice: Only variables should be passed by reference in include()
  (line 8

What could be the reason? I would be grateful for any advice.

I try dpm:

dpm(render(field_view_field('taxonomy_term', $type['raw']['taxonomy_term'], 'field_marker', array('label'=>'hidden', 'settings' => array('image_style' => 'thumbnail')))));

And it show me this:

I know that there is a module Taxonomy Image I tried to install it, but after activation necessary functionality was not added to my site.


texts: Manually trigger AJAX from custom JavaScript

texts:
I'm in the process of developing a form where the user enters a UK postcode and the textfield is replaced by a select list. This all works quite nicely when using the blur event, but it is not always obvious the field has changed.

I would like to use the keyup event instead, but there is a small delay each time the key is pressed as the AJAX keeps firing, I have an existing function which is bound to the field:

$('#edit-postcode').bind('input', function(){
  $(this).val(function(_, v){
    return v.replace(/\s+/g, '').toUpperCase();
  });
});

I already have a simple regex /(^[A-Z]{1,2}[0-9]{1,2})\s?([0-9][A-Z]{2}$)/i to ensure it's broadly the correct format. I would like to add the validation into the previous function and if the string passes validation trigger the existing AJAX functionality.

N.B. the default Drupal autocomplete functionality works almost perfectly apart from not being able to hide the ID which relates to the postcode which is why I've resorted to this method instead.


texts: Substitute "Your Name" field for anonymous shown on posted comments

texts:
I am using the 'Corporate Clean' theme.  I have allowed anonymous posting of comments for basic pages. When a person posts, there is a an input field called 'Your Name'.  However when the comment is posted, Anonymous is showed instead.  I would like to know how to substitute the Anonymous for the 'Your Name' field or if not, have the 'Your Name' show in the title line of comment.

thanks in advance.

Update : ok I have loaded a test site with bare minimum modules and tested comments again.  It works this time - no issues.  I can only assume one of the modules I have installed is causing this as I have not edited any files by hand.  What is the best way to troubleshoot this?


texts: Drupal 8.3 Beta 1 Rest endpoint user/login

texts: I just updated my drupal 8.3 to beta 1. Unfortunately the new rest endpoints (at least user/login) are not working anymore. Any Ideas out there?


texts:
I've inherited a Drupal site that is experiencing slow load times and I'm trying to troubleshoot the problem. The site is run on a dedicated box with what should be enough resources.

I ran the Devel module to see the MySQL queries and it's telling me that the following query is being run four times taking a total of 2-3 seconds.

execute SELECT DISTINCT node.nid AS nid, node.title AS node_title,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format, node.sticky AS node_sticky,
node.type AS node_type FROM node node LEFT JOIN node_revisions node_revisions
ON node.vid = node_revisions.vid WHERE node.status = 1 ORDER BY node_sticky DESC

There are almost 400 other queries that are taking over 10 ms, but this one above is by far the longest and that it is being run multiple times, I suspect is causing some of the load problems.

Any suggestions on what is going on here or where to look for more information? All modules and core files are up to date.


texts:
There are many posts and articles that make vague references to upgrading Symfony 3 to Symfony 4 in Drupal 8. But nothing specific.

For example this one by Ryan Weaver "Symfony 4 and Drupal"

I've installed a fresh copy of Drupal 8.8.1 and updated with

 composer update drupal/core --with-dependencies

Then, I ran

composer outdated "symfony/*"

Clearly, there are symfony components that are outdated.

Is it possible to update these "outdated" components? Or, are we stuck till Drupal 9?


texts: Ckeditor Wordcount plugin - How to target specific textareas

texts:
I'm using the CKEditor - WYSIWYG HTML editor Drupal 7 module and wordcount plugin. I've added the wordcount plugin file in the ckeditor plugins directory and got it working, however my config max word and character count etc is the same for all fields. I would like to specify different max word and character counts for specific fields. Here is my config:

ckeditor.config.js

Using CKEDITOR.replace I did the following:

  CKEDITOR.replace('edit-body-und-0-summary',
      {
          extraPlugins: 'wordcount',
          wordcount: {
              showCharCount: true,
              maxCharCount: 123
          }
      });

This worked, but after refreshing the page it went back to the global max word and character count. The Textrea ID is edit-body-und-0-summary but this tag is repeated elsewhere in the page.

How do I go about adding a unique ID to the textarea tag and having different word counts for different fields e.g.
Summary and Body fields


texts:
I have a website for my business, however, there is an issue.

All the system emails have not been delivered. I have tried with password reset, it shows entry in dblog. Also the server is fine, if I add a custom php file with email sending code, it works absolutely fine.

But with Drupal, its not working.

How can I fix this?