texts: How to get notified by eMail after someone edited his own webform submission?

texts:
I have a webform, and I'd like to be notified whenever someone edited his own submits. I'm using the Webform module.

I found the Webform Rules module but I didn't get how to use it,
any way to set this up?


texts: View users contributed content in profile

texts:
I have users that have profiles using Profile2 module. I created a content type called Projects. A user can add a project, it has fields: title, description, and file. I would like to add a view to the users profile page that lists all of their Projects.

How can I connect the profile to the content author and use a contextual filter to get only that users content when viewing their profile?

Any help is greatly appreciated.

Edit: An example to clarify:
If user1 is logged in and views his profile he will see a list of his projects.

If user1 views user2's profile he will see a list of user2's projects.


texts: Post becomes unpublished upon editing it and no additional date values or image uploads are possible

texts:
I have a custom content with a large number of multivalue date fields (around 200-300 values). I created a node and added a large number of dates. When subsequently editing the post, the following occurs:

The post is saved as unpublished
Changes to the body field and other text fields such as tags are saved
No additional dates can be saved
Clicking on Preview doesn't show a preview, but saves the post as unpublished
Upon attempting to upload an image file, the Drupal message "[content-type] [post-title] has been updated" (with the specific values in place of the [...] placeholders) appears, but it appears BEFORE clicking Save; upon saving the post, no file is saved
"The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved." appears when clicking Save after the file upload
The node can be made Published from the content administration screen (but not from editing it individually)
The Revision tab is missing even though the content type has revisions enabled by default
The Authored on date is reset to the first time the node become unpublished

I would like to have some instructions as to how to debug this situation.

PS: The site is hosted on Hostgator.com.


texts: How to render a node image separately from the rest of the node content

texts:
I want to know the variable name for the image which renders with content; being more specific when I render my content with the following code:

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

It renders my node image, title, body, and tags. I want to put a <div> around my image, but I don't know how to specifically do it in my node.tpl.php. I found out how to render my tags, but I have no luck with images.


texts: How to delete or hide any trace of drupal in source code

texts:
Well I'm working on a government website that needs a lot of security insurances! the security thingy guys keep saying that there are couple of Drupal name in the source that shouldn't be there!

So far I changed Drupal Meta Generator but still there are some javascript files and Drupal. Settings that still shows up in the source code. Here's what I'm referring to:

jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"stme","theme_token":"tytMMj0EavWD-6KgUbjQYEmSyk35cF3mwLTcqBKhO5U","js":{"misc\/jquery.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"misc\/ui\/jquery.ui.core.min.js":1,"misc\/ui\/jquery.ui.widget.min.js":1,"misc\/ui\/jquery.ui.button.min.js":1,

this is just a part of the code between  tag, What I need is to change jQuery.extend(Drupal.settings to something else and also change the name of drupal.js .

I have no idea that could it have any side effects if I manage to make it? and before all how am I be able to do these changes?


texts: API function commerce_order_build_content was deprecated, but I couldn't find one that was supposed to replace that. How do I drupal_render() a loaded commerce order? As of now, I'm getting "call to undefined function" commerce_order_build_content


texts: How to grant access to specific nodes to anonymous users?

texts:
My site has a front page, an 'about us' and 'T&C' pages which are all created as 'basic page' types, and I want to allow anonymous users to access them. I have tried this hook below, but it does not seem to work because I am always redirected to the login page (using LoginToboggan if that matters).

function mymodule_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : $node->type;

  if ($type == 'basic page' && $op == 'view') {
    return NODE_ACCESS_ALLOW;
  }
  else {
    return NODE_ACCESS_DENY;
  }
  return NODE_ACCESS_IGNORE;
}


texts: Does Drupal have a collaborative editing module?

texts: What I would like to offer my users is the ability to propose a writing project to a group of people (users and non users) and the people who want to join the writing project are able to edit the same node together in separate locations.


texts: Drupal 8 - how can I print a single field value in overridden field--node--title.html.twig template

texts:
I created a content type "Troubleshooting Options". I want to render the title of this content in a different way. To do this I overrode default field--node--title.html.twig with field--node--title--troubleshooting-options.html.twig (as recommended by twig debug).

I am unable to render the title in this new template. Tried {{ content.title }}, {{ node.title }}, {{ node.title.value }} but none worked. Although drupal caching is disabled I rebuilt cache every time.

Twig file name suggestions:

<!-- FILE NAME SUGGESTIONS:
   * field--node--title--troubleshooting-options.html.twig
   x field--node--title.html.twig
   * field--node--troubleshooting-options.html.twig
   * field--title.html.twig
   * field--string.html.twig
   * field.html.twig
-->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/field/field--node--title.html.twig' -->

I am very new to Drupal.


texts: How to import (stream) data in Drupal and save the visualization as nodes - similar to datamasher.org)?

texts:
I am working on a data visualization Drupal website. I am looking for a functionality close to datamasher.org, a site that was built using Drupal.

But I cannot find a way that would allow me to create the same functionality.

My Question: How to import data/stream data in a Drupal site and save the visualization as nodes?


texts: How to create a name-surname structure for taxonomy terms?

texts:
I have a content type book and it has a taxonomy term reference field: author

I want to enter name and surname separately for each author on node add/edit page. Name and surname together will be the taxonomy term.

If I enter John for the name and Smith for the surname the taxonomy term will be John Smith.

I want to display the author name as surname, name in somewhere and in some other place I want to display as full name [name + surname].

I know I can add custom fields to taxonomy terms and use the Automatic Entity Label module to combine name and surname for term name but I want to create this structure for node form without editing the taxonomy term on taxonomy term edit page.

I was using a method like this but it is useless for this case.

How can I create a name-surname structure for taxonomy terms on node form?

Note: This question is not a duplicate of "How to reference existing term if it exists or create new one if not exist via Inline Entity Form module?" ... even though they use the same image. In this question the main point is how to create a name-surname structure on node form, in the other question "how to combine creating new term and choosing existing one options" is asked.


texts: How "webform access group entities" block content take me to the webform results submissions page directly?

texts:
I installed the ' Webform Access ' Module on my website in order to control access to submissions by users with a certain role.
I create a type of content called "Career" and a webform for the career.
I add some content and I select the webform in each node. In the webform access section under (/ admin / structure / webform), I add a new "add access group", I fill the (LABEL / USERS / NODES / PERMISSIONS) with a node titles ( e.g. : Full stack developer, Drupal developer ) and the username (e.g. : David) with role "Lead Full Stack". After that and in the Block layout, I add the (Webform Access) block in my content section and I displayed just in (/user/*) pages. Now, when David logs in he can see the titles of the nodes that I assigned to him previously in the" access group". When he clicks on a title in the list, a view page opens and displays content of the node (/node/{nid}). I want that the list of titles take him directly to the results submissions page ( /node/{nid}/webform/results/submissions). How can I do this?

Expected result:


texts: How to implement autocomplete for address field using google places/maps api?

texts:
When using Eventbrite event creating form, i noticed their address field has an autocomplete feature powered by Google.
Is there a Drupal module that does something similar ?

Demo link on Google Code


texts: Database 4 byte UTF-8 support not properly checking

texts:
In the status report of my drupal website I got the message that I had to up Database 4 byte UTF-8 support. I updated all my tables and database like it's told here: https://www.drupal.org/node/2754539. I checked and all my tables and the database have utf8mb4 encoding and utf8mb4_general_ci collation.

I get the following warning:

  Enabled, but database tables need conversion Please convert all
  database tables to utf8mb4 prior to enabling it in settings.php. See
  the documentation on adding 4 byte UTF-8 support for more information.


texts: Is there a way to alter a node save confirmation form?

texts:
I would like to add a confirmation form that is presented to a user on node update/delete operations triggered through the UI.

Specifically, I would like the form to present more than two choices for the user. i.e. instead of Submit/Cancel I would Option A/Option B/Option C.

Is this possible?


texts: Transferring default user picture field to new user picture field

texts:
Drupal 7.

I have a site where users can upload a picture of themselves (default Drupal field: user picture.) This field is used in different views.

I would like to use the User Picture Field module and use the field provided by the module instead of the default Drupal user picture field.

Switching fields in the views is a simple operation and it works well with newly uploaded pictures. However, with pictures uploaded before the installation of the module, the pictures displayed are no longer the users' pictures but the default "no photo" image.

Is there a way to have the (older) photos of the default user picture field transferred to (or at least displayed by) the new field?

Thanks. :)


texts: I created a view to show a nodes image field (unlimited values) and placed that views block into a panel page region. For some reason the pager doesn't show up. I googled around but cant see any others having these issues. All the associated images are shown on the page instead of the 6 i set up in views.


texts: How do I add a text field that links to the taxonomy_index table

texts:
When I add a taxonomy tag to a node, I also want to be able to add 1 (or more) text fields specific to that tag and that node. I know how I would set up the underlying db table (compound foreign key of nid and tid with a many-one join to the taxonomy_index table, a primary key and a text field).

How would I implement this? Or does a module already exists that has this functionality?

I am fairly new to the world of Drupal so unsure if this would require writing a module, adding a new content type or another approach entirely.

Many Thanks,
Pete


texts: slide through nodes from the same content-type?

texts:
I've got a content-type called design_portfolio, and created an amount of fields

I've created a view (using the Views module) of only the the field 'thumbnail-design'-image, which is sorted on taxonomy terms in the header

which gives me the next result on the front-end

Each 'thumbnail' links to its' own content, which is a node from the content-type 'design_portfolio' and gives me this result (I wrote a file 'node--design_portfolio.tpl.php' to style the pages for this content-type). Each thumbnail directs to another content within the content-type 'design_portfolio'

Everything what I have right now is working properly and has to stay, but what I want to achieve right now is,  the posibillity to slide through all the pages/nodes of just this content-type 'design_portfolio'. Like this:

I've allready tried to achieve it with creating a view with 'views slideshow'. Which gives me a good result, but when I click on my thumbnail, it still goes to the corresponding content (page/node), but not the the slideshow that I've created. I want every link to direct to the corresponding slide, because every thumbnails has it's own content.

settings of field thumbnail-design in my first view

inspecter to target a specific link of one slide in the slideshow (created of all content from content-type design_portfolio, used 'views-bootstrap-carousel')

Any solutions for my problem?


texts: Popup with the content of the exposed date field

texts: I am using "Webform Views Submitted Data" module to show webform submissions report with views. I have one expose filter name "Webform submissions: Submitted" which will give two date options; start date and end date. How do I select the date i want to filter by in a  popup calender?


texts:
I've got a custom function which overrides the menu links for a specific menu so I can put my own custom classes into it (see below).

function MYTHEME_menu_link__menu_footer_links_1($variables){
    $elements = $variables['elements'];
    $node = menu_get_object(); //Get the node object for page being rendered
    $field_department = field_get_items('node', $node, 'field_department'); //Get value of "field_department" field

    //"field_department" exists in this node
    if($field_department !== false){
        $dept_page = is_dept_page($field_department); //Returns true or false

        //Add CSS classes to the anchor tag
        if($dept_page !== false){
            $elements['#localized_options']['attributes']['class'][] = "dept-bg-col";
            $elements['#localized_options']['attributes']['class'][] = "dept-men-col";
        }
    }

    $sub_menu = '';

    if($elements['#below'])
        $sub_menu = drupal_render($elements['#below']);

    $output = l($elements['#title'], $elements['#href'], $elements['#localized_options'] );
    return '
' . $output . $sub_menu . "
\n";
}

This I believe also calls itself if a specific menu item has any nested menu items too to generate those.

I've also got another function which wraps the list item HTML generated here in a  tag (see below)

function MYTHEME_menu_tree__menu_footer_links_1($variables) {
    global $cur_level;
    $cur_level++;

    return '
' . $variables['tree'] . '
';
}

As you can see this second function adds a menu-level-{number} class but they are being numbered backwards, so the most inner  gets the class menu-level-1 working it's way up the numbers until the top level  gets the highest number.

I'm trying to basically make the numbering go the other way around so the top level gets the class menu-level-1.

I think the reason it is numbering like this is because the first function calls itself & the second function on any nested lists. So the most deeply nested list calls the second function first and as a results gets menu-level-1.

Can anyone thing of a solution to this? Or is there an easier way altogether to get this done?


texts: How to save and append comment form without refresh the page in drupal 7

texts:
I have a form with comments but this page have counter to cout views of this page.

but every time when comment added on this page that page loaded and my counts increasing
  after comment added.

but i want to count views when page load first time not by comments module  in drupal 7.


texts: how do I return a count of items returned from an entityfieldquery

texts: Is it possible to return a count of the number of items returned in an entityfieldquery query?


texts: Views Log Error after upgrading to Drupal 7.43: "Undefined index: args in DatabaseLog..."

texts:
After upgrading from Drupal 7.41 to Drupal 7.43, I found that my Views are producing the following notice error when using PHP contextual filter code:

Notice: Undefined index: args in DatabaseLog->findCaller() (line 156 of .../includes/database/log.inc).

By debugging, I know that this is produced by PHP contextual filter in Views. Specifically by line 53 of views/plugins/views_plugin_argument_default_php.inc

Below is my PHP contextual filter code:

$filter = array();
if (module_exists('mymodule')) {
  $url = drupal_get_path_alias(current_path());
  $query = db_query(
  'SELECT cp.contact_person_id
   FROM {mymodule_table} cp
   WHERE cp.website_section_url LIKE :url_to_find', array(':url_to_find' => $url));
  foreach ($query as $row) {
    $filter[] = $row->contact_person_id;
  }
}
return implode('+',$filter);

The SQL query works correctly.The view is a Block.I am using the latest Views 7.x-3.13 version.

What could be happening?


texts: How to add margin between columns with Drupal Bootstrap View Grid

texts: I need help I'm trying to add some margin between columns using drupal Views Bootstrap module the grid view but the columns are closed together. How can I add margin between columns. I have tried through the module settings but there isn't any option to. How can I achieve this?


texts: Is it possible with one of the template suggestion hooks to also specify a new template location?

texts:
In a custom module I'm adding a custom page template suggestion per multi-site like following which would then search for page--MYSITE.html.twig in the current theme's /templates folder.

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function MYMODULE_theme_suggestions_page_alter(array &$suggestions, array $variables) {

  $site_path = \Drupal::service('site.path');
  $site_path = explode('/', $site_path);
  $site_name = $site_path[1];

  $suggestions[] = 'page__' . $site_name;
}

Question: Is it possible to also specify a new location for this template. Like let's say inside my custom module's /templates folder?

Why: It would let me use a core theme but with my custom template (without the need to add something custom to core or to create a new sub-theme, lazy as I am).

There are 3 suggestion hooks that come into my mind but with none if them it seems possible to also specify a custom location. Is this right? Or is there a way? Is it bad practice to do so?

hook_theme_suggestions_alter
hook_theme_suggestions_HOOK_alter
hook_theme_suggestions_HOOK


texts: Is there a way to easily add image swap/rollover to images on a Basic Page?

texts: I would like to do some simple image rollovers on a Basic Page, without having to write a bunch of individual CSS cases for each specific image. (Ie. - swap Img1 for Img2 on mouseover.) Is there an easy way, or a useful module that anyone knows of?  I didn't find anything on drupal.org.


texts: Custom target URL for Views content pane exposed filter (block)

texts:
Here is the situation:

There are 2 pages in Page manager

Overridden page of the Taxonomy term (i.e. Path: /%term )
Page with Taxonomy term filters (i.e. Path: /%term/filter )

And a View with 2 displays (content panes) :

Show all from term
Show filtered (with exposed filters in block).

How to place the exposed filter block on /%term page but when the filter is submitted,  redirect and apply it to the /%term/filter path ?

Thank you


texts: Views Eposed filter - proximity search, include content without a postal code

texts:
I have a proximity search set up using gmap location by postal code. Using Drupal 7/Views 3.
The exposed filter allows the user to filter by (taxonomy)type and/or postal code.

This is what I need to Do: Include some content that will not have a postal code in all results. I already set up a view of this content (without postal code) to display as no results behavior.  but I would like to include this same content in all searches. How do I do this?


texts:
I am looking forward to use Drupal in order to create a knowledge-base website having a structure as shown below. Therefore, each time a knowledge area is selected, Drupal should automatically filter the related sublevels and display them as a list.

Q1 : Could anyone please help me in knowing what taxonomy/terms configuration i should use to solve my issue ?
Q2 : Are (many-to-many) relationships represented by red lines supported by Drupal ? If Yes, how could that be done?


texts: What causes 'sites/default/files is not writable' during Drupal 7 Install on Redhat w/ Apache?

texts:
I am attempting to install Drupal on Linux Redhat using Apache, but it will not allow me to pass step 3 due to the fact that sites/default/files is not writable.

I have followed the instructions on Drupal.org, in their install.txt file as well as the instructions from others who have had the same error with no success.

I have granted permissions access all different ways, i.e.: root:root 777, root:apache 777.

I have also verified that Apache is the user running the Apache process, but I am still stuck.

Notes:

I have granted the user 'apache' 777 rights to the files folder with no luck.
I verified the user 'apache' is in fact the user running apache.
I was able to complete the installation of Drupal on Windows.

Any new ideas?


texts: Cannot replace html.tpl.php with new template in a single module

texts:
I am creating a module to handle the reformatting of pages for printing in D7.

The structure of the URL is: /print/{nid}

I need to use a separate template than html.tpl.php as I have to get rid of our global header/footer but I still need our javascript and css to load.

I'm at a loss for how to correctly implement this.

I have created a menu_hook, otherwise I get a 404 page

I have tried using the $vars['theme_hook_suggestions'][] = 'html__print'; but I get no output

<?php
// print.module
function print_menu()
{
    $items  = array();

    $items['print/%node']   = array(
        'title' => '',
        'access arguments' => array('access content'),
        'page arguments' => array(1),
        'page callback' => 'print_process_print',
    );

    return $items;
}

function print_process_print(&$vars)
{
    error_log(__FUNCTION__.' called');
    error_log('node: '.var_export($vars, true));

    $vars['theme_hook_suggestions'][]  = 'html__print';

}

My template file is: sites/all/themes/zen/templates/html--print.tpl.php

Any help is greatly appreciated.


texts: Form token wrong if logging in during rebuild

texts:
I have a multi-step form using AJAX. When you submit the form it increments the step, and then sets $form['#rebuild'] to TRUE, and the entire form is replaced by AJAX.

It works fine, right up until one of the steps involved calling user_login_finalize() in the submit handler - the user can go from anonymous to logged in. Then when it tries to build the next step I get the error:

  Form errors cannot be set after form validation has finished

I puzzled over this error for a while. I thought the validation handler might be firing twice, but then I saw in the debug trace that setInvalidTokenError() is being called in FormBuilder->doBuildForm().

After looking in doBuildForm(), I think the problem is that Drupal thinks the form is being submitted in a naughty way or has the wrong token. What can I do?


texts: Populate a field with the sum of two fields while content creation

texts:
I have a content type named "ABC". Which has three fields

field_half(widget type list(text)),
field_full(widget type list(text)),
field_total(widget type float).

During content creation I want the field_total to be populated with the sum of two fields field_half and field_full.

E.g.

`field_total` = `field_half` + `field_full`

How can I do this.


texts: Replace default submit handler when using drupal_get_form() in D7

texts:
I'm having issues calling an existing form from the commerce_coupon module which runs a default submit handler callback (commerce_coupon_form_submit).

My form builds off of that form and simply tries to replace the default '#submit' value to call my own submit function instead of the default commerce_coupon one. I'm using drupal_get_form so my code looks like the following:

$form = drupal_get_form('commerce_coupon_form', $coupon);
$form['#submit'] = array('mymodule_coupon_submit');
return drupal_render($form);

That is the code from inside a function that is supposed to return the rendered form. The problem is the default commerce_coupon_form_submit submit handler is still running and my own function doesn't get called. I think this has something to do with the form_id or form_state still being commerce_coupon_form.

I've found related problems on stackexchange but responses were directed for other versions of Drupal. I'm using D7 so please bear that in mind.

I'm adding a little more detail that may help get a better answer for this. The original commerce_coupon_form seems to try to use a button-level #submit handler as there is the following before the form is returned:

$form['actions'] = array(
    '#type' => 'container',
    '#attributes' => array('class' => array('form-actions')),
    '#weight' => 400,
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save coupon'),
    '#weight' => 40,
  );

but the actual #submit handler isn't assigned so the default drupal handler is being set at the root of the form. I've tried assigning a button-level submit and overriding the root drupal assigned submit to a blank array but that doesn't seem to work. I'm trying to track down documentation for drupal or the function that sets the default #submit so I can figure this out. If you can point me in the right direction I would appreciate it.


texts: How do I show a label instead of the value in a custom autocomplete?

texts:
I am building a custom autocomplete field. It worked as in when I type 'a' it shows me all the list of fruits with letter 'a', but when I click on any of the options. I see the autocomplete field 'value'.

When users type a, it should show Apple, Avocado. Clicking on any of them, it should show Apple, not fruit-1 in the field.

This is the code I am using.

Form

namespace Drupal\custom_google_search\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;

class GoogleSearchAutocomplete extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'custom_google_search_autocomplete';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['google_places_search'] = [
      '#type' => 'textfield',
      '#title' => t('Searchfield'),
      '#autocomplete_route_name' => 'custom_google_search.autocomplete',
      '#value' => 'aaa11',
    ];
  $form['search_in_us'] = [
    '#type' => 'submit',
    '#value' => $this->t('Search'),
    ];
      return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {

  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {

  }
}

Autocomplete controller

namespace Drupal\custom_google_search\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\Tags;
use Drupal\Component\Utility\Unicode;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

class AutocompleteController extends ControllerBase {

  public function handleAutocomplete(Request $request) {
    // Get the typed string from the URL, if it exists.
    if ($input = $request->query->get('q')) {
      $typed_string = Tags::explode($input);
      $typed_string = Unicode::strtolower(array_pop($typed_string));
      $trimed_string = preg_replace("/\s+/", "+", $typed_string);
      $results = $this->showRelatedPlaces($trimed_string);
    }
    return new JsonResponse($results);
  }

  public function showRelatedPlaces($trimed_string) {
    try {
       $results = [
         [
           'value' => 'fruit-1',
           'label' => 'Apples',
         ],
         [
           'value' => 'fruit-2',
           'label' => 'Apricots',
         ],
         [
           'value' => 'fruit-3',
           'label' => 'Avocados',
         ],
       ];

      return($results);

    } catch (RequestException $e) {
    return($this->t('Error occured.'));
  }
 }
}

Problem is that when I type a in the autocomplete textfield, it shows the fruits label (Apple), but when I click on the fruit label, the field value shows fruit-1. I want to show Apple when users select Apple.

PS: I don't want to use the same value for label and value.


texts: Select an Image style depending on external/dynamic factors (theme region or other field content)

texts:
I have a Bean (bundle that generates blocks) which I display in one of 2 different theme regions. Either in the header, or the footer. This Bean contains an Imagefield, which is rendered through an Image Style.

I would like to be able to display the Image using a different Image Style, depending on which region the Bean is being displayed in. For example, if the Bean is being displayed in the header region, then I want the image to be rendered in style A. If it's being displayed in the footer then the image should use style B.

So - how can I select the Image Style that is used for an Image Field depending on which region the content is being displayed in?

One option would be to add another field to the Bean which would be a 'Style selector', however this introduces another step for the site owner as then then have to manually specify which style they want to use. It would be better if this were done automatically based on where the content is being displayed. However, if this can't be done, then how would I adjust the Image Style based on the value of another field?


texts: Why i get the error "Call to undefined function node_object_prepare()" while i try to add a node programmatically in Drupal 7?

texts:
i'm trying to add a node content programmatically from a custom module file. I have created the .module file and used this code as suggested:

$node = new stdClass(); // We create a new node object
$node->type = "page"; // Or any other content type you want
$node->title = "Your title goes jere";
$node->language = LANGUAGE_NONE; // Or any language code if Locale module is enabled.
$node->path = array('alias' => 'your node path'); // Setting a node path
node_object_prepare($node); // Set some default values.
$node->uid = 1; // Or any id you wish

// Let's add standard body field
$node->body[$node->language][0]['value'] = 'This is a body text';
$node->body[$node->language][0]['summary'] = 'Here goes a summary';
$node->body[$node->language][0]['format'] = 'filtered_html'; // If field has a format,  you need to define it. Here we define a default filtered_html format for a body field

$node = node_submit($node); // Prepare node for a submit
node_save($node); // After this call we'll get a nid

but when i enable the module what i get is an error saying "Call to undefined function node_object_prepare()"

Thanks.


texts: How to manage the order of the modules execution?

texts:
I have a 2 modules which has javascript files modify the height of an element (through jquery).

module one set the height to 100px
module two set the height to 200px

I seems like the module one is fired after module two. I need the js file of module two to be fired after the js file of module one. This is to change the weight of the js files.

I included the js file in the module_one.info file like this:

scripts[] = js/myfile.js

Can I do this?

Should I add the js files in myTheme.info ?


texts: Add the user picture before the username in user listings?

texts:
I'm trying to add the user picture before the username in user listings. I've copied theme_username into my template.php and I'm trying to call theme with the argument 'user_picture' in order to get the HTML that will render the picture, but the call just returns an empty string. I'm providing the uid as the argument. Where am I going wrong?
Thanks.

function MY-THEME_username($variables) {
  if (isset($variables['link_path'])) {
    // We have a link path, so we should generate a link using l().
    // Additional classes may be added as array elements like
    // $variables['link_options']['attributes']['class'][] = 'myclass';

    // I ADDED THIS LINE

    $output = theme('user_picture', array('account' => $variables['account']));

    // ENDS

    $output .= l($variables['name'] . $variables['extra'], $variables['link_path'], $variables['link_options']);
  }
  else {
    // Modules may have added important attributes so they must be included
    // in the output. Additional classes may be added as array elements like
    // $variables['attributes_array']['class'][] = 'myclass';
    $output = '<span' . drupal_attributes($variables['attributes_array']) . '>' . $variables['name'] . $variables['extra'] . '</span>';
  }
  return $output;
}


texts: How to tell variable_get to get the value from the database and not the $conf array?

texts: variable_get seems to always used $conf array which is fetched a single time.  In a long running process where the value of a variable may have changed during operations this causes problems.  Is there a simple mechanism in Drupal to tell variable_get to refetch the array from the database rather than using the in-memory variable?


texts: Decoupling Drupal 7 from Ubuntu/Debian package management

texts:
I'd like to decouple my Drupal 7 installation from the OS package management.

This is because Ubuntu's current LTS version (14.04) has Drupal 7.26, imported from the Debian packages at the time of release - it's now fixed at that version and they won't move to a later one.

Some security fixes have been backported, but not necessarily all. This is mostly due to policy issues with regards to software versions within the Ubuntu project, so the best solution is to reinstall my Drupal instance so that it's not under the control of the package management system.

I've been looking for information on this for a few days now, and can't find much of use.

I have the Backup and Migrate module, so can use that. I also have drush installed (albeit, ironically, via package management).

I can't get drush to update Drupal at all. My experience here (remembering back to Drupal 6) is that the Ubuntu package management has set some kind of flag that means Drupal doesn't check for updates for itself, only for modules & themes. "sudo drush up drupal" results in "specified project not found" for the drupal project.

Drush is updating modules and themes OK, just not core - so I believe I can probably install via drush.

My current plan is this:

Perform a backup (drush bam-backup)
Stop apache (service apache2 stop)
Remove the packaged version of Drupal (apt-get remove drupal7)
Install Drupal (drush dl drupal)
Restart apache (service apache2 start)
Restore the backup (drush bam-restore)

Does this look OK? Will I need to do anything between steps 4 & 6 (like set up the website system again)? Or am I approaching this the wrong way entirely?


texts: Is there a way to add a wrapper class to my blocks?

texts: While views does a great job of placing blocks and content on a page, I am trying to make my website responsive. It is true that the blocks are responsive. I am just trying to make it so that the blocks take up a percentage of the screen rather than go below another block when the screen shrinks. I found a way to do this using CSS, but I would rather use standard Drupal methods so that my users can edit content. There is a nice module that lets you define a class on each block, and I am using it. I am just wondering if there is something similar so I can define a wrapper of several blocks. I am using Drupal 7.


texts: How do I show the publishing date instead of the creation date?

texts:
When I create an article and I don't publish it, so I could edit the article later and publish it when it's finished, I notice Drupal shows the creation date, not the publishing date.

Is there a way to change it so the items on the front page show their publishing date and not the creation date? Is there a different field in the database for that functionality?

I am using the Workbench module, which gives draft nodes. If nodes are not published, it will display them in a draft list.


texts: Drupal 7 FAPI: When is the 'committed' flag set?

texts:
I built a custom form using FAPI in Drupal 7 that suddenly stopped working. (It's in a development area, so someone could've introduced something that inadvertently interfered.) I found that the submit handler was never called, due to $form_state['submitted'] being false. I assume that normal (non-AJAX) submit is supposed to set this flag, but I've grepped and stepped through the code and can't find where it's done. (Working on the assumption that if I found where it's set, I can maybe find out why it's never getting there...)

I was able to get things working again by setting the flag myself in the validation routine after a value came back that I know means the user is done. But this seems like a terrible hack, and may have unintended consequences down the road. I don't see any other modules doing this.

Can anyone tell me where this flag is set, so I can try to backtrack and find out what happened?


texts:
How can I remove the Generator meta-tag in Drupal 8?
<meta name="Generator" content="Drupal 8 (https://www.drupal.org)" />

Can this be done with few lines of code?


texts: How do I fix this commerce_auction_node_presave error message?

texts:
I am working on a reverse auction for our youth group.  I'm using D7 with the commerce_auction module.   I ran into the error below when setting up the content type for the auction:

Notice: Undefined offset: 0 in commerce_auction_node_presave() (line 260 of /public_html/catz/sites/all/modules/commerce_auction/commerce_auction.module).
EntityMalformedException: Missing bundle property on entity of type commerce_product. in entity_extract_ids() (line 7697 of /public_html/catz/includes/common.inc).

for the first notice, line 260 contains this: $product_reference = $product_reference[0];

Does anyone know how to fix this error?  There's not a lot of commenting as yet on this auction module, so I can't find a solution.

/**
 * Implements hook_node_presave().
 */

function commerce_auction_node_presave($node) {
  $types = variable_get('commerce_auction_display_types', array());
  if (in_array($node->type, $types) !== FALSE) {
    $product_reference = field_get_items('node', $node, 'field_product');
    $product_reference = $product_reference[0];
    $product = commerce_product_load($product_reference['product_id']);
    $price = field_get_items('commerce_product', $product, 'commerce_price');
    $node->auction_starting_price[LANGUAGE_NONE][0]['amount'] = $price[0]['amount'];
    $node->auction_starting_price[LANGUAGE_NONE][0]['currency_code'] = $price[0]['currency_code'];
  }
}


texts:
I'm trying to have submenus like the ones that can be seen on http://marinelli.netsons.org in Cameras menu item.

Could anyone point me on how can I achieve that? I don't know how to create the sections that can be seen in that submenu.


texts: Bulk editing of Fields on multiple entities

texts:
What is the best way to do the following?

Open up a page that does a form callback from hook_menu
Based on a URL arg, load all entities (probably with EFQ) with that argument
Present certain fields on the entities to edit, with one Submit button at the bottom
On Submit, each of these are processed and saved within their respective Entities

As a bonus, it would be great if the form output each set of fields in a tabular format, like editing a grid (without jQuery plugins needed).

The first two I can do, but I am not seeing seperation of entity data in the form submit data (knowing which data goes with which entity_id).

What I am trying to do is provide a quick way of editing game results line by line (Team A (score_home property) vs Team B (score_away property)).


texts: can't change the value of ONE button (search page SEARCH button)

texts:
I have succesfully changed the search button text of the block but can't seem to get to do this on the search page

on the following form_alter both forms enter it and are set but only search_block_form gets affected

function MODULE_NAME_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if(in_array($form_id,["search_block_form","search_form"])) {
    $form['actions']['submit']['#value'] = "Custom Search Value";
  }
}

I have also tried doing it with function hook_preprocess_input($vars){ and also tried to set the weight of the module to run later than others

function MODULE_NAME_install(){
  module_set_weight('MODULE_NAME', 1000);
}

but I see no difference I had to resolve this using javascript
what am I doing wrong ?


texts: Author who is not a user - Does a module exist?

texts:
I am about to write a custom module to allow for non-user authors (called Authors for the rest of this question).

Use Case is really the corporate website

Person publishing content to the website is not the author
Actual authors are many and potentially multiple on a specific article
There is no reason to create the authors as users on the CMS

Functional suggestions/ideas

When editing an article the editor can select one or many "Authors"
for the article.
If none is selected then the creator of the article
is displayed as the Author.
Author would be used in place of User
when article displays on the front end.
If configured Authors would
have a block on a node showing Author content fields (image, role
...).
Users can be associated with an Author through an Entity
reference field.
Re-use profiles on corporate About the Team page

Am I crazy, does a module exist, should I just create them as system users with no privileges and use an existing module? Just seems wrong to give manage users rights to website editor so that they can edit these profiles.


texts: How to add 'add to cart' button in custom content type using Commerce 2?

texts:
I have created a new content type with product title, description, price(field_price), SKU(field_sku) fields. I just want to add a Add to cart button into this content type.

What I tried?
I have read many places, it says to add 'Product references'. I have tried to do that using 'Entity reference' field and selected 'Product'. But no luck.

Can someone guide me step by step about how can we add such 'Add to cart' button in custom content type?


texts: Input field not submitted in form when added through JS

texts:
I have a form that is processed first by an external service through JS and afterwards adds an input field to the form:

$('#my-form').once('submit').submit(function(e) {
  // some processing
...
  form.append($('<input type="hidden" name="token" />').attr('value', token.id));
  form.unbind();
  form.submit();
});

The field is added and also has the correct value. But when it is submitted the field is not present in neither my
 public function validateForm(array &$form, FormStateInterface $form_state) nor in public function submitForm(array &$form, FormStateInterface $form_state).

I already tried using a textfield instead of type hidden, and hide it with css, but same result


texts:
I can find the comments template
at modules/comments/comment.tpl.php

But where is the  comment Form Template please?

I want to add a users image next to the form

Thanks for your help

Charles


texts: getpreventdefault is deprecated - Caroussel stopped working

texts:
I have a caroussel slide made with a view and it was working fine until today. The block (with a view inside) just dissappeared from the front page.

I aggregated js files in the performance page... maybe that was it. But now I uncheked the option and cleared the cache many times and is still not working.

I'm getting this error from the console: Use of getPreventDefault() is deprecated

Does it has something to do with it?

Jquery update is 1.10


texts:
Whenever I try to run cron on the search, using

drush php-eval 'search_cron();'

I get 'Segmentation fault' error. I have not this problem for any other tables. The site contains hundreds of text-heavy nodes. So I appreciate your hint to cope with the problem.


texts: How to make Drush rsync @dev @staging exclude some directories?

texts:
I am using the following drush commands to synchronize development and test environments.

drush rsync @dev @staging
drush sql-sync @dev @staging

How to setup drush to exclude certain directories (such as sites/all/modules/devel ) from this synchronization process ?
I don't want devel module and some other modules to be included in staging environment and would like drush to automatically take care about this requirement.


texts: Show a field only once if the value is the same

texts:
I have a content-type with a field "Shooting Date" of type "date".

I have a block-view which collects all nodes of this type.

I sort these nodes by "Shooting Date".

I now want to display the year at the top, then all elements in this year.

E.g.:

2017

-Node 1

-Node 2

-Node 3

2016

-Node 4

What I have by default ist:

2017
-Node 1

2017

-Node 2

2017

-Node 3

2016

-Node 4

Can anyone tell me how I can show the year only once if the value is the same?


texts: Contextual filter that lists users who share a taxonomy term with current user?

texts:
I have a view that lists all user profiles. At registration, every user selects, from a 'sector' taxonomy, the sector they themselves do business in. They also select from the same 'sector' taxonomy to record what sectors they want to do business with. So their user profiles may look like this:

uid: 1
name: fred
sector in: arts
sectors to do business with: tech

uid: 2
name: alex
sector in: tech
sectors to do business with: design

I want a view to list all the users that do business in the sectors that the current user wants to do business in.

So, using the above profiles, if Fred was looking at the view, Alex's profile would be displayed because the filter would be:

sector == tech

Obviously, the filter needs to be dynamic. It needs to grab the 'sectors to do business with' field from Fred's user profile. I think I need a contextual filter, but how do I configure it?

Thanks


texts: Display event on click of Date with drupal fullcalendar module

texts:
i have made a event calendar with fullcalendar module.

Now what i need is that when a user clicks on the date box for example 9-sept he should be send to a custom url with the full date in the URL.

And i need to highlight the date boxes with colors based on my event type.

Any clues ?

thanks


texts:
How do I remove all the classes that are being added to the body tag? Currently my body tag is :

<body>

This however is rendered as

<body class="lightbox-processed admin-nw admin-vertical admin-df">


texts: Upgraded to 8.8.3 and now all of my modules say "No available releases found"

texts: I just recently updated to 8.8.3 and for some reason, all of my modules now say "No available releases found". Also the one module I had that did report "No available releases found" (Video Embed for google drive), is now saying that that module is up to date. It is like they switched somehow when I updated. I might roll back but the site is currently working just fine. Any ideas?


texts: How to repair "Mismatched entity and/or field definition" when "drush entity-updates" fails?

texts:
I'm developing a site in Drupal 8 in Acquia Dev Desktop 2 on Windows 10. After updating to 8.5.0-beta1 I noticed this error on my status page (although it may have been there earlier in 8.4.4):

ENTITY/FIELD DEFINITIONS
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Custom menu link
The menu_link_content.field_most_common_name field needs to be updated.

It's possible this error came from the Menu Item Extras module, which I had installed a couple of months ago, but since deleted.

Following popular advice, I ran drush entity-updates. That did not cure the problem. The output (typed manually) from my CMD window is below:

menu_link_content entity type :
  The menu_link_content.field_most_common_name field needs to be updated.
Do you wish to run all pending updates? (y/n): y
Drupal\Core\Entity\EntityStorageException: Exception thrown while
performing a schema update. SQLSTATE[42522]: column not found: 1054 unknown
column   [error]
'field_most_common_name_argument' in 'where clause': SELECT 1 AS expression
FROM
{menu_link_content__field_most_common_name} t
WHERE (field_most_common_name_target_id IS NOT NULL) OR
(field_most_common_name_display_id IS NOT NULL) OR
(field_most_common_name_argument IS NOT NULL) OR
(field_most_common_name_title IS NOT NULL) OR
(field_most_common_name_data IS NOT NULL)
LIMIT 1 OFFSET 0; Array
(
)
 in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException()
(line 1535 of C:\Users\Nick\Sites\devdesktop\drupal\core\lib\Drupal
\Core\Entity\Sql\SqlContentEntityStorage.php).
Failed: Drupal\core\EntityStorageException: !message in
Drupal\Core\Entity\Sql\SqlContentEntityStorage-&gt;wrapSchemaException()
(line 1535 of
C:\Users\Nick\Sites\devdesktop\drupal\core\lib\Drupal\Core\Entity
\Sql\SqlContentEntityStorage.php).   [error]
Cache rebuild complete.   [ok]
Finished performing updates.   [ok]

Based on the 2nd answer here and this reference, I have made a custom module called "Database Fix" with the following content in the database_fix.module file. I am not a coder, so there is plenty of guesswork involved here:

<?php

/**
 * Fix database by updating menu_link_content.field_most_common_name field
 *
 */
function database_fix_update_8501() {
    $manager = \Drupal::entityDefinitionUpdateManager();
    if ($field = $manager->getFieldStorageDefinition('field_most_common_name', 'menu_link_content')) {
      $manager->updateFieldStorageDefinition($field);
    }
}

I enabled the module, refreshed pages and ran update.php, but it didn't work.


texts: LDAP authentication module not working in xampp

texts:
When i enabled LDAP module for drupal 7 then always shows error
No LDAP PHP Extension is loaded for PHP, so LDAP will not work properly.
even  after un comment extension=php_ldap.dll from my php.ini, it is not working.i restart apache and php_ldap.dll is also in php extensions.


texts: Cannot add files to a specific folder using file resumable module

texts:
I recently moved to a droplet at DigitalOcean. Because they have small hdd's I added 20GB extra space to my droplet.

Because my resources does not fit neither on extra space or on the server's hdd I split the

  sites/default/files

folder by creating 2 symlinks  for 2 folders that hold around 15GB pointing to the extra space.

Now if I try to create a node of the type that should put the files in the extra space I get this error:

The upload directory public://xxx for the file field field_fisiere_audio could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.

All the folders where I upload files have 700 rights. The owner and group is www-data.

Any idea why do I get this? Is this because of the symlinks? Is there any other way of splitting the files folder?

I also tried with 777 and is not working either.


texts: How to get custom entity data in custom page

texts:
i have created Event entity, and I have custom page.

I want to load ALL Entity rows and then use it in my template.

This is the way everyone is prsenting, but i don't know how can i get NID value

$events = \Drupal::entityTypeManager()->getStorage('event')->load($nid);

Using Symfony i could do this like:

$events = $this->getDoctrine()->getRepository(Event::class)->findAll();


texts: To process uploaded file for certain content type, how to?

texts:
For example:

A new content type Photo is created
The optional core module Upload is enabled
Such that users can upload JPEG files

How can I:

In view mode of a Photo node, show a small "View EXIF" button next to the Photo
When the user click the "View EXIF" button, my module show some EXIF info about that photo

i.e.:

add a button only for a particular content type (Photo in this example)
trigger a hook to process a uploaded file (a JPEG file in this example)

Thanks!


texts: Why a unnamed  is added to a specific region?

texts:
I have 2 blocks sitting in a region called "headline".

Drupal 8 seems to add these 2 blocks , into an unnamed div and thus their display:flex CSS layout is cancelled (you can't scatter 2 container items if these are wrapped into one div).

Please see attached image to make sure you understand me.

I have no idea where this inspected div is coming from. I don't recall adding it myself. Only because it seems to be added by Drupal 8 itself, I publish this question here.

The problem can be seen live here.

A Drupal 8 themer might have an idea on why this is happening.

I might need to note that the twig markup also doesn't contain such div.

The regions' twig markup:

{% if page.headline %}
     {{ page.headline }}
{% endif %}

The CSS code I used:

#headline . container {display: flex; flex-direction: column; align-items: center}

@media screen and (min-width: 1080px) {

#headline .container {display: flex; flex-direction: row; justify-content: space-between; align-content: flex-start; flex: 1; margin: 0 auto}

}


texts: db_delete on click on a link in module contents display

texts:
I've made a module displaying a set of fields from the database.
I would like to add a "delete" link at the end of each row be able to delete the row in the database on click. I made it in my module with the following code :

The tests.module code :

<?php

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

$items['tests'] = array(
    'title' => 'Tests',
    'page callback' => 'tests_contents',
    'access callback' => TRUE
);

$items['tests/delete/%'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tests_delete_form', 1),
    'file' => 'tests_form.inc',
);
return $items;
}

function tests_contents(){
$delete_path = current_path();

$query = db_select('form', 'f');
$result = $query
        ->fields('f')
        ->execute()
        ->fetchAll();

foreach($result as $key){
    $output .= $key->id;
    $output .= $key->name;
    $output .= 'id.'">download';
    $output .= 'id.'">delete';
}
return $output;
}

And the tests_form.inc code :

<?php

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

$items['tests/delete/%'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array('tests_delete_form'),
'access callback' => TRUE
);
return $items;
}

function tests_delete_form_submit($form, &$form_state) {
$path = current_path();
$rest = substr($path, 13);

$query = db_select('form', 'f');
$result = $query
  ->condition('f.id', $rest, '=')
  ->fields('f')
  ->execute();

$testid = $result->fetchField();

db_query("DELETE FROM {form} WHERE id = %testid", $testid);
}

How can I make this db_delete function on click in my module ?


texts: Add value to existing field value db_update

texts:
How can Add value to existing value of field using db_update ?

I have a field in custom table amount which will be incremented by a function


texts: Get all the nodes with matching taxonomy terms in a view Display

texts:
I have a view which shows all the page elements.

So, in five displays of view, it shows Hero area, description, sidebar etc.

The last display has to show all the nodes which has similar taxonomy terms of this current node.

For example, if Taxonomy is Interests, and I have selected Basketball, Chess, Baseball, then I am hoping to output all nodes with the same interests.

I am trying here to get all nodes within my display. Is it possible?

Many Thanks.


texts:
This is an unusual one. Let's say I have two web servers A and B. How would I go about making a link to a file from a Drupal website on server A to a file on server B such that the link is secure (the link to the file can't be accessed directly/shared)? I would have some control over server B, but it would just be a standard web server.

The reason for wanting this is that I need to serve some files to users behind the "Great Firewall of China", but the website is within China.


texts:
I have one page mortgages/%/view that needs to have it's own custom theme. I have the HTML created and it's ready to go. In my 'mortgage' module I have a mortgage.tpl.php file with this HTML in it.

My hook_menu looks like this:

function mortgage_menu() {

  $items = array();

  $items['mortgage/%/view'] = array(
    'page callback' => 'mortgage_callback',
    'page argument' => array(3), //pass 3rd argument of url -- 1. drupal 2. mortgage 3. %
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
  return $items;
 }

Then my callback function and mortgage_theme function look like this:

function mortgage_callback() {
 return theme('mortgage');
}

 /*
 * Implementation of hook_theme().
 */

function mortgage_theme(){
  return array (
    'mortgage' => array (
      'template' => 'mortgage' ,
      'arguments' => array(),
    ),
  );
}

This successfully calls my mortgage.tpl.php file into my mortgage/%/view page. HOWEVER, it only displays in the middle of my "content" section instead of correctly overriding the theme. Obviously this isn't correct.

How would I get this mortgage.tpl.php file to be THE theme file for this specific page?

e/ Mortgage is NOT a node. It's a custom module which allows users to get a full page view of mortgage details.


texts: Can taxonomy terms contain special characters e.g. ampersands, apostrophes and dashes?

texts: What characters are legal in taxonomy terms in Drupal 7? I haven't been able to find a list of illegal characters. Does this mean all characters are legal? I am particularly interested in knowing if ampersands, apostrophes and dashes are safe to use. Thanks


texts: How do you make the list of Organic Group (OG) members of a group visible only to group members?

texts:
In Drupal 7 I have public and private groups.  I would like the list of members that show up in the View: OG members block to only show members of the group if the the current user is a member of that group as well.

This seems like a fundamental capability of OG yet I can't seem to find how to set it.

A version of this question is at http://drupal.org/node/707738 - posted on February 8, 2010

Any help would be appreciated.


texts: Commerce: Custom template with multiple product references and ajax update

texts:
I am about to implement an Drupal commerce system. So far so good, but now I need to have multiple "Product reference"'s from the Product Display to Products.

I allowed my field to have multiple product references and it works: dropdown aside to "add to cart". Since this dropdown uses an ajax call, the rest of my product display does not get updated... But I need to update the SKU and the PRICE for this "new" product too...

Any suggestions?

Code from my node--product.tpl

<?php
// @file: node--product.tpl.php
//
// fetch needed vars
if(!empty($content['field_produkt_reference'])){
    $product_number = $content['product:field_manufacturer_number']['#items'][0]['safe_value'];
    $product_sku = $content['product:commerce_price']['#object']->sku;
    $product_warranty = $content['product:field_warranty']['#items'][0]['value'];
    $product_price = $content['product:commerce_price'][0]['#markup'];

    // put them in array > easy render
    $overview[] = array('Herstellernummer' => $product_number);
    $overview[] = array('Artikelnummer' => $product_sku);
    $overview[] = array('Preis' => $product_price);
    $overview[] = array('Add' => render($content['field_produkt_reference']));
}
?>

...

<?php
// iterate through array
// finally lets display fetched data
foreach($overview as $item){
    foreach($item as $description => $value){
        switch($description){
            case 'Preis':
                echo '
'. $value .'
';
                break;
            case 'Add':
                echo '
'. $value .'
';
                break;
            default:
                echo '
'. $description .'	'. $value .'
';
        }
    }
}
?>

However when I do not directly call the field values, eg:

$product_price = $content['product:commerce_price'][0]['#markup']

but call it with the render function:

$product_price = render($content['product:commerce_price'])

the ajax update works as expected (in this example with the price field of my product) but the result is just a huge messy code... ;-) So I would prefer the direct value call.

--- edit1: better format, adjust title

--- edit2: additional information


texts: How can I use drush_invoke() in my code called from hook_update_N()`?

texts:
I need to do a few things which could be easily made with Drush commands, but I need to achieve them through PHP code inside my module, on an hook_update_N().

It seems to me that I need to use drush_invoke() but it doesn't currently exists when I tested in a devel block. I searched here and there how to include (safely) this function, but I had no luck on that.

I guess it is simple and my question could sound silly.

How can I use drush_invoke() in my code called from hook_update_N()?


texts: Hook to call a function after menu rebuild?

texts:
After a menu rebuild, such as one that occurs automatically when visiting the Modules admin page, some of my Drupal JS behaviors are not in the correct state. I need to re-initialize or attach them after a menu_rebuild() occurs.

Is there a hook I can use or a way I can know to call a JS function after a rebuild?


texts:
I have a problem on my Drupal website since 2 days. When I try to add a new image (50 KB), the thumbnail is not displayed after transferring the image so I have to save the element and open it again to see the cropping box. I checked the ajax response and I found this error:

  An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (64 MB) that this server supports.

I did some search on Drupal forums and SE, tried all the solutions but still have the same issue. This is my current configuration:

  Drupal 7.19

  Nginx 1.6.2

  PHP 5.3.24

  post_max_size = 64 MB

  upload_max_filesize = 64MB

I'm not using the nginx progress module

Please note that I have another copy of the website used for development and hosted in the same server with the same nginx and php settings. This copy works perfectly.

Any suggestion on what to do to fix this issue?


texts: Fatal error after enabling backup and migrate module

texts:
I just enabled back up and migrate module. Then I backed up my site and tried to restore the site using the back up file and it did not allow me to do it.

Then when I go to admin > config > I get this error:

"One or more problems were detected with your Drupal installation. Check the status report for more information."

Then I go to admin > reports > status reports > click run cron manually > I get this error:

"
Fatal error: Class CToolsCssCache contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (DrupalCacheInterface::__construct) in /home/content/65/11722765/html/sites/all/modules/ctools/includes/css-cache.inc on line 52
"

Chaos tools 7.x-1.7

Drupal 7.22, 2013-04-03

Please advise,
 D


texts: How to pass combine search argument in views_embed_view

texts:
I create one view,that view I'm embedding in my php page using this code

views_embed_view('bank_blog_post','page','all');

In this view i added combine filter. When i search any values though this files its directly taking me into actual view url like

bank-blog-post/all?combine=IPPB+Result+2017

so how can i pass this combine filter argument also in views_embed_view function to filter my post

like mypagename/?combine=IPPB+Result+2017


texts: Is there a way to programmatically add questions to a webform grid?

texts:
I have seen hooks to use to alter webform options, but not the questions that appear on the left side of a grid.

I would like those questions to be a node titles actually of a content type that I have already defined.

For example, the content type titles will appear on the left and the options are already defined as first choice, second choice, and third choice radio buttons above in the header for each node title.

Here's the grid I would like to produce:

Node Title -- First Choice -- Second Choice -- Third Choice

Title One -- Radio Button -- Radio Button -- Radio Button

Title Two -- Radio Button -- Radio Button -- Radio Button

Title Three -- Radio Button -- Radio Button -- Radio Button

Title n -- Radio Button -- Radio Button -- Radio Button

Essentially I just need a way to import questions that are node titles of another content type into the webform Questions field that requires them to be inputted as pairs ex.

"safe_key|Some readable option"

"safe_key|Some readable option"

"safe_key|Some readable option"

Thank you very much.


texts: A field only visible when a node is being edited

texts: I have a custom field which should be only visible when a node (an article) is being edited (and not shown when a new content is created). I'd like to avoid installing a module for this, so my question is if there might be a specific configuration setting for this in the core itself?


texts: Specific node is being attacked by spam comments. What do I do to prevent it?

texts: My site is being heavily attacked by spam bots and this is taking place only on one specific node. All other nodes are safe or the spam there is being blocked by Mollom. How do I prevent further spam comments from being posted over there? Do you have any idea?


texts: Deploy Media Field Images From Staging to Production

texts:
I'm trying to find a way to copy nodes (plus associated images) and (ideally) users from a Drupal 7 staging site into production.

In theory, this "Deploy - Content Staging" module is perfect:

https://www.drupal.org/project/deploy

In practice, I'm finding that managed images embedded in Media fields do not copy across.

The Deploy module will automatically copy across managed images embedded in an image field and even managed images embedded in body HTML which is impressive.

Unfortunately, almost all our managed images are embedded in Media fields.

I posted a detailed issue on Deploy here a few days ago:

https://www.drupal.org/project/deploy/issues/2987019

However, no one has been able to help me.

Any recommendations how I can copy nodes and associated images using the Deploy module? Failing that should I look at node export?

Thanks.

Regards Brett Sh


texts: Purpose of "rows" when adding Long Text field

texts:
When adding a Long Text field to a content type, I am asked to supply the number of rows for the field. What is the purpose of this?

This seems like it has something to do with how the data is stored in the database. At first I thought it was required because I was using a SQLite database that stores everything in a flat file, so I switched to a MySQL backend. However, the field is still required.


texts: I've placed blocks in hidden region, now no login to admin possible

texts:
I made a site in Drupal 9. I played a bit with blocks and I think I placed an important block in the hidden region. Now the login page doesn't show the login form anymore. The header, footer and some content are visible. I can't log in as administrator and I can't put the blocks back in another region.
I've searched the forums and Google thoroughly, but I couldn't find the answer.
The suggestion given in
Drupal login form hidden
to access http://example.com?q=user doesn't work.
I also looked to the database content, without finding anything. There are a lot of block tables, but they contain values of custom blocks, no default blocks like the login block.


texts: Features 8.x-3.7 not writable on Window's Ubuntu

texts:
8x-3.7 features, most stable version, but I am having trouble writing to custom module on the UI. My structure is as follow:

 -modules/
    contrib/
       features/
    custom/
       news_blogs/
          config/
             install/
                [code]

when i edit my view, i go to /admin/config/development/features I see that the feature state is  edit. I click the checkbox and click write.

I get error:
Package News/Blogs not written to modules/custom/news_blogs. Error: Failed to create directory /mnt/c/mywebsite/modules/custom/news_blogs/config/install.. and then inside install code is deleted and empty.

I check my logs:
Warning: chmod(): Operation not permitted in Drupal\Core\File\FileSystem->mkdir() (line 226 of /mnt/c/mywebsite/core/lib/Drupal/Core/File/FileSystem.php) #0...

I checked my permissons and it is 777 and my usr is the owner for the directory.
I am unsure what else to check or test to figure out what can be going wrong. Any help is thanked!


texts: Node titles disappear sometimes when using tokens with Autonodetitles

texts: There are instances where the node titles disappear for updated nodes. The site uses organic groups with APC for caching data. The drupal version installed is 7.18 however most modules including entity, token, entity token etc are up to date. The site has few custom modules and rules enabled but they do not affect the node title. I suspect there may be issue with cache which results in instances when node titles are not populated. Please do suggest ways in which I would be able to figure out the exact issue.


texts:
Preface -- I'm a newbie with drupal and have watched too many youtube flicks on jCarousel and slideshows.  So totally confused.

My question:
I've created a web form in drupal 7 and would like to do a jCarousel of all the images that have been uploaded via the web form.  Is there a way to point to a directory and have the jCarousel load the image files.  I tried creating a view with show files, but it didn't load the image files.

I'm trying to do this without css or javascript.  I don't pantheon service provider will let me add javascript (I think).

Thanks in advance.


texts: Term reference on node edit to ALL vocabularies

texts:
I have about ten vocabularies and my content will be tagged with mostly one term of ANY of them.

It would be fine to let the editor choose the vocabulary on node edit form.

Is there yet a module or patch for that situation?   It would be the core taxnonomy module, right?

A workaround would be to mount all the ten vocs into the "11th", the root one. (They have been created as mindmaps and splitted for sake of overview and because I want to use taxonomy menu and keep each one small)


texts:
So, what I need to do is to convert the contents of a .pot file to an array.

I know there is _locale_import_read_po(), but when I tried using it with the following code, I got an error.

$translations = _locale_import_read_po('db-store', 'translations.pot');

The translations.pot file is located in the same directory containing the file with the code I wrote.

The error I get with dpm($translations) is the following one.

  Error message

  The translation import failed, because the file could not be read.

This is the code from the _locale_import_read_po() function, that outputs that error.

// The file will get closed by PHP on returning from this function.
$fd = fopen($file->uri, 'rb');
if (!$fd) {
  _locale_import_message('The translation import failed, because the file %filename could not be read.', $file);
  return FALSE;
}

As far as I know the 'rb' file open mode is to open non-text files.

Why do I get that error message?


texts: How do I send an email to the administrator users when a specific link is clicked?

texts:
I'm working on a new site built with Drupal 6, and I have to program a specific action on the node pages.
I have a page that shows the product information for users. Following the information, I have a button labeled "order now"; when this button is clicked, two scenarios are possible:

if the user is not logged in, he is redirect to the login form
if the user is logged in, an e-mail is sent to the administrator with the current product information and the information of the user who clicked the button


texts: google syntax in exposed filter for text field

texts:
Is there a way to use google syntax in views exposed filters for texts fields (e.g. title)?

examples:

dog -cat (search for titles with "dog" that have not "cat")

"black dog" (search for titles containing "black dog", and not only "black" or "dog")

thank you


texts: Printing fields in a View template file (Devel / Krumo)

texts:
My "Article" node type has a field image. I can print this field in a node template with

<?php print render ($content['field_image']); ?>

I have a simple View which lists Articles here. The default Views template /modules/views/theme/views-view.tpl.php prints the content with <?php print $rows; ?> (line 58 here).

I want to use my own Views template which will specify the various elements of the node ie print title, print image, print body etc instead of <?php print $rows; ?>

I don't think...

<?php print render ($content['field_image']); ?>

...will work in a Views template so what syntax do I need?

In case it helps I have the devel / krumo output on the page.

I am aiming to use the Views template to control the layout of the Articles in the View, for example I might want the View to look like this:

So I think the default Views template's <?php print $rows; ?> is no good for this and I need to isolate the various elements of the View's output (image field etc)

Thanks...


texts: How can I execute a custom code on node edit/add page during hook_page_build?

texts:
I'm seeking to show an extra form on node edit/add page. My function is this:

function mymodule_page_build(&$page) {
  $node = menu_get_object();
  if($node && $node->type == "object") {
    $page['page_bottom'][] = drupal_get_form('mymodule_form');

How can I check that current page is node edit/add page with a specific type like object?


texts: What are the alternatives to Features module in Drupal 8

texts:
I am trying to export configurations from one Drupal site to other. This is not a one time operation, I will need to do this multiple times and Single Import, Simple Export is not an option as there will be changes to many files.

Is there any stable alternative to Features module?


texts: Creating and updateable block on home page of site

texts:
I have a 'featured resource' block on the home page of my site. I'd like my very non-technical folks to be able to update this block with a new node every week. Note that it would just display the teaser of the node, with a 'read more' link.

Ideally, it would be easy for them to do this (for example, by just checking a box on the node creation/edit page to add it to the featured resource block).

Anyone have recommendations for the best/easiest way to do this?


texts: How to keep your Drupal 8 site synced with 8.x branch

texts:
Is it practical to both A) develop/maintain a Drupal 8 alpha site and B) keep it up to date with the latest daily/hourly commits from the 8.x branch ?

If so, what would be your strategy to keep your site up to date, while maintaining the integrity/stability of the site itself?  How would you handle commits that affect the database?

My big concern is pulling in commits that affect the database structure.  If the database is affected in a particular commit, I'm assuming the site could easily break.


texts: Pass $form and $form_state as arguments in hook_menu

texts:
I have a javascript code below:

$.ajax({
    type: "POST",
    url: "?q=myid_print/update_table",
}).done(function(o) {
    console.log(o);
});

It calls a function declared in my hook_menu:

function myid_print_menu()
{
    $items = array();
    $items['myid_print/update_table'] = array(
        'title' => 'ID History',
        'page callback' => 'myid_print_all_submitted_id_callback',
        'type' => MENU_CALLBACK,
    );
    return $items;
}

Below is the function being invoked:

function myid_print_all_submitted_id_callback($form, &$form_state){
    watchdog('myid_print', 'Wow');
    return $form['table'];
}

After looking at my drupal's database, particularly in watchdog table, I saw the message Wow, which indicates that the function myid_print_all_submitted_id_callback has been called but my $form_table is not updated. The obvious reason behind this is I did not pass an argument $form and $form_state. Then, this is what my question is. How will I pass $form and $form_state arguments? Or any way that I could render $form_table invoke by javascript?


texts: $base_url and $THEME_ARRAY using together

texts:
I have this in settings.php:

$THEME_URLS = array(
  array('/optoelectronics','sky'),
);
foreach ($THEME_URLS as $info) {
  if (strpos($_SERVER['REQUEST_URI'], $info[0]) === 0) {
    $conf['theme_default'] = $info[1];
  }
}

I have two domains each based on a different theme. The issue is that I'm trying to use part of the old theme for just these two sections but the other theme is entirely based on SKY and if I make any modifications to the css or create a page-optoelectronics.tpl.php, then both sites receive the modifications, which I don't want.

So I duped the theme "sky" and changed all appropriate names and such to 'optotemp' but as I mention above, Drupal still disregards the "http://www.site.com" part and switches to 'optotemp' when it sees /optoelectronics.

So I found $base_url which returns the full path, including the host.

I'm a little rusty with the combination of an if/else command and including the array above in one fell swoop.

I want to say: If the absolute path is http://www.sitea.com/optoelectronics use theme optotemp. Otherwise, use the default theme. This command would then mean by default that http://www.siteB.com/optoelectronics would still use the theme assigned to that domain via the domain access module, which is Sky.

In other words, www.sitea.com has a new entire theme, but two sections of www.sitea.com will need to use optotemp but www.siteb.com uses sky.

I need help on knowing the syntax to get this right.

var $usOrEuro = $base_url;
if ($usOrEuro == 'http://www.sitea.com/optoelectronics'){
  $appliedTheme = 'optotemp';
}

$THEME_URLS = array(
  array($usOrEuro, $appliedTheme),
);
foreach ($THEME_URLS as $info) {
  if (strpos($_SERVER['REQUEST_URI'], $info[0]) === 0) {
    $conf['theme_default'] = $info[1];
  }
}


texts:
I have implemented the data described here and now want to create a view that will work out the handicap for a particular player. I have so far created my view which list players and using a relationship to results for the player, and then aggregating these fields, can display things like the players best score and their average score.

Next I want to display the players "Handicap", which is a complex aggregation. Namely, it's the average of the best 8 of the last 20 results multiplied by 0.93. Can you write custom aggregation functions? Or should I create a new field on the result? I'm not sure of the easiest way to go about this.

Thanks!

EDIT: Thanks to @Jimajamma I was pointed in the right direction. You can do what he suggested purely from a module. I used the Fields UI to create a field that I can then manipulate to keep it simple. In the module I've used hook_theme to register a tpl.php file. I struggled to get my preprocess function to be recognised because of the base_hook directive which seems to then cause views/core to ignore the preprocess functions directive. The following is the simplest module you can create:

function golf_ladder_views_api() {
  return array('api' => 3.0);
}

function golf_ladder_theme($existing) {
  return array(
    'views_view_field__field_handicap' => array (
      'arguments' => array('view' => NULL, 'field' => NULL, 'row' => NULL),
      'template' => 'views-view-field--field-handicap',
      /* 'base hook' => 'views_view_field',
       * Don't do this if you want to use a preprocess that you control.
       * If you define base hook views seems to want to ignore the
       * 'preprocess functions' directive below
       */
      'path' => drupal_get_path('module', 'golf_ladder'),
      'preprocess functions' => array(
        'template_preprocess',
        'template_preprocess_views_view_field',
        'golf_ladder_preprocess_views_view_field__field_handicap',
      ),
    ),
  );
}

function golf_ladder_preprocess_views_view_field__field_handicap(&$variables) {
  $variables['output'] = '4'; // TODO: calculate proper handicap
}

After that create a template file views-view-filed--field-handicap.tpl.php which is simply:

print $output;


texts: How to customise calendar week view's day title?

texts: For example, how can I show  Jul 4 (Mon) instead of the default Mon as day title?


texts: Anonymous users randomly get 404 errors on front page

texts:
I have a drupal 6 site that will occasionally serve up a 404 error to anonymous users on the home page only.  It happens 2 or 3 times a day and I cannot figure out what is causing it.  I can clear it by logging in and flushing the cache, or going to site information and re-saving that form.

We are using the mobile tools module which I thought might be conflicting somehow, but I can't find any issues in the issue queue related to this.  We are using caching, but it's just standard drupal caching.

I've also tried checking the server logs and watchdog and I can't find anything useful.  Does anyone have any ideas?


texts:
I am using #states form API to do the show hide animation of one element based on the values of another form element.like follows,

$price['#states'] = array(
    'visible' => array(
        ':input[id="edit-field-paid-event-und"]' => array('value' => 1),
    ),
);

It's working fine in all the browsers except in Internet explorer 9 and 10. Any solution for this.


texts: limit_validation_errors resetting form values in submit handler

texts:
I have a custom button in my form_alter and a submit handler for that . I don't need validation for this button submit . I tried by giving limit_validation_errors to exclude all validation for the custom submission . When giving like this am not receiving any form values in submit handler . Any idea on how to resolve this issue ?

TRY

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id){
 //Additional button for the Save as Draft feature
  $form['actions']['draftsubmit'] = array(
      '#type' => 'submit',
      '#value' => t('Save as Draft'),
      '#weight' => 1000,
      '#submit' => array('draft_form_submit'),
      '#limit_validation_errors' => array(),
     );
}

/**
 * Handles the save as draft button submit
 */
function draft_form_submit($form, &$form_state) {
    echo '<pre>';print_r($form_state->getValues());exit;echo '</pre>'; //Not getting values here
    $name = $form_state->getValue('field_p_name')[0]['value'];
    $dc = $form_state->getValue('field_p_dc')[0]['value'];
    $sec_type = $form_state->getValue('field_p_sec_type')[0]['value'];
}

UPDATE

I have other validations in other modules form_alter like

 function othermodule_form_alter(&$form, FormStateInterface $form_state, $form_id){
    $form['field_fwd_acl']['#element_validate'] = array('validate_IpAndNetworks');
    $form['field_fwd_dest_acl']['#element_validate'] = array('field_fqdn_validate');
    $form['field_amount_of_proxies']['#element_validate'] = array('field_instance_validate');
}

I mean these validations should not be worked when clicked on Save as Draft button is clicked


texts: Using a vocabulary term as a panel wildcard

texts:
I want to create a frontpage Panel Page that shows Views according to a Vocabulary Term Name in the url, like so:

frontpage/persons
frontpage/companies
frontpage/institutions

That way, I've configured my Content Panel Views to show content by that category.

The thing is, when I create my Panel Page, the only terms I can pass are:

Taxonomy term (multiple): ID
Taxonomy term: ID
Taxonomy vocabulary: ID

And I need something like taxonomy term: machine name, but it doesn't appear within my options.


texts: How to block users from editing a node of a content type? (D7)

texts:
This should be easy, but I can't figure out what I'm doing wrong: In my Drupal 7 site, I've defined a content type in the usual way.  I want regular users to be able to create instances of that type, but not edit them.  Trivial, right?

The content type is in place, and, in admin/people/permissions, there are entries like "My Type: Create new content" and "My Type: Edit own content".  I've set the checkboxes so authenticated users have "create new content" permission but not "edit own content" permission.  Just to be on the safe/superstitious side, I've cleared the cache and done a Rebuild Permissions.  But, nevertheless, my regular users can still edit their nodes.

Shouldn't this work / any ideas what's wrong?  Do I need to write a _node_access handler?


texts:
WHAT I HAVE

I've a vocabulary that looks like

France
- Paris
- Orlean
- Monreal
Spain
- Madrid
- Barselona

This vocabulary is used on my Content Type - Product via view (I've few similar vocabularies added the 1 view) in a field Location with type: 'Reference Entity'. Field may have only 1 value and it can be either Country or City.

TASK

I'm building a view where I would want to categorise my products by country depends on city/country (so I have to get Country in case if it is City).

France
 - product1
 - product2
 - ...
Spain
 - product1
 - product2
 - ...

I tried hard on a view but no success.

What should I do in order to only get Parent term if child is used on Content Type?

What kind of information can I provide to help me?

Thanks.


texts: How to get MEDIAN of value in a view field

texts:
I have 5 integer fields and I want to show the MEDIAN result for those fields in my content view.
How to get the result?


texts: How to show results from the last search?

texts:
I have this senario:A user makes a search (using search api solr).
After some days he returns to the site and in the front page appear results related to the last search he made.
How can I accomplish that with Search api?
thanks


texts: How to create absolute url for a page/node?

texts:
I think that I need to use the l() function as seen here: How do I get the absolute URL when using l()?

I just need a bit more clarification. What's the best way to create links on pages? I would like to link them correctly so that if my domain changes then the link will be updated (for example going from a local host to an online host). Let me also know if this is not the best way to do it.

I guess I need to know what would go into HTML tag  and then also do I need to place any code anywhere else?


texts: How to fix backup & migrate End of script output before headers: index.php error

texts:
I am getting the following errors in the Apache log when I run backup (entire site) on my local computer using Acquia Dev Desktop.

  [Thu Oct 15 18:11:47.700156 2015] [fcgid:warn] [pid 2912:tid 908]
  [client 127.0.0.1:60171] mod_fcgid: read timeout from pipe, referer:
  http://openoutreach-7-x-1-19.dd:8083/admin/config/system/backup_migrate/export/advanced
  [Thu Oct 15 18:11:47.700156 2015] [core:error] [pid 2912:tid 908]
  [client 127.0.0.1:60171] End of script output before headers:
  index.php, referer:
  http://openoutreach-7-x-1-19.dd:8083/admin/config/system/backup_migrate/export/advanced
  [Thu Oct 15 18:11:57.987744 2015] [fcgid:warn] [pid 2912:tid 324]
  mod_fcgid: process 9460 graceful kill fail, sending SIGKILL

How can I solve this problem?


texts: How to revoke an Oauth2 refresh token as a Drupal admin?

texts:
I am currently working on an app that acts as a mobile client for a service of ours that is built on Drupal 7. Currently I use access tokens and refresh tokens via the Oauth2_server module as a means of authentication for activating certain REST functionality. If it helps in any way, I use the password grant-type for the credential flow. It's username and password in, access token and refresh token out.

My main concern is that if a user has his/her phone stolen, the thief may exploit the refresh token (lifespan of 14 days) still inside the app to remain authenticated in perpetuity and commit identity theft. I'm looking for a way to revoke/blacklist this refresh token should the user contact support to minimize the damage.


texts:
In one domain I want 2 drupal it as follows:
www.example.com/index.php (not necessarily drupal), just a landing page
On the index page people have to chose between 2 Drupal Sites

www.example.com/salloon1/index.php
or
www.example.com/salloon2/index.php

Can I do this ass follow?
Step 1
Uploading all drupal files to www.example.com/saloon1/
Create Database saloon1_DB
settings.php pointing to saloon1_DB
Step 2
Uploading all drupal files to www.example.com/saloon2/
Create Database saloon2_DB
settings.php pointing to saloon2_DB

index.php
2 images: image 1 pointing to www.example.com/saloon1/index.php
          image 2 pointing to www.example.com/saloon2/index.php

Is this right or is there another solution?

Thanks guys in advance!!
Best regards,
Pieter-Jan Derks


texts: How to hide header and footer from 404 page?

texts:
I create a 404 page on D7 site ( ie. mysite.com/404), which is a Basic Page. I am trying to hide the header and footer from this page. The header and footer are blocks, and they are placed in every page using Context. I tried tweaking the Context so that if Path = 404, hide the header and footer.

It works when I go to mysite.com/404. However I try to hit an alias that doesn't exist (ie. mysite.com/asdf), instead of redirecting to /404, Drupal pulls the node body of the 404 page and stay at /asdf. The rule in the Context therefore doesn't apply.

I don't want to use the Visibility control in the Block module because migrating the configuration between sites can be troublesome. How would you go about it?


texts: Views: expose filter - filter out results between a specific set of dates

texts:
I have a views (content type = car, Create date filter"exposed" and some fields to display in the result in a table).

is there any way to display all the node not created in the date that selected using the filter?
Thanks


texts:
I am looking for a snippet that lets me display the total count for a specific node type, e.g. "Pages = 167" or "Products = 10630."

What code should I use to achieve this?


texts:
I try to translate the message that is used in the following JavaScript code.

Drupal.t('Changes made in this table will not be saved until the form is submitted.')

I use the String Overrides module; I tried also translation using settings.php. None of the methods work.

Does anybody have an idea on how to translate the sentence? I do not want to use big modules like localize.


texts:
I'm creating a content type specifically for email newsletters, which will be sent using phplist (client prefers phplist to using a Drupal newsletter module such as Simplenews).

So I'm planning to use a module like ThemeKey or Content Theme to create a new theme specifically for newsletter content type. Like most newsletter templates, the theme will use tables and lots of inline CSS.

I haven't seen any Drupal base themes for newsletters. Before I build from scratch, is there any advice or suggested theme/module I might have overlooked?


texts:
I am logged in as admin on my drupal site but I cannot change anything. I try to add a new article, click Save, nothing happens, the browser returns to the "add article" page with the empty wysiwyg form.

It's as if my database is read-only. I cannot edit any settings or content.

If I choose to edit an existing article, then click save, I get the page but it hasn't changed.

Also I tried to make a recommended update ("Download these updates"), when I click that button, page reload happens but nothing else changes.

Is something wrong with my database? Permissions? I get no errors on the log when doing this.

I'm very new to drupal, temporarily took over as admin for a page which had some problems.

There is another message that I should update the drupal core from 7.12 to 7.15 but it has to be done manually and I haven't looked into that yet.


texts: Drupal 7: fetchField(0) giving me half of the records!

texts:
I am trying to get all the records from one table. I get from the count 18 record, but the actual given lines are 9.

$name = 'admin';
$result = db_query("SELECT name FROM {users} WHERE name <> :name", array(':name' => $name));
$rownum = $result->rowCount();
print "This is the total number: ";
print $rownum;
print "
";
foreach ($result as $record) {
  $value = $result->fetchField(0);
  print $value;
print '
';
}

Results:

  This is the total number: 18
  user1
  user2
  user3
  user4
  user5
  user6
  user7
  user8
  user9

Do you think is my loop?


texts: How to make Rules ignore case sensitivity when comparing strings

texts:
I have an issue where I want to use Text Comparison in the Drupal Rules module but sometimes the case doesn't match (one is provided by user input and the other is provided by user data).  It's comparing 2 emails.

The rule fires as expected if the text matches exactly, but if the text doesn't match case (ie example@example.com != Example@example.com) it doesn't fire.

Is there a way to get rules to ignore case?

The data that I'm getting to compare is as follows in text comparison:
user-data:mail
person-email

The user-data:mail is the email of the user who is submitting the webform, the person-email is the provided data to a ruleset coming from the webform that the user entered.


texts:
Why do I get the following message when trying to uninstall a module with Drupal 8?

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

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;pantheon.aggregator_feed&#039; doesn&#039;t exist: SELECT base_table.fid AS fid, base_table.fid AS base_table_fid

FROM
{aggregator_feed} base_table

LIMIT 1 OFFSET 0; Array()
in Drupal\Core\Entity\EntityStorageBase-&gt;hasData()</em> (line 588 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Database\Statement-&gt;execute(Array, Array) (Line: 631)
Drupal\Core\Database\Connection-&gt;query(&#039;SELECT base_table.fid AS fid, base_table.fid AS base_table_fid

FROM
{aggregator_feed} base_table
LIMIT 1 OFFSET 0&#039;, Array, Array) (Line: 358)
Drupal\Core\Database\Driver\mysql\Connection-&gt;query(&#039;SELECT base_table.fid AS fid, base_table.fid AS base_table_fid

FROM
{aggregator_feed} base_table
LIMIT 1 OFFSET 0&#039;, Array, Array) (Line: 510)
Drupal\Core\Database\Query\Select-&gt;execute() (Line: 267)
Drupal\Core\Entity\Query\Sql\Query-&gt;result() (Line: 83)
Drupal\Core\Entity\Query\Sql\Query-&gt;execute() (Line: 588)
Drupal\Core\Entity\EntityStorageBase-&gt;hasData() (Line: 56)
Drupal\Core\Entity\ContentUninstallValidator-&gt;validate(&#039;aggregator&#039;) (Line: 573)
Drupal\Core\Extension\ModuleInstaller-&gt;validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller-&gt;validateUninstall(Array) (Line: 121)
Drupal\system\Form\ModulesUninstallForm-&gt;buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 519)
Drupal\Core\Form\FormBuilder-&gt;retrieveForm(&#039;system_modules_uninstall&#039;, Object) (Line: 276)
Drupal\Core\Form\FormBuilder-&gt;buildForm(Object, Object) (Line: 93)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)


texts: How to configure CkEditor's styles dropdown?

texts:
I have made changes to the configuration of CKEditor for the basic_html rule set as follows:

When I then try to use the editor, however, I get the following:

I have tried clearing the cache multiple times.
I have tried rebuilding the cache with drush cache-rebuild.

Is there something else you are suppose to do to be able to configure CKEditor in Drupal 8?