texts: How do I manage core and module updates along with config management between environments?

texts:
I've set up a dev site, a test site, and a public site. Dev and Test are in two separate virtual machines (VLAD) and Public is on a shared Dreamhost account. I've successfully used the Configuration management tool to get all three of these environments in sync by installing it once, then copying the files (git) from one to the other environments, and exporting/importing the database information. Now it is time for me to update something like Drupal core from 8.0.3 to 8.0.4 and I am unsure exactly how that should happen with relation to getting that update on the other two environments. So, the main question is: how should I migrate/deploy/manage the upgrade between environments taking into consideration the need for UUID and CMI to stay intact?

Should I update one environment, lets say dev, using whatever chosen tool I have handy (like drush up --security-only or download the new version, and hit update.php in the browser, etc.) then copy those files from dev to test and re-export/import the database info? Or, should I update each of them individually? I suppose the thing I'm most worried about is will that break configuration management? Maybe I don't need to export/import database files and instead just export/import config changes after updating drupal or some contrib module into the dev site.

I've read what feels like 50 different posts about CMI and how to use it and how Drupal 8 makes some of this so much better and I totally agree about the information that actually gets managed by that tool but I can't seem to find information about how to deal with upgrading core and modules between these different environments. If I'm just not reading the right doc or blog post correctly and you can point me to one that is great. If you can answer directly here that is great too. And, maybe I'm just not "getting it" so please feel free to set me straight.

My question may be similar to the one posed here but it isn't exactly worded the same, so, again, I may just be missing the easy answer here.


texts: How do I see the names of all view fields in the formatter option form?

texts:
I am extending the StylePluginBase to make a custom views formatter. I would like to add a select box in the option menu with a list of all the fields currently listed within the view. How do I pull the list of fields into the buildOptionsForm function? Does the FormStateInterface have the view buried in it somewhere that I need to do something like:

$options = [];
$view = $form_state->view;
foreach($view->fields as $field){
  $options[] = $field->name;
}


texts: How to change (via code) the Name and Description for a content type created by a contrib module

texts:
I'm wondering how  we can change, via code, the Name and Description for a content type that is provided by a contrib module (in this case, the "User Alert" content type provided by the user_alert module).

I know I can change this manually by going to Admin > Structure > Content types and editing the Name and Description there, but I'd prefer to do this programmatically in code so that I can automatically deploy it to staging and production sites.

In the user_alert module, the original Name/Description details are:

function user_alert_node_info() {
  return array(
    'user_alert' => array(
      'name' => t('User Alert'),
      'base' => 'user_alert',
      'description' => t('A User Alert is a short Twitter like message displayed at the top of the site, alerting users to critical information like an online sale, new blog post, or breaking news. After viewing it, they can click and close the message.'),
      'has_title' => TRUE,
      'title_label' => t('Title'),
      'disabled' => FALSE,
    )
  );
}

I would've guessed that there would be a hook_node_info_alter to change this, but it seems such a thing does not exist. Is the answer to use hook_entity_info_alter? If so, what is the correct code to use?

I have tried putting this in my custom feature slnsw_newsflash.module file:

    function slnsw_newsflash_entity_info_alter(&$entity_info) {
      $entity_info['user_alert'] = array(
          'name' => t('Newsflash'),
          'base' => 'user_alert',
          'description' => t('A Newsflash item appears near the top of the page to alert users to urgent notices such as catalogue outages or changed opening hours etc. Utilises the user_alert module.'),
          'has_title' => TRUE,
          'title_label' => t('Admin Title'),
          'disabled' => FALSE,
      );
    }

But it seems to have no effect (after disabling and enabling the slnsw_newsflash features module and running drush cc all/drush rr), so obviously I'm doing something wrong.

I also thought that Features or Strongarm would let you store and save the Name and Description values for a content type provided by a contrib module, but that does not seem to be the case.


texts: How can I execute Drush commands programmatically?

texts:
I'm working on a Drupal 8 site, and part of the requirement is giving the client a page where they can click a button to do a particular task. I am able to do this using a Drush command from the command line, but I want to do it from a module.

I had seen code using either php_exec() or drush_invoke_process(). How can I use this function?


texts: how to develop multiple pages registration form

texts:
I want to develop a registration form employees based on different steps like company,salary,interview,pors and crons etc. they are pages for the registration process.
Can anyone tell me how to develop this kind of functionality?


texts: Redirect SimpleTest queries to a different database

texts:
How can I tell SimpleTest to use a different database than the default connection? I want to be able to run the tests against an in memory database while keeping the local data on disk.

UPDATE:

So far the answers I'm getting are on how to set up tmpfs and move mysql data to that folder. That's great and super helpful. However this is missing the specific answer that I am looking for. I'm most interested in how to run SimpleTest against a different connection than the default database connection. You can see above that my question reflected by both the title and the first line of my original submission. I apologize for the confusion caused by my mention of an in memory database, I provided that only as context, but it is not the root of my question.


texts: Is uploading/download executable files harmful in drupal?

texts: In my site design, I have a field that is designed to hold an executable file (.exe, .bat, etc), for users to upload and download. I took pause as I was typing these extensions into the Allowed file extensions setting on the file field. Is this ok? What do I need to be aware of?


texts: Keep custom theme when using AJAX submit

texts:
I am using the following code to switch to a custom theme based on the URL

function job_agent_custom_theme() {
  if (arg(0) == 'vista') {
    return 'vista';
  }
}

This works great and will switch to my "vista" theme when "vista" is in the URL. The problem is that one of my pages has a form that is submitted via AJAX. I created the form using the standard Drupal form API and creating my submit button like so

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

So the problem is that when I submit the AJAX form, the page switches to this weird hybrid of the default theme and my custom theme. It's like they are both loaded. Am I missing something? How do I preserve the custom theme when submitting an AJAX form. It also seems really weird to me that the entire page would refresh and switch to a different theme anyway. I would think that defeats the whole purpose of AJAX. I can understand the contents of my ajax_wrapper changing, but not the entire page. Anyway, does anyone know of a way to preserve my theme when submitting via AJAX?

EDIT: Oh and I forgot a big piece to this puzzle. This ONLY happens with anonymous users. If I am logged in, it works as expected and when submitting the form, the custom theme is preserved, but if I am NOT logged in I get the mish mash theme.

THANKS


texts: Where can I put helper functions for my theme?

texts:
I wrote few helper functions and now I want to add these functions somewhere, so that I can call them from any template files.

Where should I put them?


texts: Using a contextual filter as a search term

texts:
I'm attempting to allow users to search for titles of a specific content type in a view. I'd like to be able to pass a search term into a contextual filter but I can't seem to get that to work.

Right now I have a view filter for 'title' that is set to contains 'any word'. I also have a contextual filter that looks for title, but passing any word to it results in the view displaying nothing. I also noticed that there was a 'search term' filter but every time I used that no results were shown.

EDIT: If I'm unable to pass it via a contextual filter, would I be able to have the view filter grab the parameter from the URL via REST?


texts: How to format Computed Field as WKT (geofield CCK) with display code

texts:
I'm pretty green here. This is my first question!

I am using computed field to calculate a WKT (Well known text) geofield using the geocoder API. This calculation is being done correctly, giving a result such as "POINT (28.12866 46.17625)".

When I want to display this computed field the only have the following options:

Unsanitized
Plaintext
Raw value, no display code
Filtered Markup
-Hidden-

I currently have the following display code, which I think it the problem:

$display_output = $entity_field_item['value'];

I don't know how to make the normal geofield formatters available to display this field, so for example I can render it as a map.


texts: Combining Page Manager Search with Drupal core search

texts:
I'm in need of a search solution for panels, and Page Manager Search seems to be the only one out there that doesn't involve Apache Solr. The problem I'm having with integrating it into my site is that it's results for panels content is set up to be separate from Drupal core search. What I really need is something that combines the two. Anyone have any luck getting Page Manager Search results to flow seamlessly into standard Drupal core search results?

I'm also curious why this module shows so little active usage (178 sites at the time of this post), when the problem of indexing panels content hasn't been otherwise solved outside of Solr. Is it just that everyone is using Solr?


texts: How to print anything in a twig template file

texts:
In drupal 7 we were able to resort to simple php functions in tpl.php files to load anything we wanted. Entities, blocks, view etc. This was really powerful for making really customisable blocks. In D7 we can use this php:

$block = block_load('views', 'block_name');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block   ))));

When it comes to D8 I have read things about the getParameter but i'm coming up short on how to do it in a twig tpl.

For example, in a custom field in D8 I can get the node by using:

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

But how do I do this for a view on a page? And how would I do this in a twig.tpl in which you cannot write php?

I'm interested to see how people are tackling this in D8 or if I have the complete wrong method here.


texts: INPUT query for cache_menu returns mysql #2006 error in MAMP

texts:
This actually happens when I want to import a db from a live site to a local site in MAMP.

Running mac osx 10.6.8 and MAMP 2.0.5.

I googled this mysql error and most people seem to have this solved by increasing the memory_limit value in /Applications/MAMP/bin/php5.3.6/conf/php.ini. I set it to 512M. And yes I made sure MAMP is running php 5.3.6.

...anyway increasing the memory size didn't solve the issue obviously

then I went looking at the error logs under Applications/MAMP/logs/php_error.log and Applications/MAMP/logs/mysql_error_log.err but both don't have any recent log information at all actually which is quite bizarre as well.

What I can also tell you is that the last VALUE which the query wants to INSERT INTO 'cache_menu' is very very large.

Here's the query that gives the #2006 error:

INSERT INTO `cache_menu` (`cid`, `data`, `expire`, `created`, `headers`, `serialized`) VALUES ('links:admin_menu:tree-data:9942fb041052f49f910af3e0190b9115', 0x613a323a7b733a343a2274726565223b613a31303a7b693a333635313b613a323a7b733a343a226c696e6b223b613a33373a7b733a31343a226c6f61645f66756e6374696f6e73223b4e3b733a31363a22746f5f6172675f66756e6374696f6e73223b4e3b733a31353a226163636573735f63616c6c6261636b223b4e3b733a31363a226163636573735f617267756d656e7473223b4e3b733a31333a22706167655f63616c6c6261636b223b4e3b733a31343a22706167655f617267756d656e7473223b4e3b733a353a227469746c65223b4e3b733a31343a227469746c655f63616c6c6261636b223b4e3b733a31353a227469746c655f617267756d656e7473223b4e3b733a343a2274797065223b4e3b733a31313a226465736372697074696f6e223b4e3b733a393a226d656e755f6e616d65223b733a31303a2261646d696e5f6d656e75223b733a343a226d6c6964223b733a343a2233363531223b733a343a22706c6964223b733a313a2230223b733a393a226c696e6b5f70617468223b733a373a223c66726f6e743e223b733a31313a22726f757465725f70617468223[...]


texts: How do I override field_multiple_value_form()?

texts:
I have to override the standard field wrappers which add additional divs.

Drupal uses the following code, in field_multiple_value_form().

$field_elements += array(
  '#theme' => 'field_multiple_value_form',
  '#field_name' => $field['field_name'],
  '#cardinality' => $field['cardinality'],
  '#title' => $title,
  '#required' => $instance['required'],
  '#description' => $description,
  '#prefix' => '
',
  '#suffix' => '
',
  '#max_delta' => $max,
);

I implemented hook_form_alter(), but this form needs extra data that are passed as argument: $field, $instance, $langcode, $items, $form, and $form_state.

How do I define hook_form_alter() in this case?


texts: How can I use the grouped nid in a views template with two content types?

texts:
In Drupal 8.9x, I have a view with two content types in it: Each business (and its details are grouped), and underneath each business I'm displaying multiple offers by that business...and then I want to display more business details underneath that.
For example:
Business #1 "title"
 -- offer A for business #1 (row)
 -- offer B for business #1 (row)
Business #1 Details (ideally inserted via the twig template)

Business #2 "title"
-- offer C for business #2 (row)
-- offer D for business #2 (row)
Business #2 Details (ideally inserted via the twig template)

I've got my view set up so that ALMOST all of the business details are grouped into a custom field. This outputs as "title" in the views-view-unformatted.html.twig template file, and all the offers are the "rows" that are placed inside the default twig for loop. The problem is, I need to place more business details after the for loop, and I don't know how to reliably insert that data via the template.
For example, if I try to access the Business's nid:
{% set bizNid = rows[0].content['#row'].node_field_data_node__field_business_location_nid %}

This grabs the very first row in the array, which doesn't necessarily correspond with the first business in the list. I spend a few hours looking through the twig var dump to see if I could find a reliable way of extracting the nid, but I just can't figure it out. My question is, how can I access the grouped/relationship data/fields/content inside a twig template file so I can sandwich the businesses offers between two sets of business data from the same business?
Here's a gist of my views-view-unformatted.html.twig file for more insight on what I'm trying to do.
And here's a screenshot of ultimately what the output should look like:

And here's a screenshot off my Views config page for "offers":

Thanks in advance for your help.


texts: Setting up a Drupal environment on Ubuntu

texts:
After a few years of setting basic Drupal environments on Windows only, with WAMP (both the installment and the WAMP program) and Drush 7.0.0, I came to the conclusion I also need to work with LAMP and especially Ubuntu-based as it would give me access to more development tools, and more easily, for example in relation to tar, tar.gz, curl (non-core UNIX command), Composer, Drush master (which as of 2015 is not recommended for Windows usage) Xdebug, and more.

I have installed Ubuntu on a virtual machine, but what do I do now? Of course there is no WAMP (Windows, AMP) on Linux, and my options seem to be manual installation of the server \ Linux-XAMPP... But besides that, my question is what are the main differences between a Windows Drupal environment to a Linux one, in these points:

Is there something else needed for a Drupal (8) environment besides the things I mentioned?
In Windows, my WAMP folder was in c:\WAMP\ --- What is the drupal folder hierarchy in Linux?

Please answer on these points and detail as much as you can on the process, for newcomers like me could have a nicer acquaintance.


texts: How to positioning a field before another specific field with hook_form_alter()

texts:
I'm modifying a form by adding another text input, and I need to add this input right before a field. How do i do it? this is my code and it's working correctly:

function provintegra_form_alter(&$form, &$form_state, $form_id) {

    $form['input_latitude'] = array(
      '#type' => 'textfield',
      '#title' => t('Search address'),
      '#default_value' => '',
      '#prefix' => '
Mappa qui
',
    );

}

I just need to position this before $form['field_latitude'].


texts: Replacing 12:00 am/pm with midnight/noon

texts:
I need to accomplish the following: display 'MN' or 'NN' if the time is 00:00 or 12:00 respectively in places such as the created time on nodes and in Views dropdowns provide the option for MN/NN/AM/PM instead of just AM/PM. I'm ok with just theming this wherever possible but I do need a site wide solution. Since the code will be used on sites residing in multiple Drupal versions, it needs to be as version generic as is reasonable (maybe one for D6 and another for D7/D8)

I've had the thought that one broad solution was to create a module that replaces the format_date function in common.inc with one that replaces the am/pm string where needed in the output. Something like this not-ready-for-primetime code changed from format_date in common.inc (D6) to a new function, say "function reformatted_date" and identical to format_date except this:

 if (strpos('AaDlM', $c) !== FALSE) {
  $date .= t(gmdate($c, $timestamp), array(), $langcode);
    $v = $c;
        if (strpos('Aa', $v) !== FALSE) {
        if(($v = ('A'||'a') && $date('h')==12 && $date('m')==00) {
            $c = str_ireplace('AM',' NN',$c);
            } elseif ($v = ('A'||'a') && date('h')==00 && date('m')==00 {
            $c = str_ireplace('PM',' MN',$c);
            } else {
            $c = $v;
            }
        }
  } etc.

While I am pretty sure the above code won't work as it is for a variety of reasons, logic like that would this let me call this function in a template or wherever I need it instead of format_date. It is what the end user sees here that matters to me not what is stored at the database level which can and should continue to be consistent with what PHP and Drupal do. I also want to avoid hacking modules/core.

If someone can help me get the code right or provide a better, alternate solution it would be appreciated.


texts: Redirect a user after the node has been saved

texts: I'm looking for a hook to use after a node of a specific content type is created or saved, to perform a redirection to a specific page.


texts: Javascript to set webform Field Value based on earlier field

texts:
I've got a webform setup on Drupal 7, with mmulti-pages and using the same page conditional add-on (actually its now part of the webform 4 core, and it works fine)

At the start the webform asks for a firstname, surname. I want the javascript to take the entered values (using .change()) and prepopulate the billing firstname and surname on page 5 of the same webform.

This is the JS function:

(function ($) {
$(document).ready(function(){
    $('#edit-submitted-name-layout-firstname, #edit-submitted-name-layout-surname').change(function(){
        var fName = $('#edit-submitted-name-layout-firstname').val();
            sName = $('#edit-submitted-name-layout-surname').val();

                    alert("This is the firstname" + fName + "and Surname " + sName);
        $('#edit-submitted-bill-name-layout-billing-firstname').val(fName);
        $('#edit-submitted-bill-name-layout-billing-surname').val(sName);
        });
});
})(jQuery);

I've setup the webform-form-NID.tpl.php file, and to test it I popped in an alert as seen above - it works fine and prints out the entered firstname and surname values.

However, when I get to page 5 on the webform, the billing firstname and surname fields are blank?
Could it have something to do with the multi-page element of the form?

Paddy


texts: How do import and save term lineage using feeds and Hierarchical select?

texts:
I have to import a number of nodes that only has the lowest term in the csv

e.g. Washington

However, in the taxonomy hierarchy it has United States > Washington

I am using the Hierarchical select module for saving the term lineage however when I use feeds it tries to import the child term as the parent term and doesn't actually select anything.

How do I use feeds and Hierarchical select to import just the child term but save the entire lineage?

The closest I can come to is https://www.drupal.org/node/1319278 however the csv mush contain the lineage, whereas in this case we only have the lowest possible child term.


texts: Programmatically search nodes according to the value of fields in their bundle

texts:
I am working on a script to search groups within the site according to criterias, such as group city, group languages and so on.

So far i am trying to do this by manually querying the database though it s seems to be an unnecessary hassle since the fields i am searching all live in different table like field_data_field_city, field_data_field_language and it can get very tedious task.

So i am wondering if i could to that programmaticaly using views so that it returns me all the NID according to the filters i mentioned above. i'd rather not use views UI as later this data is populated to the page via a Jquery templating system witch is already in place so the best would be to just get all the NID that match my selection.

If anyone had any incite / experience on how i should go to achieve this result would be much appreciated .


texts:
I am using the taxonomy module (D7) to list Continents, Countries, and Cities. Continents is the 1st level, Countries is the second level, Cities is the third. Or, in other words, Countries and Cities are children to Continents.

That's quite a number of terms.

All has been going well for a while but it seems I have reached some kind of a limit. Indeed, I can save new terms on the root level but when I move them to be children (at the 3rd level) the update no longer saves. There is no error message and no confirmation that the new configuration was saved. Indeed, the new terms are back to the root level after that.

I have added "max_input_vars = 1500" to my php.ini file but it didn't help.

The server generates no error.

Any idea or suggestion on how to fix this?

Thanks. :)

Update: If I move a term from the root directory to become the child of another term, the (new) automatic URL is not written in the database. I have to delete some existing terms to be able to save new terms (by the same number.) This tells me there is an imposed limit somewhere.


texts:
I'm creating a website and I would to add a slideshow that works also with touchscreen on smartphones and tablets.
Could you suggest me some modules that do it?


texts: restrict shipping of particluar item for paticular shipping zone

texts:
Is there a module available to restrict the shipping of the particular product for particular shipping zone(country)?
so that the message would appear and cancel the checkout.


texts:
i want to add a translatable text into panels.So I enabled the php filter and add this snippet :
Unfortunately it doesn't appear.What am I doing wrong?
thanks


texts: Taxonomy terms manipulation on node.tpl.php

texts:
I wanted to print taxonomy terms on my custom node-mytype.tpl.php but what I want is not to print all the terms as they are.

Each of these terms consists of 2-3 words. And I want to manipulate the terms as below:

term1: word1 word2 word3

I want to print this as:

  word3, word1 word2

If a node has one term it's easy and I can do this as below (of course there can be some other better way to do this):

inside node-mytype.tpl.php:

<?php if (!empty($node->field_my_taxonomy_term)) { ?>

    <?php $aut = ($node->field_my_taxonomy_term['und']['0']['taxonomy_term']->name); ?>
    <?php $exp = explode(" ", $aut); ?>

    <?php if (count($exp) == 2) {?>
    <?php print ($exp[1]); print t(", "); print ($exp[0]); print t(", "); ?>

    <?php } elseif (count($exp) == 3) {?>
    <?php print ($exp[2]); print t(", "); print ($exp[0]); print t(" "); print ($exp[1]); print t(", "); ?>
    <?php }?>

I want to print multiple terms as above. For example:

term1: word1 word2 word3

term2: word4 word5 word6

should be printed as that:

  word3, word1 word2 - word6, word4 word5

I have this:

   <?php $str = ''; ?>
        <?php if (isset($node->field_my_taxonomy_term[LANGUAGE_NONE]) && $node->field_my_taxonomy_term[LANGUAGE_NONE]): ?>

        <?php foreach ($node->field_my_taxonomy_term[LANGUAGE_NONE] as $obj): ?>
        <?php $str .= l($obj['taxonomy_term']->name, 'taxonomy/term/' . $obj['tid']) . '&nbsp;-&nbsp;'; ?>
        <?php endforeach ?>

        <?php print trim($str, '-&nbsp;'); ?>
   <?php endif ?>

The below code prints the terms as that:

  word1 word2 word3 - word4 word5 word6

What code should I use here to print the terms as I wanted?

  word3, word1 word2 - word6, word4 word5

(Drupal 7.34)


texts: How to display devel dpm messages on a panels generated page?

texts: I am testing a custom module for a site using Panels Everywhere & Panels. I need to put the results of a Devel module dpm() message into a pane so that I can see it on page displays. Does anyone know what content type it might be? I assumed it would be System Help, but no luck.


texts:
I have a page "/node/add" that I would like to programmatically limit the links that are displayed based on the users role.  Is using either hook_form_alter or hook_form_ID_alter the way to do this?
I just figured out that "/node/add" is not a form so I can't use hook_form_alter or hook_form_ID_alter but in doing a little research it appears that I may be able to user hook_page_alter() instead to filter out some of the links.


texts: How to add custom operation to commerce/orders list?

texts: In Drupal 7 I want to add couple of custom operations in the Drupal Commerce's orders list (see picture below) after "delete" e.g. "Shipping List" and "Invoice" which would open external URLs in a new window. How can I achieve this? I tried to modify some files under sites\all\modules\commerce\modules\order\includes\views but I didn't see any change in the view. Why?


texts: Print Title, Header and in Different divs

texts:
I have created a view and called content types events from FILTER CRITERIA
, created template page--events.html.twig to override design.
Problem is here I have called {{ page.content }} which prints header, content and other footer parts eg: bread crumb so I want to call them in different div like header in other div


texts: How to create the history of particular field of content

texts:
I have a content type called Fruitera, which has a select list field_fruits, which has these possible options:

Apple
Banana
Orange
Pineapple

For this I have created a view, and now I want to see the history of particular field_fruits.

Whenever we edit the content it will replaced by another fruit, I want to see previous history of field_fruits for content created in a view.

Any suggestions know how to do this?


texts: how to add the "add content" to menu drupal

texts: I want to add my "Add Content" --> Products " into my menu bar for a menu link. How can I achieve this? Thanks. I want to add this for ease of access.


texts: I have a view that accepts a contexual filter.When I pass a value through contextual filter like view/sometext ,it is passed directly without encoding.I need to encode it in the url and decode it before processing it in the view.How can I achieve this?


texts: Failed to load popup dialog with in views

texts:
I am using Drupal 8.6.1 with the 8.x-1.0-alpha2 Footable module and the core dialog.

What I did so far:

Install the Footable module.
Download the most recent 3.x.x version of the FooTable jQuery plugin from https://github.com/fooplugins/FooTable/tags and move the contents of the compiled directory into the libraries/footable directory.
I have created a simple "footable" views showing all articles with below fields:

Title (Title)
Body (Body)
Image (Image)
Tags (Tags)

Configured the footable settings to hide the below element on any device:

Body (Body)
Image (Image)
Tags (Tags)

So far, the footable view is working just as expected without no error at all.

Here is an image:

Now, I want when I click on the title field, a dialog popup will open displaying me the contents of the /node/{{ node:nid }} in that popup so:

Under the advanced Section, Set the Use Ajax to: Yes
Add the Content: ID to the footable view but excluded form the display.
Edit the title field:

Uncheck the "Link to the Content" box.
Check the "Override the output of this field with custom text" box.
Add this line of code: {{ title }}

Now, If I visit the Footbale view page, the footable is working prefectly but when I click on any title, the
entire page will refresh and redirect me to /node/{{ nid }} path with no any dialog poping up.

Am I missing something here in my configuration ?!

NOTE:

If I change the view display from Footable to any other display like for example the built-in Table, the dialog will popup without any issues at all.

Thank you,


texts: Change Add comment form but not Edit comment form, and vice-versa

texts:
I have a comment type named "reviews" (it happens to be a field in a node that's displayed alongside webform submissions).

I'm trying to differentiate between the add comment form and the edit comment form so I could, for example, alter the submit button text (value) on one but not the other.

I'm currently using HOOK_form_comment_form_alter(&$form, &$form_state)

In both cases (add and edit):

$form['form_id']['#id'] = edit-comment-reviews-form
$form['#id'] = comment-form
$form_state->getFormObject()->getOperation() = default

Is there anything in $form I'm missing?

Solution:

$entity = $form_state->getFormObject()->getEntity();
if ($entity->isNew()) {
   ...


texts: Organic Groups - How to view articles in the context of the group

texts:
I have OG setup on a site I am developing. The configuration is set to remove the main sites side bars when a Group is viewed. If an article that is only published in that group is viewed, it is opened in the context of the main Drupal site (All side bars are visible from the main site)

Is there a way to view the article so that it appears the user feels they are still in the group?


texts: How to access the node title within a field template?

texts:
I'd like to know the node title within the file link template. How can I get it?

For the current example I use the bootstrap file-link.html.twig template. In it, I have the following variables:

{#
/**
 * @file
 * Theme override for a link to a file.
 *
 * Available variables:
 * - attributes: The HTML attributes for the containing element.
 * - link: A link to the file.
 * - icon: An icon.
 * - icon_only: Flag to display only the icon and not the label.
 * - icon_position: Where an icon should be displayed.
 *
 * @see \Drupal\bootstrap\Plugin\Preprocess\FileLink::preprocessVariables
 */
#}

I dont know if a preprocess function is the correct way to go. I didnt even found a respective hook for drupal 8 for that. I dont even know if this is a field template. But still, the question would also be interesting for other templates than file-link.


texts: How to require a JS library in a composer.json file

texts:
I'm trying to require a 3rd-party JS library in my module. Unfortunately, the library is not available as a composer package.

I tried to define the library in my module's composer.json file like the following:

{
  ...
  "require": {
    "VENDORNAME/PACKAGENAME": "1.2.3"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    },
    {
      "type": "package",
      "package": {
        "name": "VENDORNAME/PACKAGENAME",
        "version": "1.2.3",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/VENDORNAME/PACKAGENAME/archive/1.2.3.zip",
          "type": "zip"
        }
      }
    }
  ]
}

But, composer did a bit of complaining about that, and didn't even install the module:

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

  Problem 1
    - Installation request for drupal/MYMODULE 1.x-dev -> satisfiable by drupal/MYMODULE[1.x-dev].
    - drupal/MYMODULE 1.x-dev requires VENDORNAME/PACKAGENAME 1.2.3 -> no matching package found.

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

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

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

I should mention that I base this on Webprofiler module (Devel's sub-module). Though, in its README, it instructs defining those packages in the main composer.json file.

I want to define the JS library as a module requirement in module's composer.json file.

How can I require a code from a Git repository as if it is a composer package, and use it in my module's composer.json file?


texts: Add class on row by modifying view.tpl.php file

texts:
I am trying to add some classes on the specific row in one of my view table. I have tried to use MYTHEME_preprocess_views_view_table, but failed. Nothing changed on my page.(Here is my previous question link:How to add css class to specific rows base on fields in order commerce view page, if you have any idea about this, I am interested in hearing from you). So I decided to create a new view.tpl.php file to display them. However, nothing showed on my page again.

Here is a screenshot includes: 1.my view theme detector 2.my code 3.result on Chrome

I can find my file being used by my view, however, I don't see any changes on my page. Does anyone know what mistake I have made? Or any idea about how to add class on specific row.

Update:

I have already cleared the cache several times.

Finally:
Normally, Chris Happy's answer should work. But there might be some problem with my website, so we figured it out my problem by using JQuery. Thank you for @Chris Happy's help.


texts:
I have x nodes with field named "thefield". My script is checking "thefield" and if he does so the right value is updated.

How can i get from node just one field for check and didnt load full entity (node_load)?


texts:
I have a cron job that gets stuck because I have a loop claiming items from the queue that ends on numberOfItems() == 0, which never happens because one of the queue items is stuck and cannot be claimed.

Clearly this is a flaw on my side, but I am trying to understand how to best address it. The claimItem() method returns FALSE every time in this case, so it should be easy to handle cases of bad queue processing, for example:

while ($item = $queue->claimItem()) {
    // process item
}

However, what if the first queue item is "faulty", while there are other queue items that are perfectly fine? I will never be able to retrieve them in this method. It also seems impossible to move on to the next item in the queue if claimItem() returns false (please correct me if I am wrong).

What is the correct way to handle such cases with Drupal's queue?


texts: Why Drupal does not see permission from custom module?

texts:
I tried disable and reinstall module, but with no luck, clearing cache does not work too. Module name is bip_menu_perm:

/**
 * Implements hook_perm()
 */
function bip_menu_perm_perm() {
    drupal_set_message('test');
    return array(
        'administer menu permissions' => array(
            'title' => t('Administer menu publishing permissions per user'),
            'description' => t('Users with this roles can edit menu publishing permissions'),
        ),
    );
}

What I am doing wrong here? This function does not invoke on permissions page.


texts: How to load multiple values from a field with views_php module?

texts:
I'm trying to build a responsive gallery. Since views won't let me rewrite the field's output with html5 data attributes I need to print the output using a PHP field in views.

Using the module views_php, I'm accessing the values of the image field this way:

$source = $data->_field_data['nid']['entity']->my_field['und'][0]['filename'];

This way I load the value from the ['und'][0] array, this would work properly if a field  has a single value.
But what if in the node creation, in my field I want to upload multiple images. How could I change the [und] numerical value to load as many values as my field has.

Thanks in advance.


texts: How to generate custom template for views page

texts:
I have created a view for content type xyz and added fields like title, body,image,designation, etc.

I want to enclosed every single field of view in html structure, so that I can see all titles in red color, all body fields in blue color, same for other fields.

what's the best approach to do this?

Edit:

Is it possible to render fields in a way like shown :

<?php print render($view['field1']); ?>

<?php print render($view['field2']); ?>

<?php print render($view['field3']); ?>

<?php print render($view['field4']); ?>

in view custom template file??


texts: How to trigger an email to someone who opens an account but never signs in?

texts:
Assume a user visited your site and signed up for an account, but such user never did Sign in to your site anymore.

Is there any way to generate mails to such visitors, for letting them know about your products and services?


texts: Search index stuck at 0%, mysql error on public search, can't clear error

texts:
I have just discovered that the  Drupal 7 search on my website is giving 'website encountered an unexpected error. Please try again later.' to users who are not logged in.  (it's fine for logged in users.)

Checking the logs, I can see that when a non-logged in user runs a search it causes a mySQL error, which looked like there was a problem because I'd excluded content type admin_only_help from public search.

OK, I'll include that content type in search.  Nope, still the same error.  OK, re-index the search: nope, won't re-index the search, stalls at 0%.

I tried:

setting content type admin_only_help to be indexed.
unpublishing all nodes of content type admin_only_help
re-indexing the search from the admin panel (it stalls)
running drush search-index from the command line (it stalls)
turning off the Custom Search module
clearing cache (after all of the above).

I'd be very grateful for any further suggestions.

The exact error from my logs is:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have
an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'WHERE (c.nid = '873') AND
(c.status = '1') AND (n.type <> 'admin_only_help')' at line 2: SELECT COUNT(*)
AS expression FROM {comment} c INNER JOIN {node} n ON n.nid = .nid WHERE
(c.nid = :db_condition_placeholder_0) AND (c.status =
:db_condition_placeholder_1) AND (n.type <> :db_condition_placeholder_2) ;
Array ( [:db_condition_placeholder_0] => 873 [:db_condition_placeholder_1] =>
1 [:db_condition_placeholder_2] => admin_only_help ) in PagerDefault-
>execute() (line 74 of /home/mysite/public_html/includes/pager.inc).

Edit with update:
I tried completely removing the problem content-type admin_only_help and completely removing the two nodes that belonged to that content type.

Now I have this error:

SQLSTATE[42000]: Syntax error or access violation: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'WHERE (c.nid = '421') AND (c.status = '1')' at line 2: SELECT COUNT(*) AS expression
FROM {comment} c INNER JOIN {node} n ON n.nid = .nid WHERE (c.nid = :db_condition_placeholder_0)
AND (c.status = :db_condition_placeholder_1) ;
Array ( [:db_condition_placeholder_0] => 421 [:db_condition_placeholder_1] => 1 ) in PagerDefault->execute()
(line 74 of /home/mysite/public_html/includes/pager.inc).

And I still can't re-index my database.


texts: How I can insert some help text on the ckeditor media embed "Create embed" tab? Oddly, I can't even find those words together in code. I have a user confused about its use, so I want to specify that this is for video URLs only. She is trying to "embed" an image that she already has on the site, but she gets an error message "input did not match any media types." If I do a form alter of "entity_embed_dialog" then the message displays on all tabs of media embed dialog window.


texts:
Is it possible to combine two filter criteria exposed filter into one dropdown. In drupal 8 I am creating a view to search certain content type. One of the content type has three select list field, I do not want to create three seperate exposed filter dropdown on the search page, Is there is a way to combine all into
one exposed filter dropdown ?
Any suggestions and guidance deeply appreciated.


texts: Print {{ node.body.value }} in node--content-type.twig missing figure and figcaption tag of image

texts:
My code in node--content-type.html.twig is the following.

{% autoescape false %}
  {{ node.body.value }}
{% endautoescape %}

In my node there are images, centered and with a caption, but when I view the node detail, the images are not centered because of missing figure and figcaption tags.

How can fix it?


texts: Add a custom line item type with custom fields when my module is active

texts:
I'm developing a module that adds on to Drupal Commerce that requires a custom line item type (LIT) along with additional fields on the LIT. With this hook I can add the LIT.

function package_designer_commerce_line_item_type_info_alter(&$line_item_types) {
     $lineItemType = array
    (
        'name' => "new product line item type",
        'description' => "A customized product line item type",
        'product' => true,
        'add_form_submit_value' => "Add product",
        'base' => "commerce_product_line_item"
    );
    $line_item_types['new_product_line_item_type'] = $lineItemType;

}

And it appears in the LIT list under the configuration menu. But when I click on Manage Fields it doesn't have the same list of as the regular commerce line item type, which is what I thought the base entry was meant to do. That is secondary though to my actual problem.

I want my LIT to have a specific field attached to it without having to provide instructions on how to go through the admin interface and create it. This might mean that instead of using that hook I need to use the .install file but I'm new to Drupal and would like to start with the recommended method instead of developing bad habits.

Update

It turns out base doesn't do what I thought it did. It only sets the line item up for using the default callbacks that start with 'commerce_product_line_item_type'. To actually make my LIT have the same base fields as the commerce product one I need to add this to my module

function package_designer_enable() {
    commerce_product_line_item_configuration(array('type'=>'new_product_line_item_type'));
}


texts: What's the difference between !, %, and @ in replacement tokens?

texts:
I'm using the Message module on Drupal 7.  For Replacement tokens, the help text says:

  A comma-separated list of replacement tokens, e.g. %title or !url, of
  which the message text makes use of. Each replacement token has to
  start with one of the special characters "@", "%" or "!". This
  character controls the sanitization method used, analogously to the
  t() function.

What's the difference between %, !, and @?  Are there standards about when I should use each symbol?


texts: How to relate two profile2's profile in one single form?

texts:
I'm developing a portal, using Drupal 7, to manage the entrance of people on my building. I'm using Profile2 module and I created two profiles: "Dweller" and "Visitor".

Now my idea is to create a content type "visit" where I could register the visits that a dweller receive but how can I add two fields, one "dweller" and another "visitor" that will list the entities (persons) of each kind of profile?

Any one have a better approach for this requirements? Or any idea how to resolve it?

Tks!


texts: How should I let some users to download from Private folder

texts:
I stored the names of some users in one table and they should be able to download certain files from private folder(not other users). As i see i have to use hook_file_download

In the page of that hook it is said:

  If the user does not have permission to access the file, return -1. If
  the user has permission, return an array with the appropriate headers.

I don't understand which array should be returned exactly! my file in private folder is mp4 file and user has to see save page.
some users  file_create_url() but i don't know how to use it inside hook_file_download. can u give me one example code?

thanks in advanced for your help

edit: I found this code here:

  if ($can_access_file) {
    $headers = file_get_content_headers($file);
    return $headers;
  }

I don't know exactly how to provide with $file!
here is file_get_content_headers help


texts:
I'm currently using D7. When my users attempt to request a password reset, 95% of the time, these reset emails land in their spam, or are blocked by whomever their email provider is. That being said, I'm looking to implement a way for my user to regain access to their account by receiving this password reset link via SMS instead.
Currently, my site collects the user's phone number on registration, and I have the Twilio module installed. All of that said, there doesn't seem to be a Drupal Rule that I can execute for "When anonymous user requests password reset".
Ideally, I'd like to have a Drupal rule search my user list for the user that contains the input email, and then simply send the generated password reset link to the phone number on file (also attached to the found User's account).
Is this possible?


texts: How to login to my site again after all users were deleted?

texts:
I was inside /admin on my site looking at users. I noticed a lot of what looked like robot made users and I decided to delete them. I clicked the box for delete all on this page. What happened then is that all users were deleted and now I cannot login at all.

All clients linked with whitelabel show error message.

What can I do?


texts: Views slideshow won't show "slideshow" display format (commerce kickstart)

texts:
My Views slideshow won't give me the option to show my content as a slideshow (when creating block or page).

I have Libraries, Views 3.X, Views Slideshow, Ctools, ... all the requirements and both Views Slideshow and Views Slideshow Cycle is enabled. Still it isn't giving me the option.

Anyone who has any idea why?


texts: Toggling view modes of Views results with Display Suite

texts:
I asked a similar question about a month or so ago, and the answer was to use the Views Modes module.  That module required the PURL module.  The problem is the PURL module leaves parameters on your URL all over the site, and have not figured out a way to turn it off.  Others have posted a support issue and it goes ignored.

So, I'm back to the drawing board.  I have nodes that are rendered, using view modes defined in Display Suite.  Is there a way I can toggle between view modes in Views?  What I'm really trying to do is provide a bunch of filter checkboxes, along with the ability to toggle between view modes, but I need to find a solution for the view modes first.

Is there a module that makes this easy, or do I need to write some code.  If I do need to write some code, how should I approach it?


texts: Advantages of using context for sitewide blocks?

texts:
As far as loading time is concerned I haven't seen anywhere, including the documentation, if there is a real advantage in using the context module to display sitewide blocks over the Drupal default block page.

For D7, some say Drupal loads all blocks for every page but displays only those that are visible. If so, then using context could dramatically speed up a site with many blocks. Others say D7 only loads the visible blocks.

But, which is it? Is it worthwhile to switch to context for block display? Does any one really know?

Thanks. :)


texts: Drupal 7 default core search functionality

texts:
I am using drupal 7, i am in need of showing the default search functionlity, which shows the searched term content type and how many times the searched keyword occurred in the content type.

The entered keyword will be searched with site wide search and the results will show what are the content type nodes having the keyword and how many times the keyword occurred for the content type. Please help me to solve this problem.


texts:
I have a node reference field and the auto-complete widget. Right now, It only returns/suggests 10 nodes maximum.

How can i increase the number of nodes suggested by the auto-complete? (Or) better yet make it return all the suggestions?


texts: How to make taxonomy term name field work with 'Full HTML' text format?

texts: As taxonomy term name field supports only plain text, all I want is to use non-breaking space (&nbsp;) for taxonomy name. Just to achive better html layout.


texts: Why does my Rules Action about booking a time slot appear to not be executed?

texts:
I recently installed the Booking time slot module and got it to work as expected.

The issue I have is that its "Rules event" does not trigger a Rules Action. Here is my rule (for now it only includes a Rules Action to show a Drupal message):

{ "rules_booking" : {
"LABEL" : "Booking",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "entity" ],
"ON" : { "booking_insert" : [] },
"DO" : [ { "drupal_message" : { "message" : "Success!" } } ] } }

I have tried using various events (After saving a new booking, After updating an existing booking) but none appears to work.

I wondering if anyone has had this kind of experience or knows what could be wrong.

Update

Here is a screenshot of the Rules Events I can select:


texts: How can I convert oauth2_token.value back to a Bearer token in simple_oauth?

texts:
I'm working on a headless Drupal 8 API that offers direct login links via email. For users who forgot their passwords or were invited but have never logged in, it's safe to just reset their password.

Otherwise, is there a way to convert the ~80 character strings in  simple_oauth's table oauth2_token.value back into a Bearer token?

My currently implementation only resets the password as:

public function handle_otp(String $code, User $user, Group $group, Request $request) {
        $hash = \Drupal\Core\Site\Settings::get('myhash');
        $shouldbe = md5($hash . $uservariables);
        if ($code !== $shouldbe) $this->returnError(array('This is an invalid link'));

        $tokens = \Drupal::database()->query("SELECT id FROM oauth2_token WHERE status = 1 AND expire < now() AND auth_user_id=:uid LIMIT 1", array(':uid'=>$user->id()))->fetchAssoc();
        if (empty($tokens)) { // its safe to reset their password since they have no tokens
          $password = user_password(10);
          $user->setPassword($password); // reset password so we can request tokns
          $user->save();

          $params = array(
            "client_id" => \Drupal\Core\Site\Settings::get('client_id'),
            "client_secret" => \Drupal\Core\Site\Settings::get('client_secret'),
            "username" => $user->getEmail(),
            "password" => $password,
            "grant_type" => "password");

          $tokens = _run_curl($base_url.'/oauth/token', $params);
          $tokens['randpass'] = $password; // give it back to the client to auto login
          $tokens['email'] = $user->getEmail();
        } else {
          // TODO: how do we convert oauth2_token.value to a Bearer token
        }

        return $this->sendToClient($tokens, $request);

     }


texts: Get shipping and billing information from rule

texts:
I am using the Drupal commerce module. I want to write a PHP script to execute on order completion, and I want that script to update an external database with the shipping information. How would I go about doing this?

I have already setup a rule to execute PHP code on order completion, and I am given the variable $commerce_order, but I don't know what to call to get out the customer shipping information. I have tried to email var_dump($commerce_order) but it does not give me anything.

How can I get a list of the fields? Am I on the right track?


texts: How to deal with duplicate table name with db_select left join

texts:
Basically I have a db_select that has two left joins.  And will be calling up two table fields with the same name.  The fields have different data though, so I need to be able to have access to both in my results.  In a normal query I’d set this in the SELECT - how can i do the same in db_select

SELECT table1.column AS column1, table2.column AS column2
FROM table1
LEFT JOIN table2
ON table1.column = table2.column

here's my code that i need to change

$query->leftjoin('migrate_map_emp', 'm', 'm.sourceid1 = i.ID');
$query->leftjoin('migrate_map_emplogo', 'ml', 'ml.sourceid1 = i.ID');

$query->fields('i', array('ID','Name'))
      ->fields('m', array('destid1'))
      ->fields('ml', array('destid1'));

[solved]

the above code works.  I did a 'drush_print_r'  on the rows returned at the second item is labelled ml_

[destid1] => 5
    [ml_destid1] => 2

Many thanks


texts:
I am trying to set up a jumplist on my site that has a list of taxonomy terms from a list I've called Categories. I have the jumplist displaying correctly but when I select a term from the list and navigate to it I get this message:

Page Not Found
The requested page "/cms/ca2/Video%20Editing" could not be found.

I would like that it would bring up a list of all the nodes that I have assigned to the category I've selected from the list but can't seem to figure out how to do it.

Could anyone help me with this issue.

Many thanks.

My site I am trying to implement this on. You can see the jumplist on the right sidebar with the title Categories List

http://jciadt.com/cms/ca2/


texts: Admin interface styles sometimes missing; frontend CSS loaded

texts:
Using administration pages on an old Drupal 7 installation, the "normal" admin CSS styles are sometimes gone and the page appears with the frontend layout.
After reloading the page, the normal admin CSS is back.
What could cause this problems, and how could I fix them?
Screenshots
Frontend layout mixed into admin page:

Correct admin layout:


texts:
I have the Superfish module on my site that my main navigation uses. The site I am building is responsive so I'd like to destroy Superfish when the viewport is smaller than a specific size.

I see that superfish has a destroy method: example.superfish('destroy');

How can I use this method on my nav menu in Drupal? I'm assuming I need to do something like...

Drupal.behaviors.superfish {something here}


texts: I want my users to login through 'Last Name', rather than 'Password'

texts:
I would like my users to log in through 'Email' and 'Last Name', rather than 'User Name' and 'Password'. I did manage to swap 'User Name' with 'Email', but I cannot replace 'Password' with the user's 'Last Name'.

I have added another customer profile with two new fields, i.e., 'First Name' and 'Last Name' and now want the field 'Last Name' to be used in place of 'Password'.

I tried everything. Any help or guideline will be highly appreciated.


texts: Migrating Multisite Setup to Localhost Running Nginx 404 for /files

texts:
I'm migrating a Drupal 7 based site to localhost. The site is currently setup in a multi-site configuration in the following way:

    webroot
    -drupal
    --sites
    ---example.com
    ----files
    ----settings.php
    ----sites.php
    ----modules
    ----themes
    ----libraries
    ----private

On my local dev server I imported the Db and set up the site in the following configuration:

 webroot
 -sites
 --example.com
 ---files
 ---settings.php
 ---sites.php
 ---modules
 ---themes
 ---libraries
 ---private

While I'm able to see the pages and login to the site, everything in my /files folder is returning a 404. All of the aggregated js files and images are broken and when I try to access any site admin links, I get an error.

I've check the permissions for the /files folder and files and everything seems fine. I've tried various suggestions like checking the .htaccess file, and adding $base_url in settings, and even turning off clean urls, but nothing seems to work. I even tried to set permissions on the folder and files to 777, but no luck.

Any suggestions or recommendations would be greatly appreciated.


texts: Location : Proximity Search Slider Instead of Number Field

texts:
I'm currently trying to use the Select with Style module to set a distance from a location using the Proximity Distance feature of the Location Module.

I want to be able to use a slider to select the distance from a point rather than use the number input field provided by default.


texts: How to enforce users to input user account's fields after user registeration?

texts:
I'm useing D7.

What I want to do is...

Step1: Let users register only by inputting their email address & password on  user registration form (http://www.my_website.com/user/register)

Step2: Redirect them to user account edit page (http://www.my_website.com/user/user id/edit) after their registration. And then, enforce them to input the rest of fields such as [first_name] & [hobby] on the edit page.

The 'step1' was able to be done by using  'Email Registration' & 'User registration password' module. And I think I can redirect users to the edit page. But I don't know how to enforce them to complete the rest of fields in edit page.

I want to do this without using Profile2 module. Does anybody have idea to do that?

I'm really sorry if this is an entry-level question to you. But I'm very new to Drupal and I have been struggling with this for a week, but I couldn't find the way. Please somebody help me!

Thank you!


texts:
I was trying to add signature in every node in my drupal 7. I found this the code was for drupal 6. What would be the code for Drupal 7? please help me because I have no idea about drupal api.
Thanks


texts: how to prepopulate a flexifield in form_alter?

texts:
I have a flexifield with name:

field_flexi_pricing[0][value][field_pricing_day_price][0][value]

how do i fill in a default value for this flexifield in form_alter?


texts:
I have some blocks for navigation and side bars that are appearing all over the site.

I want to hide the navigation and sidebars on the following urls:

node/78
node/19
user
messages

For some reason, drupal will hide the nav and side bars on node/78 and node/19 but not the user and messages pages.   How do I make it disappear from the user and messages page as well?

What I've done so far was click on Structure>Block, then go to the block I want, configure it, and list the paths for the blocks I want to hide.


texts: where is the source code for "Powered by Drupal"

texts: Someone told me the footer text "Powered by Drupal" in Drupal7 is provided by theme_system_powered_by(), which is turned into a block by system_block_info() and system_block_view(). I wonder in what file(s) these functions can be found. Thanks a million.


texts: How to scan a directory to list all sub folders not files

texts: I have a folder (root folder) with thousands of sub folders and *.json files inside sub folders. How can I get list of sub folder names inside folder (root folder) using file_scan_directory?


texts: Math Expression in Views: Date functions like now()

texts:
Is there Date expressions or function? I'd like to calculate a duration between a date field and today ? Is there a now(), today() function?
i'd like this kind of math expression: now() - [field_arrival]


texts: Is it better for performance to disable unused default core views?

texts:
I'm seeing 5 views on my site that I'm not using and want to disable to keep things clean and performant, but I worry it could cause a problem somewhere down the road.

The views are:

Frontpage (frontpage)
Recent content (content_recent)
Taxonomy Term (taxonomy_term)
Who's New (who_s_new)
Who's Online (who_s_online)

I have disabled these views and haven't seen any issues. I am not using any of them. Is core expecting these to be enabled? Does disabling these actually improve performance in any way?


texts: How do I get only node IDs from the search results?

texts:
I'm using Search API Solr with custom searches in code, but I want to find a way to limit the return results to only the nid to save on bandwidth with our third-party solr server. I've tried $query->fields(array('nid')) but I receive the following error.

  SearchApiException: Trying to search on field nid which is no indexed fulltext field.

I am using the following code (simplified).

$index = search_api_index_load('my_index');
$query = $index->query();
$query->keys($search_terms);
$query->fields(array('nid')); // doesn't work
$results = $query->execute();
return $results;

How do I get only node IDs from $results?


texts: Can I add additional module to drupal distribution (all inclusive)?

texts: I have a SSO module I need to add to Open Social distribution. Can I add this additional module to the distribution (all inclusive)?


texts: Creating registered user homepage upon registration

texts: If one were creating a growing directory on users say for example a 'staff directory' and one needed to allow each user there own editable homepage (ie manage their home page themselves using a wsyiwyg), in your opinion (assuming we don't use Panels/Views OR we DO use a Panels/Rules/Views (P/R/V) combination) what would be the best approach. Usages are unlimited but for example here: an HE university needs each lecturer to have their own home page which they our course can edit as need be (i.e. domain.ac/johndoe). This could allow users to create/edit their own frontend ala Myspace/Facebook style. I would rather use P/R/V combi if that is the most appropriate option rather than an 'off the shelf' Drupal module (but do point me to one if one exists that I have missed!). Flexibility & futureproof is key.


texts:
I'm having trouble with something incredibly simple: I want to count the number of rows I will export, before exporting it. For this I have a button "count" that on every click calls a php function and returns the counting. The problem I'm having is that Drupal never manages to get in the callback-function I specified.

Here is my code:

function monetisation_menu() {

    $items = array();

    $items['monetisation'] = array (
            'title' => '_Monetisation Export',
            'page callback' => 'monetisation_page',
            'access arguments' => array (
                    'access content'
            ),
            'type' => MENU_NORMAL_ITEM,
    );

    $items['monetisation/js_page'] = array (
            'title' => 'AHAH Monetisation callback',
            'page callback' => 'monetisation_js',
            'access arguments' => array (
                    'access content'
            ),
            'type' => MENU_CALLBACK,
    );

    return $items;
}

My button:

$form['count_button'] = array (
            '#type' => 'button',
            '#value' => 'Count Selected Range',
            '#ahah' => array (
                    'event' => 'click',
                    'path' => 'monetisation/js_page',
                    'wrapper' => 'counting_msg-wrapper',
                    'effect' => 'fade',
                    'progress' => array(
                            'type' => 'throbber',
                            'message' => 'Please wait while we process your request...'
                    ),
            ),
    );

And my PHP Function:

function monetisation_js(){

    $form_state = $_POST;

    $monetisation = new monetisation();
    $params = array();

    _cleaningForm($form_state);
    $params['values'] = $form_state;
    $arrAttributes = _fillAttributesArray($params);

    $result = $monetisation->searchByAttributesArr($arrAttributes, _getAttributes(), false);
    $selected_count = $result;

    $data = "You have selected $selected_count records";
    drupal_set_message($data);

    drupal_json(array('status' => TRUE, 'data' => $data));
}

When I try it, I get an alert with "An error occured" followed with the html code of the page... Somebody Help me?


texts: Ajax HTTP Error Occured in Theming Tables

texts:
I have two elements in my form: a select element and a div with an id of #myid_table_wrapper.

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

    $form['options'] = array(
        '#type' => 'select',
        '#options' => array(
            0 => t('All'),
            1 => t("Printed ID's"),
            2 => t("Unprinted ID's")
        ),
        '#ajax' => array(
            'callback' => 'myid_print_all_submitted_id_callback',
            'wrapper' => 'myid_table_wrapper',
        ),
    );
    $form['myid_table_wrapper'] = array(
        '#type' => 'item',
        '#markup' => '

',
    );
    return $form;
}

Everytime the select element fires an onchange event it calls a callback function named myid_print_all_submitted_id_callback.

function myid_print_all_submitted_id_callback($form, $form_state)
{
    // Build the sortable table header.
    $header = array(
        'id_number' => array('data' => t('ID Number'), 'field' => 'id_number','sort' => 'asc'),
        'student' => array('data' => t('Student'), 'field' => 'student', 'sort' => 'asc')
   );

   //Get the node data.
   $query = db_select('student', 't1',array('target' => 'import'));
   $result = $query
       ->fields('t1', array('studid','lastname', 'firstname', 'middlename', 'extname'))
       ->condition('t1.id_status',2,'=')
       ->distinct()
       ->execute();
   //Build the rows.
   $rows = array();
   foreach($result as $record){
       $rows[$record->studid] = array(
           'id_number' => $record->studid,
           'student' => $record->firstname . ' ' . $record->middlename . ' ' . $record->lastname . ' ' . $record->extname,
       );
   }
   return theme('table', array('header' => $header, 'rows'=> $rows));
}

The code results to an error:

Whats wrong with my code? How will I debug this?


texts: Saving body as HTML in custom content types

texts:
I have a custom content type that I want to save data to,

the content type has custom fields and I used a secondary form that supplies the from data to be stored, when the user sees the view, the Body of the content type is actually the fields put together in a nice styled format like so:

User fills in form->node gets saved as content type->user is sent to new page.

In the new page only the body is displayed, but the problem I have is that when I save the content it gets saved as plain text so none of the html is rendered, this is the code that saves the content type ( i have left out the custom content types as they are saved how I want them to be saved:

$node = new stdClass();
    $node->type = 'client_account';
    $node->title = $form_state['values']['groupName'];
    $node->uid = $user->uid;
    $node->name = $user->name;
    $node->comment = 0;
    $node->promote = 0;
    $node->language = LANGUAGE_NONE;
    $node->is_new = True;
    $node->body[LANGUAGE_NONE][0]['#format'] = 'full_html';
    $node->body[LANGUAGE_NONE][0]['value'] = ' html table goes here with filed values inserted';

I havew a feeling that I am using the #format = 'full_html' incorrectly and would appreciate some advice on the matter.

Jim


texts: How to show SUM of values from referenced entity fields in a View?

texts: Okay, I've a two content types "A" and "B". "A" is a parent and have a field referenced(Entity Reference) to the child content type "B". Now I've created a View(Table) with a list of "A". And I want to add a field to show the SUM of field values from the referenced type "B". How to do this? Is it possible to solve with a Rules?


texts: Error when aggregation is turned on in Views

texts:
I have a view for Organic Group (og) that displays a list of the groups, a picture, the language, the categories the groups fall into, and a summary of the mission statement. All of this is neatly organized in a grid.

I want to add a membership count for each group in the view. As soon as I turn aggregation on, I get the following error message:

  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
  error in your SQL syntax; check the manual that corresponds to your
  MySQL server version for the right syntax to use near 'AS
  node_og_field_data_field_group_image_, node_og.title AS node_og_title,
  node_' at line 1

Does anyone know what's going on and how to fix it?


texts: How to open quicktab tab from external page (after clicking link url)

texts:
i have a slider with link field at my front page, and quicktab section on another page. The slides and the quicktabs are connected, so i want when i click on the link at the slider to open the specific tab. The quick tabs in my case use class active for the clicked section to show. How can i make the tab active externally with click on the link at the slider?

Thanks in advance!


texts: How can I export a group of settings in Drupal 8

texts:
Drupal 8 has this new configuration management tool at /admin/config/development/configuration. I have an experimental site running Drupal 8 beta14, and I want to import a few settings into my new beta15 site. I don't want to copy everything, I experimented with various things on the old site and only need a few things on the new one.

What I want to copy are content types, the fields in those content types as well as image styles. But looking at the export tool, it seems I can only export a single item at a time.

Is there a way to export all items of a specific group at once, e.g. all content types or all image styles? And for content types, is there a way to export all the fields as well together with the content type?


texts: How to check the value for specified field across all nodes?

texts:
I have minimal Drupal and PHP experience ...

Problem:

I have an autocreate function for a Content Type ('hannibal'), which has one defined field type ('faceman'). When Content Type 'hannibal' is created, it is done automatically through rules by passing the value for field 'murdock' from another content type. 'murdock' and 'faceman' are sometimes identical values (they are also identical formats: text, same formatting, direct copies).

I need to check across all other nodes of type 'hannibal', to see if the value for 'faceman' already exists in that field. I have Unique Field module active, but because the nodes are being created through Rules, it is not functioning in this case (perhaps it only works when in a user entered form).

Issue: A method to check field 'faceman' for the value being entered, in all nodes of type 'hannibal'.

I've already tried a LOT of options for this:

Rules - I have tried setting conditions, but can't find a way to load all nodes of type 'hannibal' to check that field value. I've tried to do it in PHP using snippets taken from elsewhere, but no luck. Also tried setting a rules component, but couldn't make sense of it.

Database query - I'm using SQLite. I've identified the table to check, and tried an EntityFieldQuery but the code I've tried as a condition is just crashing the page:

$value = token_replace('[node:field_murdock]', array('node' => $node));

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'source')
  ->propertyCondition('status', NODE_PUBLISHED)
  ->fieldCondition('faceman', 'faceman_value', '$value',)

$result = $query->execute();
if (isset($result['node'])) {
  return TRUE;
}

So long as I can create the nodes automatically, and prevent new nodes being created if they have an identical value to a pre-existing value for field_faceman, I'm not that bothered about how it is done (within reason!).

This seems like such a basic function (checking all the values of a given field in the database), I must be missing an easier way to do this. Right?

Any help?

UPDATE & SOLUTION

Managed to solve it with EntityFieldQuery in the end. I'm convinced I can't be the only person with this issue, so for anyone of around my skill level in the same position in future:

Solution is via Rules using the PHP conditional.

Rules trigger is save content event. Conditional 1 is "content has 'faceman' field". Conditional 2 is Execute Custom PHP as below. No link between the two conditionals - trying an AND function broke them.

Custom PHP code:

// display murdock field taken from saved content as plaintext

$value = token_replace('[node:field_murdock]');

// search database for identical values of field faceman

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'hannibal')
->propertyCondition('status', 1)
->fieldCondition('field_faceman', 'value', $value, '=')
;

// if identical value of field faceman is found, return FALSE to Rules condition

$result = $query->execute();
if (isset($result['node'])) {
return FALSE;
}
else {
return TRUE;
}

Therefore the action part of the Rule will only be executed if the value is not already present in the Faceman field somewhere in another node. So long as your existing node types Hannibal have fields Faceman with equivalent values / formats, then a duplicate node will not be created.

My actions rules then create the Faceman field in the new content by directly copying field Murdock from the saved content which triggered the Rule. This ensures that the above logic works, and the node should only be created once, because Faceman will always be a child & copy of a Murdock field.


texts:
Im pretty sure that my jQuery should below should work but when I use it in a Drupal site the animation doesn't repeat like it should.

http://smartpeopletalkfast.co.uk/t/

$(document).ready(function() {
    if ( $(window).width() > 960) {

    function fadeOutFunc() {
        $('.image-list .bottom').delay(1000).fadeOut(500, function() {
            $('.image-list .bottom').delay(1000).fadeIn(500,fadeOutFunc);
        });
    }

    fadeOutFunc();

    //  jQuery('.image-list .bottom').css('opacity','0.6');

    }
});


texts: Menu hook callbacks not working for anonymous users

texts:
My custom error handler module is somewhat based on the customerror module, but instead of returning markup, my menu callback function redirects based on the original path. It registers error paths as follows:

function my_customerror_menu() {
  $items = array();

  $items['my_customerror/%'] = array(
    'title callback' => FALSE,
    'access callback' => TRUE,
    'page callback' => 'my_customerror_page',
    'page arguments' => array(1),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

'access callback' => TRUE should make it accessible to all users. I can use the path my_customerror/404 for example in the site settings and it is recognized as a valid path. This works fine in a local instance and on the Pantheon development  site, but once I pushed it to the Pantheon test environment, my_customerror/404 is not invoked on 404 - Drupal uses the default error response. Unless I am logged in, then it works in Test as well.

But the path my_customerror/404 works regardless when I type it in manually and does what it should. Somehow Drupal erroneously thinks that this path is not accessible to anonymous users.

What could be causing this?

Here is a simplified version of the callback function that shows what it does:

function my_customerror_page($code) {
  $dest = variable_get('my_customerror_' . $code . '_default', '');
  switch ($code) {
    [conditional stuff]
    default:
      header('Status: 301 Moved Permanently', false, 301);
      header("Location: " . $dest);
      break;
  }
  return "";
}

Don't ask why I use header() and not drupal_goto() ....

Just bringing something into the problem description that I already mentioned in a comment. When the Devel module is turned on and anonymous users are given permission to see developer output, it starts working! But this is not a solution, I obviously can't do this in the Live environment.


texts:
When I use the widget "field-type-text-with-summary" with the CKEditor, my summary is shown in the CKEditor-format. Can I prevent this and display the field with the plain-format? Hooking into the form, I haven't found a format for the summary; there is just one for the whole body field.

using CKEditor module.


texts: file upload works with only one specified extension but not more than one

texts:
I can't figure out what is wrong with this code for file uploads. I am trying to specify multiple extensions for the file upload - it works with a single extension, but if I specify more, it fails and only accepts the last item in the list, even though the error message appears to be self-contradicting. If no extensions are specified the system default list works correctly, but I need to add some extensions.

I am enclosing the minimal code, since after trying everything, modifying this code was the only difference between success and failure:

This works (regardless of the extension)

$file = file_save_upload('sequencefile',
    array(
             'file_validate_extensions' => array('seq')));

This fails on 'jpg', but works on 'seq'; moving jpg to the end of the list works for jpg, but then fails for the others.

$file = file_save_upload('sequencefile',
     array(
             'file_validate_extensions' => array('jpg, jpeg, png, gif, txt, doc, docx, ab1, seq')));

The error message on a jpg file is as follows, even though jpg is clearly in the list:

"The specified file mbpdpermissionsP2.jpg could not be uploaded. Only files with the following extensions are allowed: jpg, jpeg, png, gif, txt, doc, docx, ab1, seq."

What am I missing? it should be very simple and yet I can't get it to work.

thanks!


texts: Override field template with custom module

texts: Instead of adding tpl files (in this case, media-youtube-video.tpl.php) to the theme. How can I override field templates from a custom module? Including when the field is used in a View.


texts: Combine two content types in one using search api views

texts:
I am using search api views for site search.

I have 4 content types A, B, C and D.

In the views filter when I expose a content type filter, it display as following on the search page

All
A
B
C
D

I want to combine the C and D content types.

All
A
B
Combined

Where Combined will be a custom text and when click , it should filter the content with Content type C and D.

Is it possible with search api or is there any workaround?


texts: Document management system with version control and access rights control in Drupal 7

texts:
I need to create document management system and for that I have a set of requirements (not well fleshed out) that cover a system to manage documents (word docs, designs, etc.) for both internal and external use. Basically what we need is a system that allows users to have multiple versions of docs online, publish at will and keep working on new revs. We also need to have inside and outside facing interfaces with access control and permissions enforcement (this might be best covered with separate sites and doc pushes to the outside facing interface).

I looked at Document module, but i think it is still under development.

So, the question is: Is there a distribution or a set of modules already in place that closely approximates this set of requirements, or am I looking a tough rocky climb to get where we need to be?


texts: why i can't update user's picture by user_save()

texts:
i wrote the program belowed

$fields=array('name'=>'test user','picture'=>$fid);

$account=user_save($account, $fields);

i really changed the user name but i can't change the picture field in the users table

what could the problem be?

by the way, i also use db_update. The situation is the same

the code is blowed

db_update('users')
->condition('uid',$account->uid)
->fields(array('picture'=>$file->fid))
->execute();

still not work
I hope somebody can help me,Thanks!


texts: How do I programmatically get the name of content's author?

texts:
I copied node.tpl.php and I pasted it to node--my_content_type.tpl.php. In that file I'd like to get the name of user who created a node. That name has to be a string.

Could someone help me, please?


texts: Redirection after certain node type creating

texts:
So far i have this code in mymodule.module:

function mymodule_form_alter(&$form, $form_state, $form_id) {
    //drupal_set_message($form_id);
    switch ($form_id) {

        case 'anons_node_form':
          //dpm($form);
          $form['#submit'][] = 'sex_custom_submit';

          break;
    }
}

//Custom submit handler
function sex_custom_submit($form, &$form_state) {
  $form_state['rebuild'] = TRUE;
  $form_state['redirect'] = '/video';
}

In a short i want this thing - when a user creates a node type 'anons' after succesfull creation of that node -> user should be redirected to a /video page. Code above doesn't works for me.. What i am doing wrong?


texts:
For certain node types I want to log/track each time the publish status changes from published to unpublised and from unpublished to published. I am aware I could do this with rules and write log entries into the standard log, but I don't think this is a good solution.
I prefer to have a specific logtable for that, so that I can export it and that I can also show the history in a special tab of the node.

I was doing now some research, but could not find anything in this direction.

Is there a module I have not seen and which would be the solution?

If not, what would be the best approach?
Thanks


texts: "WHERE NOT IN ( SELECT... )" with SelectQuery?

texts:
Is it possible to add a WHERE NOT IN (SELECT...) clause to a SelectQuery object? I was looking at SelectQuery::condition(), and it doesn't seem to allow for this syntax:

public SelectQuery::condition($field, $value = NULL, $operator = NULL)

It only seems to allow for value comparison expressions. Is there another method that provides this syntax?

I'm looking at conditions on the order of thousands of values, so it seems inefficient to have a bunch of AND value <> x conditions.


texts: How to render formatted text field from paragraphs as is in twig?

texts:
I need to render a text (formatted long) field using twig. At this time i am doing the following below. However, i am finding that if i were to add a line break in the text field or apply adding spacing or a horizontal line, the twig filter "raw" removes those attributes. I need assistance to see what I am missing.

I have already set the view mode for field on the content type to default

Twig template (filter used)

{% for item in items %}
    {{ item.field_body.value|raw }}
{% endfor %}

Expecting

Actual result


texts:
I've set up a simple hide-show.js file for my website and I'm working on a module as well.
Problem is, if my module is active, the jQuery for the page doesn't work, is there something I need to do to 'close' my module after writing or anything?

Edit: My console does not show any errors. And with jQuery I mean the functions on the page (i.e. clicking on a hide-show button does nothing).

<?php function maps_markers_init() {

if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
}  else {
        $latitudes = db_query('SELECT field_latitude_value FROM {field_data_field_latitude}')->fetchCol();
        $longitudes = db_query('SELECT field_longitude_value FROM {field_data_field_longitude}')->fetchCol();

        json_encode($latitudes);
        json_encode($longitudes);

        require(drupal_get_path('module', 'maps_markers') . '/maps_API.php');
    };};?>

maps_API.php contents:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[api key]"></script>

Also, hide-show.js contents:

$ = jQuery.noConflict();

($(function(){
        $(".collapse_btn_down").click(function(){
            $(".mid_div").fadeToggle( "800" );
            $('.buurtkiezer').toggleClass('buurtkiezer_solo');
            $('.content_wrap').toggleClass('content_wrap_solo');
            $(this).toggleClass('collapse_btn_up');
            $(".legenda").css("margin-right","20px");
            $(".legenda").css("margin-top","-80px");

        });

}));


texts: Drupal 8 performance regressions. Would it be a solution for high traffic online communities?

texts:
There were some legitimate concerns about Drupal 8 potential performance regressions as a result of being built on top of Symfony2. Drupal 8 Beta-14 is the latest release; It seems that the Drupal 8 big release it comes apace. As per all the benchmarks I saw until I noticed that Drupal 8 is much slower than Drupal 7 especially for logged in users which is kind of a bummer.

Isn't Drupal supposed to be used for online communities where logged in users could interact? For displaying news and blogs there are already other software much convenient to use such as Wordpress. What kind of server would support such an expensive product? In this scenario, will be Drupal 8 a solution for high traffic online communities where logged-in users could post things and make comments and interact with each other?

Shouldn't this newer version of Drupal better than the old one? In terms of performance it doesn't seems so. This is why I'm thinking to find alternatives to Drupal for my potential clients. I'm not sure that financially speaking would worth to develop an online community website in Drupal and pay a lot for hosting and development.


texts: How to get collapse text to open below admin menu?

texts:
I use the collapse text module on my site, when the collapsed text is longer than the screen the collapsed text header gets hidden under the admin menu when you open the collapsible. How can I make it so that it opens and then focuses the header to be just under the admin menu?

if you go to https://arupconsult.com/content/immunoglobulin-disorders/?tab=tab_item-2 and open one of the collapsibles you will see that the header is at the very top of the screen, and when I am logged in to the site the admin menu sites on top of it.

This is a screenshot of one of the collapsibles just opened while logged off.
Notice how IgM is right at the top of the screen.

This is a screenshot of the same collapsible just opened, but I am logged on.
Notice how IgM is now hidden below the admin menu.


texts: Do something after submit the form at hook_form_alter

texts:
I want to do something after I submit the node. How can I do that?

I use hook_form_form_id_alter(),but I dont know how to use callback function called after the user submit the form

function mymodule_form_node_form_alter(&$form,&$form_state,$form_id)
{
     if($form['#node']->type=="my_content_type")
     {
          $form['actions']['submit']['#submit'][]=my_callback_function;
     }
}

function my_callback_function($form,$form_state)
{
     //my code here!!
     //execute after the user submit the node form
     //and then redirect user to another place,after executing the code above

}

it doesn't work! and I don't know why?
Please tell me how can I do that?


texts: How to get a "node" value from URL using arg(0)?

texts:
I have this problem in getting a value from URL.

First I've created an url alias for a certain articles.

In example, from this /node/899 the alias I've created it's /news/investments/899

Then when I use arg(0) which is to get the value of first parameter which is "news" I get a result "node". The url alias works.


texts: Does Entity Autocomplete has database leak?

texts:
Lately in one of our prod database the "key_value" table became 2.4GB large.
When I took a closer look I could see that there is around 200 000 records in it, and 90% of them are entity_autocomplete collection. Then I searched the entity reference module where does it operate with the keyValue service and I found the following:

// \Drupal\Core\Entity\Element\EntityAutocomplete:129
   $selection_settings = isset($element['#selection_settings']) ? $element['#selection_settings'] : [];
    $data = serialize($selection_settings) . $element['#target_type'] . $element['#selection_handler'];
    $selection_settings_key = Crypt::hmacBase64($data, Settings::getHashSalt());

    $key_value_storage = \Drupal::keyValue('entity_autocomplete');
    if (!$key_value_storage->has($selection_settings_key)) {
      $key_value_storage->set($selection_settings_key, $selection_settings);
    }

The $selection_settings may contain the host entity as well (it's because of the self reference feature). This means based on the code: whenever you have a new entity or the entity updated your $selection_settings_key will always be different. Also it's added to the key-value table without expiration date which will end up as a permanent out of date record (after the entity changed / field config anyhow) in your key-value table. Also because it's serializing the whole entity the record itself can be quite big (talking about 10-12 KB).

Is this a bug or am I missing something?


texts: Create Content Types that create other node for fields

texts:
I would like to create a content type, say for example Podcast, that would have other pages for some of the fields.

A field_audio that is a file would automatically generate a /node_url/audio page, a field_transcript that is a Longtext would be `/node_url/transcript etc.

My initial hypothesis is to use a views page to set the path but I am really confused with the interface and how best to solve this problem.

EDIT

In order to clarify, I'll go step-by-step for the desired functionality.

A content type is configured to publish at domain.tld/podcast/podcast-title. This content type has a lot of fields that are removed from the display using Display Suite.

What I would like to do is to use URLs that automatically generate displaying content based URL parameters, similar to how Drupal tags do but for individual nodes.

Example website:
http://codepen.io/inkovic/pen/qEXJpo is the original content.
http://codepen.io/inkovic/pen/qEXJpo.css is the css
http://codepen.io/inkovic/pen/qEXJpo.htmlis the HTML and so forth.

I could do this manually with a contextual view + block on the actual node-url, but
Views -> Contextual Filter -> Content: Nid -> Content ID form URL would break if the url is different from the actual node.

So podcast/podcast-name/transcript would render a view based on the podcast-name part of the URL.

I do not want to create a custom content type of transcript, mp3, links etc and use Entity Relationship because that would ruin the content authoring experience.


texts: Does anyone know of a module like "Artsy Editor" for Drupal?

texts:
I'm looking for a writing interface similar to Artsy Editor which is built for Wordpress.

It's a "distraction-free" wysiwyg that I need for a client's site and thus far I've not been able to find one.

Does anyone have suggestions on an existing editor that I can use, or a way to use existing modules to achieve the same effect?

I'm really looking for a way to have a wysiwyg style interface similar to the new "notes" in the new version of basecamp.

The site in question is a Drupal 7 site.


texts:
I need to create a page with listed vocabularies and terms related to it in 3 columns.

Vocabulary 1       Vocabulary 2     Vocabulary 3
Term 1             Term 4            Term 7
Term 2             Term 5            Term 8
Term 3             Term 6            Term 9

If it's possible, I'd like to accomplish that by configuring a view. I'm not very good with custom code.

Do you have any idea?


texts: Theming a node reference field in a template file

texts:
I have two content types:

Course
Subject

The Course nodes have a field reference field which references a Subject node.

In the Course node display, I want to have access to the variables from the corresponding Subject node. I've set the field to render as 'rendered node', but I need to rearrange the fields from both nodes to construct a tabbed interface out of all of the fields available.

What's the best way to proceed?


texts: Is there a maximum number of views args?

texts:
I have an argument list of 300 or so UIDs which I'm passing to a view using hook_views_pre_view, and it dies on me. If I chop that argument list down to ~200 or so, it completes.

Is there a limit to the number of arguments, or is there a setting somewhere that is killing it?


texts: How can you automatically add CSS classes to  tags in the post body?

texts:
I'm trying to build a new Drupal site using the Tailwind CSS framework, which relies on inlining CSS classes onto HTML tags.

This is fine in Twig template files where I have direct control of the output and can add the required classes directly, however I'd like to automatically add classes to <p> tags (and probably some other, but <p> is a good start) within the body of certain post types.

Any idea where I should be looking?

I'm not entirely clear on what the correct terminology to search is, and Google returns plenty of results that are at least a decade old and not relevant for Drupal 8.


texts: How to decide between 'Hook_preprocessor' or using twig template?

texts:
We all know that for a customs web designing issue there are many solutions and various methods and ways,
but this question has always existed, i.e about what the advantages/disadvantages (pros/cons) of each of them are.

For example, by using hook_preprocess in the theme file we can add our desired styles to custom blocks or regions,
and reduce our needs to keeping multiple twig templates compared to times we use twig template to add our styles.

I want to be able to use those criteria (pros/cons) to decide which one is recommended in specific situations by considering indicators such as:

Stability
Efficiency and Loading speed
Maintenance


texts: how to add taxonomy vocabulary and terms through code

texts:
I have added some taxanomy vocabulary with terms in my local development server which I need in some modules. I want to get these vocabularies with terms auto inserted when ever I install these modules where I have used them. Is there a way I write some code in drupal module which inserts the taxonomy vocabularies and terms when ever I install the module.

Thanks for your suggestions.


texts: Unsupported Operand Types theme_image_style

texts:
I'm using the following code to generate a thumbnail and it's URI. The URI works on its own (though it 404's) but whenever I add theme_image_style function it gives a fatal error: "Unsupported operand types in /theme.inc on line 1088"

$image_fields_src = array_column($image_fields, 'uri' );

// thumbnail uri
$thumburi = image_style_path('thumbnail', $image_fields_src[0]);
// generate thumbnail
$thumbnail = theme_image_style('thumbnail', $thumburi );


texts: A view with research limited to a category (taxonomy)

texts:
I've a taxonomy which forms categories and subcategories. For each node, one of these category terms (vocabulary: categories) should be choosen, as well as other terms like "intelligent", "stupid", "bad" (vocabulary : definition).

Animals

Dog
Cat
Bird

Human

Girls
Boys
Robot

Insects

Arachnida
Crustacea
Trilobites

I would ike to create a view, with research field (filter by vocabulary: definition) for each category.

In other terms :

a view for "animals" where the user launch a research for  "intelligent", "stupid", "bad"
a view for "human" where the user launch a research for  "intelligent", "stupid", "bad"
a view for "Insects" where the user launch a research for  "intelligent", "stupid", "bad"

I cannot find the good configuration which allows to limit the research to a certain part of the vocabulary. Any idea? Thanks !


texts:
I use Ubercart Roles to manage access to parts of a member site, but I want to be able to keep track of users who's role has expired.

We have generic authenticated users, who are able to make purchases, but are unable to access member pages, and we have a 'member' role, that expires at the end of the year. At role expiration, I would like to have the 'member' role removed and an 'expired' role added. If they renew their membership from 'expired', I would like their role to go back to 'member'.

Is there a module that will help me with this?


texts: I'm using Drupal 7 to create a project linking organizations to volunteers. My initial approach is to use profile module to create different profiles for each role (volunteer & organization). Is it possible to create new fields which would attach only to a selected role?