texts: Rendering view better expose filter in drupal does not containg term id in drupal 8

texts:
I have created a view with better expose with term taxonomy
And render in twig file
Drupap_view('viewname','machinemname')

Now I want use contextual filter based on term id dynamically
But I see there no term_id in the rendering view (frontend) that I need to pass to
 drupal_view('vn', 'vm', term_id)

How I can get the term_id in the checkboxes


texts: Limit entity type/bundle for EventSubscriber inside services.yml?

texts: I've got an EventSubscriber that I'd like to run for only a specific content type. Is there a way to do this from the services.yml file as an argument or something, or do I just need to check for the entity type in my OnResponse method?


texts: Quicktab problem on the argument of view and block

texts:
I used to make a view shows a page of a project in the url:  projects/[node:author]/[node:nid], this view works well.

Now I want to display this view in the quicktab, but the problem is I can't view the content of the view. I think it is because of the configuration of argument of quicktabs. In the quicktabs, I have selected this view and display it as page, but the problem is I am not sure how to config the arguments.

As you have seen the url of view, is projects/[node:author]/[node:nid], in which there are 2 arguments, when I set it as %0/%1, not working, %0/%1/%2, still not working, and set it as projects/%0/%1, not working either.

Is there any problem with my config?

Also in the quicktabs, I also display the comments related to that content, previously I made another block with default value as contextual argument like projects/[node:author]/[node:nid], but when I try to put it the quicktabs as a block, it also doesn't show.


texts:
I am using editable fields in a view but they are not mandatory.

How can I make them mandatory only in view, but not in content type fields?


texts: How to programmatically set the node updated/changed timestamp

texts:
Some migrated content needs the "updated" timestamp set to the original timestamp, instead of the time the node was saved duration migration.

Setting the "changed" field in the database appears to have no affect for the node updated time?

Here's a sample query:

update node_field_data set changed = 1535805325 where nid = 2148716;
Query OK, 1 row affected (0.01 sec)
...
select nid,changed,from_unixtime(changed) from node_field_data where nid = 2148716;
+---------+------------+------------------------+
| nid     | changed    | from_unixtime(changed) |
+---------+------------+------------------------+
| 2148716 | 1535805325 | 2018-09-01 12:35:25    |
+---------+------------+------------------------+
1 row in set (0.02 sec)

When loading the node, the original changed timestamp is returned:

[changed] => Array
(
    [x-default] => 1532090833
)

I've tried clearing all caches, including clearing the cache tag and fully restarting the cache services (redis+varnish), but to no avail, the previous changed timestamp is always returned!

Any suggestions on how to set the updated/changed timestamp for this case?


texts: Need to print all the function calls Drupal makes

texts:
I need to examine all the function calls Drupal makes during it loads a page (even if there are no errors). I guess debugging software can do this but I would also like to know a way to do this without xdebug etc.

I found this link:
https://drupal.stackexchange.com/questions/545/how-to-debug-drupal
but I'm not sure where to put for example this code:

<?php
$bt = debug_backtrace();
foreach ($bt as $key => $value) {
  if ($key == 0) {
    continue;
  }
  unset($bt[$key]['args']);
  unset($bt[$key]['object']);
}
drupal_set_message(str_replace('    ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(htmlentities(print_r($bt, TRUE)))));
?>


texts: How to migrate from using the Taxonomy Access Control module to the Group module?

texts:
We have a Drupal 6 site, and we are making use of the Taxonomy Access Control (=TAC) module for access control. We evaluated the migration steps, and even if TAC could be ported to 8, maybe we could use a different approach.

We are evaluating Group as an alternative to content access control, but there are no automatic path to migrate from (as now). What would be the preferred migration path for TAC to Group?


texts:
I'm using the Poll module in Drupal core (also using Poll blocks and Ajax poll).

As designed, when I vote I'm taken to the results page, but I'm wondering if it's possible to display the results as a popup on the front page, where the poll block is.

I searched a bit and I know something similar can be done with lightbox2, colorbox, colorbox node, etc., but these solutions require that I assign a class or rel attribute to an anchor tag, and then open whatever URL I enter as a popup. However, the poll calls the results page on clicking the submit button. Is there a way I can change this to accomplish what I need?


texts: Unable to view Taxonomy term page: Access denied

texts:
I am unable to view/see any Taxonomy term page in the front (Access denied).

I can edit Taxonomy in the admin backend.

Example:

http://localhost/{Taxonomy-group}/car

Result:

Page "Access denied - You are not authorized to access this page."

Setup

Alias URL (Taxonomy term paths)

Default path pattern (applies to all vocabularies with blank patterns below)
[term:vocabulary]/[term:name]

Tried but didn't work

Clear cache
Rebuild permissions
Update alias

Does anyone have any idea how to fix this issue?


texts: How to get uid from a node on which is commented?

texts:
I'm using hook_comment_view($comment) and I'd like to confer the uid from the comment ($comment->uid) with the uid from the node on which is commented. I thought of $node->uid, but I don't know how I can define $node.

Any suggestions?


texts: Updating a modified image file across entities using it

texts:
I have a content type named "Affiliate" which has among others a field storing a logotype image. The image is then displayed in a ticker (jCarousel) using a dedicated image style.

After I created one node and attached a logotype to it, I made several copies of that node, differing in text, but sharing same image. I was aware of situations where a logotype has to change but thought that solution would be "scalable" due to the fact that the image reference is shared. Now - kaboom! - the image has to be replaced with a new version. I thought I'd get away if I replaced the original image on the server and then deleted the derivative styled copies from the styles directory to make Drupal recreate them afresh. No go.

The problem is that the new image is used but with old dimensions (both in the node display and ticker), which causes distortions. I have to relink the node with the image, one by one to make it notice the new dimensions. Is the size of the original image stored somewhere in the node? What is the sneakiest way to go in such situations?


texts:
I am using the Taxonomy CSV import/export module to import and export taxonomy from my local installation to a fresh install on the staging. I export it on local, and import it using the same settings on staging. However, for each entry it imports, it throws an error:

  Notice: Undefined variable: format in
  _taxonomy_csv_vocabulary_import_process() (line 421 of /var/www/vhosts/example.com/drupal-7.34/sites/all/modules/taxonomy_csv/import/taxonomy_csv.import.api.inc).

However, the import is successful. Does anyone else encounter this? Is is safe to ignore it?


texts:
In our Drupal 8 theme we are using the classy base theme. themes/mytheme/mytheme.info.yml:

base theme: classy

Using the information from drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme I am trying to remove some stylesheets from the base theme - but I cannot figure out the right way to do so. For instance, I want to remove the css/components/form.css stylesheet from the base theme. So far I tried:

libraries-override:
  base:
    css:
      component:
        css/components/form.css: false

libraries-override:
  core/base:
    css:
      component:
        css/components/form.css: false

libraries-override:
  core/classy:
    css:
      component:
        css/components/form.css: false

None of which is working. Removing the stylesheet with stylesheets-remove would work fine - but this is deprecated and I would rather use the new intended way for Drupal 8+.

What is the correct way of removing/addressing/extending a library from the base theme?


texts: How do I change the node title when saving it?

texts:
For a content type (Article), when I create a new node and save it, I want to append a field value (for example, Location) to the node title.
There seems to be great answers using custom plugins (Modify the node title with the node ID before saving it) and even modules (How do I build the node title from field values when saving the node?), but they're not applicable to Drupal 9.
If the suggested solution requires creating custom module and overriding a function, then please direct me to some implementation guide and specify files locations as I'm a newbie in writing Drupal code.


texts: Is it possible to pass variables as arguments to *.libraries.yml?

texts:
Say I have a foo.libraries.yml defined as so:

external.bc.js:
  version: 1.x
  js:
    //players.brightcove.net/{{variable here}}/{{variable here}}/index.min.js: { type: external, minified: true}

Where {{ variable here }} is where I want to insert values when I attach the library

Then, in a hook_ENTITY_TYPE_view() I am running:

$build['#attached']['library'][] = 'brightcove/external.bc.js';

Which is where I'd also like the pass those variables. Is that possible?


texts: Modify user submitted form data before it is saved an emails are sent

texts:
I am new to drupal but I do have php experience. I am trying to modify an existing custom module that handles some forms on our site. The form in question is used to send an email to the address that is included as a hidden item.

I need to change this email address based on an option the user chooses.

Here is an outline of what I need to happen

user goes to form (hidden email field is already set)
user enters their options
user clicks submit button
check users options and modify email field accordingly
save values to database
send email to new modified email address

Below is the code I am working with now

function bp_bottled_water_redirect(&$form, &$form_state, $form_id){
$interest = $form_state['input']['submitted']['primary_interest'];
$email = $form['submitted']['dealer_e_mail']['#webform_component']['value'];
//drupal_set_message("email is " . $email);
//drupal_set_message("interest is " . $interest);

if($interest == "bottled_water" && $email == "info.minnetonka@culliganwater.com"){
    //$form_state['input']['submitted']['dealer_e_mail'] = "info.bottledwater@culliganwater.com";
    //$email = $form_state['input']['submitted']['dealer_e_mail'];
    $form_state['values']['dealer_e_mail'][LANGUAGE_NONE][0]['value'] = "info.bottledwater@culliganwater.com";
    drupal_set_message("changed email to: " . $form_state['values']['dealer_e_mail'][LANGUAGE_NONE][0]['value']);

}
else{
    $form['submitted']['dealer_e_mail']['#webform_component']['value'] = $email;
    drupal_set_message("email remains: " . $email);
    drupal_set_message("interest is " . $interest);
    }
}

/**
 * Implements hook_form_alter().
 */
function dealers_form_alter(&$form, &$form_state, $form_id) {
//drupal_set_message("Form ID is : " . $form_id);

if ($form_id == 'webform_client_form_960') {
//drupal_set_message("found form");
$form['#submit'][]='bp_bottled_water_redirect';

}

  // Act only on 'webforms'
  if (isset($form['#node']->type) && $form['#node']->type == 'webform') {

    $require_zip = FALSE;
    if (isset($form['#node']->field_form_display_options['und'])){
      foreach ($form['#node']->field_form_display_options['und'] as &$key) {
        if ($key['tid'] == 13) {
          $require_zip = TRUE;
        }
      }
    }
    switch($require_zip){
      case TRUE:
        $zip = _session_get('zip', '');
        if (dealers_is_local($zip) && $require_zip == TRUE && $zip !== '') {
          $zipinfo = json_decode(file_get_contents('http://zip.elevenbasetwo.com/'. $zip));
          $simplexml_obj = dealers_get_local($zip);
          $form['submitted']['5_digit_zip_code']['#default_value'] = $zip;
          // $form['submitted']['city']['#default_value'] = ucwords(strtolower($zipinfo->city));
          $form['submitted']['state']['#default_value'] = $zipinfo->state;
          $form['submitted']['dealer_e_mail']['#default_value'] = $simplexml_obj->DealerList->DealerRecord->EMail;
          $form['submitted']['dealer_e_mail']['#webform_component']['value'] = $simplexml_obj->DealerList->DealerRecord->EMail;
        }
        else {
          drupal_goto('dealers/'. substr($_SERVER['REQUEST_URI'], 1));
        }
        break;
    }
  }
}

The issue I am having is I can change the values according to the drupal_set_message. But it seems to be taking place after the data is saved. Because the email shown when viewing my submission is still the old one.  I think my code may be running to late.

How can I modify the email address before the data is saved?


texts:
I'm building my first drupal site, and I'm aware there's a huge amount about theming that I don't understand. Right now I'm learning to create custom layouts for specific pages by copying and modifying the template file for that page type (e.g., node.tpl.php -> node-—my-content-type.tpl.php). Now I'm trying to modify the "add content" page for a specific content type. Is there a template file that I can copy and modify, and if so, where can I find it? Or does this page type need to be handled differently?

This is in Drupal 7.

What I've tried:

Modifying node.tpl.php doesn't affect the add content page, nor does creating and modifying node--add.tpl.php nor node--add--my-content-type.tpl.php.
Modifying page.tpl.php does affect the add content page (and all other pages). However...
Copying it to page--node--add--my-content-type.tpl.php (as suggested in this question) causes the add content page for my-content-type to not display at all, so apparently there is some other template info that's needed.


texts: Custom form Edit, populate form field value by ajax (NOT dependent fields)

texts:
I created a views page show the submission rec from custom form.
The SAME page, I embed a form block(add rec) after the views.

What I try to do is when I click the views row/record edit link.
it will populate the the field value to the form block WITHOUT
refresh the form. The "submit" value will change to update of
 course.

I find many examples on ajax just trigger event within same form.
Not by click the link outside the form, any idea ? Some direction please ?


texts: What is the equivalent of hook_user_view()?

texts:
I am basically trying to do what described in How can I let anonymous users view user profiles by role? in Drupal 8. User profiles should only be visible to anonymous users only if those profiles are for users having a certain role; all the other user profiles should not be accessible to anonymous.

The answer there suggests using hook_user_view(), but it appears that hook has been removed in Drupal 8. Is there a different/correct way to do this now?


texts: Add translation only for a particular content type

texts: I don't have much experience in Drupal and I am trying to create multilingual content for a particular content type. I want to switch the language inside the content instead of changing the whole site language. I have used the i18n module to do this but the whole site gets changing. For example I am using right to left languages like Arabic, Farsi etc. I am using views to list the items for this content type.


texts: Form API: fomatting the date select lists?

texts:
I'd like to format my date select input, using the following time formats:

12-hour format of an hour without leading zeros
Minutes with leading zeros

Here's my form definition:

  $form['scheduled_for'] = array(
    '#type' => 'date_select',
    '#title' => t('Scheduled for'),
    '#date_label_position' => 'within',
    '#date_format' => 'd-F-Y g:i',
    '#date_increment' => 15,
    '#date_year_range' => '-0:+3',
    '#default_value' => time(),
  );

However, the hours format as 24-hour format of an hour without leading zeros (code G).

It's as if 'g' is being turned into 'G'. Any ideas? Thanks.


texts: Is there any module which list all hyperlinks from content page

texts:
Hi i want the list of all hyperlinks present in the page.
As i needed to change the path of the all pages to content/mypage/pagetitle.
In my case there are around 5o pages and having more than 100 hyperlinks in each page.
So i want to know any module in drupal which can list all hyperlinks pagewise.
please help if you know anything.
Thanks in advance.


texts: how add js files to create a responsive theme?

texts:
is possible to add these files http://alvarotrigo.com/blog/fullpage-jquery-plugin-for-fullscreen-scrolling-websites/ in a theme? I created from scratch and from Zen without success. some how i think the jquery and javascript files are not active.

thanks


texts:
We have a field, field_text, that we are displaying on the Basic Page content type. It needs to display with double quotes " using twig template. We tried the following below, but it is displaying without the " in the beginning and end.

How can we display the field_text with double quotes (") in twig?

What we tried:

node--page--full.html.twig

<script type="application/ld+json">
  {# None of the following worked #}
  "name" : {{ content.field_text.0 }}
  "name" : {{ '\"' ~ content.field_text.0 ~ '\"' }}
  "name" : {{ '\"' }} {{ content.field_text.0 ~ '\"' }} {{ '\"' }}
</script>


texts: Drupal 7: Views Link display:Custom URL special character issue

texts:
I have a view with more link enabled. And I am trying to link to a node which URL is like eg:

  www.example.com/news?tab-new=3#news-tab_3

but when the link is clicked as an anonymous user the characters in the URL is changed to acii or some other hexa code.

Therefore the link is broken and Page not found is displayed. any suggestion?


texts: Send an alternative email to an anonymous user who placed an order

texts:
I have 2 cases:

A registered and logged in user who gets an email after he placed an order. In that email he gets the token [message:message-commerce-order:view-url] where he can view his order.

An anonymous user gets the same email but: But I'd like to delete the token [message:message-commerce-order:view-url] because an anonymous user can't see that page because he needs to log in.

How do I send an alternative mail to anonymous users after they place an order?


texts: Superfish menu with user id as a parameter

texts: My question is how to get the user id on a URL path when creating a link in a superfish menu.


texts:
I have very specific requirement. I want to show images in slideshow.
I have created content type "User Slideshow Snaps" and two fields

Slideshow Snaps
Node Id

I want to show slieshow of images in field Slideshow Snaps which belongs to Node Id passed in URL.
The slideshow is working perfectly and I have used Modules Views Slideshow & Views Slideshow: Cycle for this.
Now I want to link Slideshow to external page which will pass FID of current image in slideshow like this:-

But I am facing problem in passing fid of clicked image in slideshow.
This configuration is always passing FID of first image in slideshow even if user clicked on 8th image in slideshow.
Thanks in advance for your help.


texts: drupal 7: how to add a field that displays a message when user is not logged in?

texts: I need a way to set up a field available only for logged in users. When anonymous user reach the page that contains this field, drupal must display a message that request to hte user to login or register to display this field. This is the same that appens for comments. There is a module that impelments this for single fields?


texts: Make insert module add uploaded images to media library automatically

texts:
I'm trying to get adding images to work smoothly (more like how wordpress handles it)
I have added WYSIWYG+CKeditor, Insert, Media, Resize Filter (which I can't yet get working).

Right now the main issue is I can insert things from the media library that are already there. But when I'm at the bottom of a post adding an image, I want all added images to go to the media library (especially to make cleaning up unused/replaced images easier for the content editor).

Is there a simple way to set up this behaviour?


texts: How can I add HTML ASCII codes into menu link items?

texts:
Is there a module or method for adding in HTML ASCII codes into menu item links in Drupal 7?

Currently, I want to make the following a link in my footer menu.

&copy; Copyright 1998-2000


texts: Custom currency in Drupal Commerce Shopping cart summary views

texts:
I need to display at the top of the default currency in drupal commerce view the specific currency at the Shopping cart summary view.
Something like on the image

I tried to ad a custom field if footer tof that view but there is no currency options.

Any idea how to do that?


texts:
I am having some trouble configuring my image cropping styles. I have an image I want to crop and scale from 600x800 to 140x140, But I only want the cropping to be from the top. At the moment the cropping is equally from the top AND bottom. How can I achieve this, because I can't find any offset setting although Drupal 7 cropping functionality in the API supports it.

Thanks in advance


texts: Allowing authenticated users to create files through Service/Restful

texts:
I have setup a restful server running with the services module.  I have also enabled to file resource.  Using this setup I can successfully login from my client application, authenticate the session, upload a file using the file resource and then create a node with node resource.  This all works fine and good as long as I am authenticated with an adminstrator but if I ever try and use a standard authenticated user I get this error back in response from the file resource:

Unauthorized: Access denied for user authuser

I looked all throughout the user permissions but I did not see any permission to allow authenticated users to create files.  How would I do this?


texts: How do I set schema.org metatag for products?

texts:
I'm using https://www.drupal.org/project/schema_metatag for my Drupal 8 + Drupal commerce 2 online store and the question is - how to configure fields and what tokens should be used to display products as schema.org Product type?

Thanks you!


texts:
I am reading book 'Drupal 7 module development'.

I am try to follow book to create a hook_schema (I delete some line for better read):

function artwork_schema() {
     $schema['artwork'] = array(
       'unique keys' => array(
         'aid_vid' => array('aid', 'vid'), // there is an 'aid'
         'aid'     => array('aid') // there is also an 'aid'
         ),
     );
     return $schema;
   }

what it is the meaning of the 2 aid?

Does mysql can create duplicate unique index?


texts:
I am using ctools modal dialog/popup window to display some records. The default close button is working fine. How can I add a custom close button?

Thanks


texts: How to pass formatter settings to field theme function?

texts:
I've created a field by implementing hook_field_info, I've created the widget which works perfectly and I've hit a road block with the formatter.

I've implemented hook_field_formatter_settings_form to add some extra output options but I can't work out how to get those values passed to the theme function when the field is rendered.

Here is a simpified version of my code, it's not all the hooks just the ones related to the formatter and the field's theme:

function test_field_formatter_info() {
    return array(
        'test' => array(
            'label' => t('Test'),
            'field types' => array('test'),
        ),
    );
}

function test_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();

  foreach ($items as $delta => $item) {

    $element[$delta] = array(
      '#theme' => 'test',
      '#item' => $item,
      '#myextravalue' => $display['settings']['myextravalue'],
    );
  }

  return $element;
}

function test_theme() {
  return array(
    'test' => array (
      'variables' => array('item' => NULL, 'myextravalue' => NULL),
    ),
  );
}

function theme_test($variables) {
    $item = $variables['item'];
    ...
    return $output;
}

The widget, field and formatter are working fine, I just can't work out how to get the formatter settings that were defined by hook_field_formatter_settings_form to the test theme function.

When I $variables variable I only see an array for item. myextravalue is not there!

There is very little information on how to create fields/widgets/formatters for Drupal 7 and I'm pulling my hair out with this.


texts: Webform, creating customized directories for uploaded files

texts:
Newbie and my first question on here. I'm still learning Drupal. So apologies if I missed anything

Here is my issue
I am using Webform to create an upload page. The user enters an ID(text field) and uploads the file. The file gets uploaded to a private section on the server. Now I am trying to make sure that the file gets uploaded into this separate folder(named after the ID)( say all/private/ID/). Can I do that using a Webform ? For now, all I can use are basic tokens,not values I can grab from other fields(ex: %username) to create these directories.

If webforms are not the answer, what else would be a good method to go about it ?


texts: How can I set an API key, which contains equal sign set at Drush site-install?

texts:
When I use the drush site-install command and a form value contains the equal sign (an API key for example), then Drush cuts the value at the equal sign. For example:

  drush si -y profile_name
       --account-name=...
       --account-pass=...
       --db-url=mysql:...
       form_name.field_name="e+gklgfssdk=jgfsfg/11iXP6VJM0MjDpRk2MEKyc="

The value of the form_name.field_name at install will be "e+gklgfssdk", the last characters are missing, Drush cuts the value at the equal sign. This is a bug? Or how can I set the correct value?


texts: Prevent accessing files in Drupal files folder directly by following link

texts:
I have member area on my site, and there i have files available only to members. (also, not to all members, but to members of some role, and also they are further granulated by field condition, but that is a long story :)

But technically, anyone can download a file, if knowing the link to the file.

I would like to prevent downloading files by direct link, or by being logged of site.

It would be perfect if i can execute a script when someone asks for file by direct linking, to check if user is logged in, if he has a role that grants him download.

But if that is not possible, i would like to disable accessing files directly, they should be only accessible by browsing the site.

Thanks for clues


texts:
I'm developing a module that uploads CSV file.

/**
 * Implements hook_menu().
 */
function geo_points_menu(){
    $items['geo-points-upload'] = array(
        'title' => 'Geo points',
        'description' => 'Upload users',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('geo_points_form'),
        'access arguments' => array('access content'),
        'access callback' => TRUE,
        'type' => MENU_NORMAL_ITEM,
        'menu_name' => 'main-menu',
    );

    return $items;
}

function geo_points_form($form, &$form_state) {
    $form = array();

    // Use the #managed_file FAPI element to upload a file.
    $form['file_fid'] = array(
        '#title' => t('File'),
        '#type' => 'managed_file',
        '#description' => t('The uploaded file will be processed.'),
        '#default_value' => variable_get('file_fid', ''),
        '#upload_validators' => array(
            'file_validate_extensions' => array('csv'),
        ),
        '#upload_location' => 'public://csv_uploads',
        '#process' => array('geo_points_my_file_element_process')
    );

    $form['buttons']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Import'),
    );

    return $form;
}

/* It disables the default upload button that comes with this #managed_file form */
function geo_points_my_file_element_process($element, &$form_state, $form) {
    $element = file_managed_file_process($element, $form_state, $form);
    $element['upload_button']['#access'] = FALSE;

    return $element;
}

function geo_points_form_submit(&$form, &$form_state) {
    // Load the file.
    $file = file_load($form_state['values']['file_fid']);
    dpm(csv_to_array($file->uri));
    file_usage_delete($file, 'geo_points');
//    // Change status to permanent.
//    $file->status = FILE_STATUS_PERMANENT;
//    // Save.
//    $uploaded = file_save($file);
//    if ($uploaded == TRUE) {
//        dpm(csv_to_array($file->uri));
//    }
//    else {
//        drupal_set_message(t('The file could not be uploaded. Please contact the site administrator.'), 'error');
//    }

    //$file_path = $file->uri;

    //Function call to process file contents.
    //csv_import_create_node($file_path);

}

/**
 * @param string $filename
 * @param string $delimiter
 * @return array|bool
 */
function csv_to_array($filename='', $delimiter=',')
{
    if(!file_exists($filename) || !is_readable($filename))
        return FALSE;

    $header = NULL;
    $data = array();
    if (($handle = fopen($filename, 'r')) !== FALSE)
    {
        while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
        {
            if(!$header)
                $header = $row;
            else
                $data[] = array_combine($header, $row);
        }
        fclose($handle);
    }
    return $data;
}

When I upload the same file more than one time I'm getting the following exception:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://csv_uploads/points2014-01-16T14-22-48.csv' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => points2014-01-16T14-22-48.csv [:db_insert_placeholder_2] => public://csv_uploads/points2014-01-16T14-22-48.csv [:db_insert_placeholder_3] => text/csv [:db_insert_placeholder_4] => 84 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1390315536 ) in drupal_write_record() (line 7170 of C:\wamp\www\drupal7_poc2\includes\common.inc).

I have 2 questions:
1. How avoid this exception.
2. After I upload the file and read it's content I don't the file anymore, can I read the stream only without saving the file?


texts:
I'm looking for a way to add a class field to Drupal's image field (field_image). At the moment my images are displayed using code like this:

I'd like to add a class field so that the code would be like so:

I think I could achieve this by adding a field to the content type to store the class name - I could then use views to add the class value to the image's parent DIV. However, I suspect there's a way to add a class field to the image field itself - it's not uncommon for images to have classes ;)

I've tried the File Entity module, which according to the documentation allows you to create custom file types. Sadly it doesn't explain how.

Any pointers / suggestions would be much appreciated.

Edit: To clarify, I'd like to be able to add classes on a per image basis. Some images might need the classes portrait floatLeft, others might need landscape floatNone and so forth.


texts: Drupal 8 - how do I extrat the URL path from node title

texts:
I can print title of my content-type using {{ fields.title.content }}. and it renders like Title of the content. I have created a View (view mode: field) and showing a list of available products on that page. To customize look and feel of the page I copied views-view-fields.html.twig file from core/themes/stable/template/views under my theme's template directory and customized it the following way.

        {{ fields.field_product_image.content }}

{{ fields.title.content }}

{{ fields.field_product_summary.content|striptags|convert_encoding('UTF-8', 'HTML-ENTITIES') }}

        {{ fields.field_category.content }}&nbsp;|&nbsp;
        Price: {{ fields.field_product_price.content }}&nbsp;
        View &raquo;

The title itself is linked to product's page. But I have an additional View button which I want to link to the product page separately as well. In order to accomplish the same I tried to extract the URL part from the title with {{ path('entity.node.canonical', { 'node' : node.id}) }}. But it gives me the following error message.

  Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "node" for route "entity.node.canonical" must match "\d+" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 193 of core\lib\Drupal\Core\Routing\UrlGenerator.php).

I am referring to this article:
https://chromatichq.com/blog/creating-links-within-twig-templates-using-path-and-url

What I did wrong?

This is what I want to achieve:

I used {{ dump(fields.title.content) }} to see if I the URL could be accessible, but there was nothing like it.


texts: Email Users Daily with Content Containing Terms Also in User Profile

texts:
Users on my site add their "interests" via an autocomplete term reference field on a Profile2 form (adding to the "Interests" vocabulary).  I would like to send the users a daily email of content tagged with those same terms listed in their profile.

I would also like to format this content a bit so it is aesthetically appealing - rather than just plain links to the related content.  Maybe something like themed 'teasers' for the content.
I would like to just show the 2 most recent posts for 2 different types of content (both having the matching "interest" terms to the user, of course).
I have a view set up that currently displays the above information in a block, but again I would like this as a daily email.  I thought this view could maybe just be inserted in rules, but this seems not to work as the contextual filter is based off the 'logged in user'

I was thinking this could be accomplished through Rules, but I have not yet figured out the right arrangement.  Or perhaps a modified daily simnplenews newsletter with a view insert could work?


texts: settings.php not in expected location(s)

texts:
We are trying to change the database settings for a long-standing drupal 6 site, but are having trouble finding the correct settings.php file:

$ cd /var/www/vhosts/mysite
$ find sites/ -name "settings.php*"
sites/default/settings.php.save
sites/default/settings.php.mod2
sites/mobile.mysite.com/settings.php
sites/mysite.com/settings.php
sites/mysite.com/settings.php.pre_handoff_unedited
sites/mysite.com/settings.php~
sites/mysite.com/settings.php.20131022

We renamed the two most likely suspects, but the sites continues to run smoothly:

sites/mobile.mysite.com/settings.php_hold
sites/mysite.com/settings.php_hold

I also looked for a sites.php that might be overriding settings.php, but we don't seem to have one of those either:

$ find sites/ -name "*sites.php*"
$

Which means I can't find a sites.php or settings.php anywhere in the web directory that seems to control drupal.

We have nginx set up to receive http requests and mysite.com requests are forwarded to apache.  Could that be relevant?  Where else I might look for the drupal config settings?


texts: REST Service - 500 Internal Server Error

texts:
I has been trying to set up a drupal REST Server in my computer (a clean drupal 6  installation). Unfortunately, I could not configure it. When I send a POST message (WITHOUT parameters);
ht.p://localhst/drupal/?q=note/note/retrieve or  ht.p://localhst/drupal/?q=note/user/login, it replies 500 Internal Server Error.
I used this example (I copied and pasted the example to sites/all/modules)  https://drupal.org/node/783460.
It is a drupal 6.28 in a Debian with Apache2. It has not configured clean URLs!
I am using the module Services (6.x-3.4-rc1) and Rest Server (6.x-2.0-beta3).
I checked the /var/log/apache2/error.log

[Sun Jun 23 17:11:24.136866 2013] [:error] [pid 2957] [client ::1:48424] PHP
Fatal error:  Call to undefined function services_resource_uri_formatter() in /var/www/drupal/sites/all/modules/rest_server/includes/RESTServer.inc on line 15

I have another doubt, how is it possible to test these services easily? These error messages for me are  not intuitive. I was using drush with watchdog but
I didn't give more information.
Regards.


texts: Views: How to display a grouped taxonomy list with node count?

texts:
I'm building a classifieds section of a website. Is it possible to create a grouped taxonomy list (by parents) with a node count at the end?

Essentially this is what I want to appear:

Currently, this is my BuySell content type node.
I have two taxonomy vocabularies: BuySell Category and Location.

Lastly, here is a snapshot of my taxonomy vocabulary buysell:

I'm trying to use Views to create the list, however I'm not sure how to get them to group nicely together by parent terms. I can output all terms though.

Any help is greatly appreciated.


texts: How to use FilterProcessResult::createPlaceholder (#lazy_builder) in an input filter?

texts:
The FilterProcessResult::createPlaceholder method suggests that I can set a PHP callable that will allow me to return a render array. However my callable is not being called when visiting a node using Drupal 8.0.x.

I do not see any error messages in watchdog or in the PHP log.

What should I be doing in order to get FilterProcessResult::createPlaceholder() to call my callable?

Code

  public function process($text, $langcode) {
    $matches = [];
    $result = new FilterProcessResult($text);

    $count = preg_match_all('/\[processing\](?P<code>.*)\[\/processing\]/is', $text, $matches);

    if ($count) {
      $i = 0;
      foreach ($matches['code'] as $i => $code) {
        $args = [$code, $this->settings['render_mode']];
        $markup = $result->createPlaceholder('\Drupal\processing\Plugin\Filter\FilterProcessing::build', $args);
        $text = preg_replace('/\[processing\](?P<code>.*)\[\/processing\]/is', $markup, $text);
      }
      $result
        ->setProcessedText($text)
        ->setAttachments(['library' => ['processing/drupalprocessing']])
        ->setCacheTags(['processing']);
    }

        return $result;
      }

  static public function build($script, $mode) {
    $id = uniqid('processing-');
    $canvas_classes = ['processing-js-canvas', 'processing__canvas'];
    $render = [
      '#type' => 'container',
      '#attributes' => [
        'class' => ['processing-wrapper']
      ],
      'canvas' => [
        '#theme' => 'processing_display',
        '#rendermode' => $mode,
        '#unique' => $id,
        '#code' => $script,
        '#attributes' => [
          'class' => $canvas_classes,
          'id' => $id,
        ],
        '#attached' => [
          'drupalSettings' => [
            'processing' => [
              'drupal.processing' => [
                'elementId' => $id,
                'renderMode' => $mode,
              ]
            ]
          ]
        ],
      ],
    ];
    return $render;
  }

See commit 9d84e9477515bce1b7dd15f9724da1c6c0bd0fc2

HTML Output

<drupal-filter-placeholder callback="\Drupal\processing\Plugin\Filter\FilterProcessing::build" arguments="0=%0A%20%20%20%20%20%20%20%20size%28200%2C%20200%29%3B%0A%20%20%20%20%20%20%20%20background%28200%29%3B%0A%20%20%20%20%20%20&amp;1=source" token="bd5dbeba"></drupal-filter-placeholder>

I am running a settings.local.php with cache disabled on a local VM, but I got the same result without it.


texts: how to create node for ecommerce display page?

texts:
I am new to drupal ecommerce.

I created one product type as service for that I have to create a service  display content type using node, how can I create this node ? and how to enable that node ?

Thanks,

Vinudha


texts: How can I change active theme for specific paths or inside module?

texts:
I'm working on an online game engine website where users can create games online and other can play it.

All pages are displayed in normal theme except game play page which should be in full screen mode inside a minified version of main theme.

I know themekey is useful and I can change theme with it. but I don't want use a complex module for this purpose. is there any API function for changing theme inside module on specific paths?


texts:
I have a content type with one paragraph field which has a checkbox and a text field.

By default, the text field is optional. I want to make it required when the checkbox is checked. Conditional fields module does not work with paragraphs properly. I tried with #states, but this just adds a class. It doesn't make the field required in the back-end.

Maybe I should write a custom validation. How can add it for paragraph field with two fields inside?


texts: Admin Config page for my module is empty

texts:
I created a module (namely, "casabaca_s3s") and set a configure entry in the casabaca_s3s.info file:

configure = admin/config/content/casabaca_s3s

Now my "Configure" appears in the module.

Then, i added, in my casabaca_s3s.module file, the following code:

And my hook:

function casabaca_s3s_menu()
{
    return array(
        'admin/config/content/casabaca_s3s' => array(
            'title' => 'Casabaca',
            'description' => 'Configuración de Casabaca',
            'page_callback' => 'drupal_get_form',
            'page_arguments' => array('casabaca_s3s_admin'),
            'access arguments' => array('administer casabaca_s3s pages'),
            'type' => MENU_NORMAL_ITEM,
        ),
    );
}

And my handler for the hook:

function casabaca_s3s_admin() {
    return system_settings_form(array(
        'casabaca_s3s_modelcosts' => array(
            '#type' => 'managed_file',
            '#title' => t('Modelos y kilometrajes'),
            '#description' => t("Archivo .csv con el contenido de la tabla de precios según modelo y kilometraje"),
            '#required' => true,
            '#upload_validators' => array(
                'file_validate_extensions' => array(0 => 'csv'),
                'file_validate_size' => array(32*1024*1024),
            ),
        ),
        'casabaca_s3s_extracosts' => array(
            '#type' => 'managed_file',
            '#title' => t('Costos de servicios adicionales'),
            '#description' => t("Archivo .csv con el contenido de la tabla de precios de servicios extra"),
            '#required' => true,
            '#upload_validators' => array(
                'file_validate_extensions' => array(0 => 'csv'),
                'file_validate_size' => array(32*1024*1024),
            ),
        ),
    ));
}

Problem: When I click "Configure" button in module listing (the one with the gear), it redirects to admin/config/content/casabaca_s3s, but that page is empty, showing standard message: "No tiene ningún elemento administrativo." (trans. You have no administrative elements). What am I missing to display the form?


texts: I would like to know how to change the input format (automatically or by sql ) for all articles in my website, because I migrated from D6 to D8 and I face a nasty bug that requires to edit all my nodes (more than 2000) manually and set either filtered HTML or FULL HTML format to all nodes.


texts:
I have create a webform and i want to configure it sending emails with smtp authentication. I have install the SMTP authentication module also, but i cant find any option that allows me to setup webform for using smtp.

Is this possible? Any advice?


texts: Module that allows to compare, edit and/or merge revisions

texts:
At the moment I have installed on my site the Diff module, which allows me to compare the content of 2 revisions but I need a module that allows me to not only see the differences between revisions, but also to edit both revisions at the same time while comparing them and to copy the content of a field to either revision (like WinMerge or many other diff/compare applications)

I am well aware that revisions shouldn't be used this way, but i'm using the revisions system to allow unregistered users to post edit suggestions about my site's content so being able to copy only certain fields (since a suggestion might include both correct and incorrect data for different fields) in the current revision would save me a lot of time


texts: How to hide a published Taxonomy page unless you're an authorized user?

texts:
I have a link on my website, I'm currently using Taxonomy Access Control Lite, I have a Taxonomy vocab "Manitoba" and I would like to not let the contents of this page be seen unless the user logged in has the permission role to view it.

How would I go about hiding contents from a page belonging to a taxonomy and all the sub-pages that entail?


texts: How do I clear settings from the Drupal object?

texts:
I have a module, which renders an AJAX form, which passes data to a script via drupal_add_js and stores it in the settings property of the Drupal object. My problem is that I cannot seem to remove old data from the object (a user can toggle options on the form and send new datasets to the javascript). Logically, I thought passing an empty array would clear the values, but it doesn't.

// Clear old data from settings.
$js = array(
  'd3' => array(
    'inventory' => array(
      'chart' => array(
        'dataset' => array(),
      ),
    ),
  ),
);
drupal_add_js($js, 'setting');

I need something like drupal_remove_js($js, 'setting')? or a method for removing object properties?


texts: How can I use Migrate Extras to get custom media fields to migrate?

texts:
I'm a bit at the end of my rope in trying to get file fields to show up as possible destinations for my Media module migration.  I have Media 7.1.x installed because as best I can tell, that must be the version that Migrate Extras was supporting.  I'm trying to import files into the Other file type, so I have the following:

$this->destination = new MigrateDestinationMedia('other');
$this->map = new MigrateSQLMap($this->machineName,
      array(
        'id' => array(
          'type'        => 'int',
          'length'      => 11,
          'not null'    => TRUE,
          'description' => 'File ID',
          'alias'       => 'f',
        ),
      ),
      MigrateDestinationMedia::getKeySchema()
    );

Unfortunately I cannot get the field I added to the Other file type to show up as an available destination field in Migrate UI.  Any help on what I'm doing wrong here, or even a code snippet where someone has successfully done a media migration (for files, not youtube or anything fancy like that), would be greatly appreciated!

Update: I'm most of the way there, but my fields still aren't coming in.  Here is the array I created:

I create a $row->fields_array that looks like:

[fields_array] => Array
    (
        [0] => Array
            (
                [field_doc_public] => 1
                [field_testing_testing_testing] => UE2_3009.pdf
            )

        [1] => Array
            (
                [field_doc_public] => 0
                [field_testing_testing_testing] => UE2_3009.doc
            )

    )

I really only need the field_doc_public field to be filled in, but I added field_testing_testing_testing to test as you might guess from the name.  The field machine names are field_doc_public and field_testing_testing_testing.

The code in the actual migration looks like:

    $this->addFieldMapping('field_doc_pub_files', 'file_source_file');
    $this->addFieldMapping('field_doc_pub_files:file_class')
        ->defaultValue('MigrateEntityFileUri');
    $this->addFieldMapping('field_doc_pub_files:fields', 'fields_array')
        ->description(t('Populate the fields.'));
    $this->addFieldMapping('field_doc_pub_files:destination_dir')
        ->defaultValue('private://pub_docs');
    $this->addFieldMapping('field_doc_pub_files:destination_file', 'file_dest_filename');
    $this->addFieldMapping('field_doc_pub_files:file_replace')
        ->defaultValue(MigrateFileBase::FILE_EXISTS_REUSE);
    $this->addFieldMapping('field_doc_pub_files:preserve_files')
        ->defaultValue(FALSE);
    $this->addFieldMapping('field_doc_pub_files:display', file_public);

Any help on that last little push over the finish line would be greatly appreciated.  (Note: no destination for the fields shows up in Migrate UI either)


texts: Paragraph migration for link field not working

texts:
I have below migration script for paragraph migration, where I have 2 fields,
(1) icon_type --> List(text) field type
(2) icon_url --> Link field type
UPDATED WORKING CODE BELOW
If I run the migration script only icon_type is created but not the icon_url
id: icon_type_link
label: Icon Type Link
migration_group: devel
source:
 plugin: csv
 path: 'modules/custom/my_custom_module/data/icon_type_link.csv'
 keys:
   - id
 header_row_count: 1
destination:
 plugin: entity:paragraph
process:
 type:
      plugin: default_value
      default_value: icon_type_link
 uuid: uuid
 entity_id: entity_id
 icon_type: icon_type
 icon_url/uri: url
 icon_url/title: title
migration_dependencies: {}


texts: How to create internal links during user navigation

texts:
I would like to allow users to create links between pages within the website. This wouldn't even be a problem if I asked them to edit the page, but I would like to avoid the editing step in order to make their navigation more fluid.

What I have in mind more specifically is an empty field (like a search box) on each relevant page in which the user could just copy-paste an internal URL, which would then be processed by the system to create the link between the two pages.

I have no problem seeing how I could do that once the information is entered, but I have no idea of how I could do to integrate an empty field in my page and use it in the way I described.

Any hint? Thanks! :)

Igor


texts: how to convert a timestamp into a date format in a custom module

texts:
I created a custom module and printed this outcome in .csv.

Name,Event,Email,Timestamp
Ea Iustum Jus,Fifa,example@asdf.wer,1573924224

How do I convert the timestamp in a date format?

I tried with $select->addField('c','created',"DATE_FORMAT(FROM_UNIXTIME(created), '%d.%m.%Y %H:%i'"); and $select->addField('c', 'created', date('m-d-Y',$select));.

This is the complete code in mymodulecontroller.php.

/**
 * @file
 * Contains \Drupal\mymodulelist\Controller\ReportController.
 * - it works but timestamp needs be converted to human readable date ??
 * - $select->addField('c', 'created');
 */
namespace Drupal\mymodulelist\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database\Database;
use Symfony\Component\HttpFoundation\Response;

/**
 * Controller for mymodule List Report in .CSV
 */
class DownloadCSVController extends ControllerBase {

 /**
   * Gets all mymodules List for all nodes.
   *
   * @return array
   */
  protected function load() {
    $select = Database::getConnection()->select('mymodulelist', 'r');
      // Join the users table, so we can get the entry creator's username.
    $select->join('users_field_data', 'u', 'r.uid = u.uid');
      // Join the node table, so we can get the event's name.
    $select->join('node_field_data', 'n', 'r.nid = n.nid');
    // Select these specific fields for the output.
    $select->join('mymodulelist', 'r', 'r.mail = r.mail');
    // Select these specific fields for the output.
    $select->join('mymodulelist', 'c', 'r.created = c.created');
    // Select these specific fields for the output.
    $select->addField('n', 'title');
    $select->addField('u', 'name', 'username');
    $select->addField('r', 'mail');
    // how to create a date format from unix timestamp to d-m-Y for the field created ??
    $select->addField('c', 'created');
    // I tried this 2 options
    // 1. $select->addField('c', 'created',"DATE_FORMAT(FROM_UNIXTIME(created), '%d.%m.%Y %H:%i'");
    // 2. $select->addField('c', 'created', date('m-d-Y',$select));
    $entries = $select->execute()->fetchAll(\PDO::FETCH_ASSOC);
    return $entries;
  }
}


texts: I want to save a webform as draft for logged in user. I read somewhere that this a default feature but not able to find out. I could not find this option "Allow users to save a draft" in the form settings(Using Drupal7 and webform 3.13). Please suggest.


texts: Is there a field type that offers structured entry that gets rendered as a table?

texts:
In the creation of a content type, is there a field type that offers structured entry that gets rendered as a table?

I'm creating an event node, and on the 'full content' display, there are 'sessions' at the event.

Doing a table in the CKeditor isn't enough, and referencing nodes of a different type is too much.

I need something that starts with these columns and one blank row at the bottom, where the end user/content manager can add information like "Date (datepicker)  |  Discussion Topic  |  Room  |  Timeslot(timepicker)  |  Speaker."

Adding information in each column will cause a new blank row for entry.
When the whole node gets submitted, and rendered in 'full-content' display, a table is rendered with that data, as entered on the backend.

Any suggestions on where to look?


texts:
I have created a new menu and I'm trying to limit the access to a particular user to edit instead of role with the following code but it's not working, I still can't see the menu and edit the menus items by logging in with the relevant user login (user id 3 in this case). Wondering what's the proper way of doing.

/**
 * Implements hook_menu().
 */

function menu_access_by_uid_menu(){
  $items = array();
  $items['admin/structure/menu/manage/new-menu'] = array(
    'title' => 'New Menu',
    'access callback' => 'menu_access_by_uid_validate',
  );

  return $items;
}

function menu_access_by_uid_validate() {

 global $user;

 if (user_is_logged_in() && ($user->uid == 1 || $user->uid == 3)){
   return TRUE;
 }

 return FALSE;
}


texts: How to flag the node that is referenced via an entity form submission with rules?

texts:
I am trying to recreate an "enquiry basket". I am using Entityform, Inline Entity Form, Rules, Views and Flag.

I have a node content type called Custom product. I am referencing different entity forms from each product node. As soon as the entity form is submitted I want to flag the referenced node, with its form entity form values, thus creating an basket that can be submitted as a whole, grouped by date.

My problem comes in when creating the rule.

I have a rule :

  Event : After saving a new entity form submission.

My problem is that I can't seem to get to the referenced node and "flag" it.

How does one get to the referenced node from a entity form and flag it via rules?


texts:
I'm building a site which needs the ability to show a daily market values table, that is daily fed by the admins.

The idea is to compare the previous value for each cell and depending on the variation (positive|negative|equal) apply a different color/style to that cell on the output.

Do you know a way to accomplish this requirement without making it from scratch?

Here it is an attachment so you can figure out the expected layout.

Many thanks!!


texts: How to create Drupal Articles Thumbnails and display it on homepage

texts:
I would like to know what is the BEST WAY to generate thumbnails in drupal?
I need to create a semi news style website in Drupal that requires me to GENERATE THUMBNAILS AUTOMATICALLY from Articles I created. I attached a sample website screenshot from a similar website I am trying to imitate.

Is there a Good Drupal module can you recommend? or much better a Drupal function I can insert in PAGE.TPL.PHP to generate thumbnails from my articles or posts and display it in the front page?

Thank you in advance sirs.


texts: How to solve claimitem() in batch process?

texts:
I am doing batch process in D8.
here is my code:
This code is in Controller.php

$batch = array(
          'title' => t('Started Importing node Data.'),
          'error_message' => t('Error!'), //Error Message
          'finished' => 'node_data_import_batch_finished',
        );
        $count_nodes = '';
        $j = 0;
        $data_chunk = array_chunk($csv, 100);
        foreach ($data_chunk as $node_created) {
          $count_nodes += count($node_created);
          $batch['operations'][] = array('node_data_import_batch', array($node_created,  $keys));
          $j++;
        }
        batch_set($batch);

And callback function is in .module

function node_data_import_batch($node_created,  $keys){
//Code here
}

function node_data_import_batch_finished($success, $results, $operations){
 if ($success) {
    $message = "Batch Process Successfully executed for Node Data.";
    drupal_set_message($message);
  }
}

I am getting error like this.
Any help will be appreciable
Thanks.


texts: Is there a token for the key of a text list?

texts:
I need to get the key of the key|value pair from a text list field in a token.

Say the field configuration shows the following options:

no|No Way Jose!
yes|Why yes, that'd do nicely!

and the field is named field_doc_textlist

the token [node:field_doc_textlist] is returning a value like 'No Way Jose!' when what I want is 'no'.  Is there a way to get that from tokens.  I'm using this in the filefield paths module if that matters.

I saw other similar answers here, with no real answers, but I've tried [node:field_doc_textlist:key] [node:field-doc-textlist] [node:field_doc_textlist:machine_name] [node:field_doc_textlist:machine-name] all to no avail

Some additional information: All of the above result in an error similar to

  The File path is using the following invalid tokens:
  [node:field-doc-type-book].

A lot of the information I've found suggests using the hyphenated version of the token name instead of the underscore version, but that seems not to work at all.


texts: How to solve this PHP fatal error after installing module?

texts:
PHP Fatal error:  Cannot redeclare _field_info_field_cache()
  (previously declared in
  C:\xxxx\wwwroot\xxxxx\modules\field\field.info.inc:16) in
  C:\xxxxx\wwwroot\xxxxxxx\sites\all\modules\easy_booking-7.x-2.4\modules\field\field.info.inc
  on line 32

So I got this error notification after turning on Error debug in my IIS Server because previously it only showed a 500 page error.

It seems it's calling two times the same function? Anyone can help?

Edit: I guess it's better I just delete the module but then I get a require_once error:

  PHP Fatal error:  require_once(): Failed opening required '


texts: Commerce Pricing Rules Not Applying During Checkout

texts:
I have a pricing rule that's defined essentially along the lines of the one described here, and it appears correctly when I add items to the cart. But as soon as I progress to the check out the prices all revert to their base price not the discounted price.

With the Rules debugging enabled all the rules appear to fire, but the calculation doesn't appear to be saved correctly. Since there aren't a lot of hits in Google for this (or at least for the various search terms I can think of) I presume we're doing something odd that's causing trouble, but I've slowly removed every complexity I can so I'm as close to the user guide example as I can all without success.


texts: Multiple image sizes from one uploaded image?

texts:
In my content type, I've got an image uploader. That image then gets processed by an Image Style that scales the image. I want to produce multiple scaled sizes of that image though. So essentially, I need to assign multiple Image Styles to that one image upload. In the UI, I can only assign one. This is Drupal 7, by the way.

So, for example: I start by uploading an 800x600 image and I've applied an Image Style to output it at 400x300. Now I want to apply another Image Style to get a 200x150 version. And so on...

Surely, I'm missing something here! Seems like a straightforward request. Thanks in advance!


texts:
I am getting a "terminated" message from Drush ARD command after it runs awhile. This happens in a shared environment on bluehost. I checked the error logs accessible via cpanel, but found nothing. There are also no messages in the Drupal error log. I need more information that just "terminated" to solve this problem. Where are Drush error messages logged?

Putty commands -

    Using username "columck5".
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
Last login: Fri Nov  6 10:51:16 2015 from 98.142.53.79
columck5@columbiablooms.org [~]# drush status
 PHP executable         :  /ramdisk/php/54/bin/php54-cli
 PHP configuration      :  /usr/php/54/etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home5/columck5/.composer/vendor/drush/drush/drush.p
                           hp
 Drush version          :  7.1.0
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :

columck5@columbiablooms.org [~]# cd /usr/php/54/etc
columck5@columbiablooms.org [/usr/php/54/etc]# ls -l
total 160
drwxr-xr-x 5 root root  4096 Nov  6 05:17 ./
drwxr-xr-x 5 root root  4096 Nov  6 05:17 ../
drwxr-xr-x 2 root root  4096 Nov  6 05:17 pear/
-rw-r--r-- 2 root root  1176 Jul 13 15:25 pear.conf
drwxr-xr-x 2 root root  4096 Nov  6 05:17 php.d/
-rw-r--r-- 2 root root 67071 Oct 29  2014 php.ini
-rw-r--r-- 2 root root 66936 Jul 23  2012 php.ini.rpmnew
drwxr-xr-x 2 root root  4096 Nov  6 05:17 rpm/
columck5@columbiablooms.org [/usr/php/54/etc]# nano php.ini
Error writing php.ini: Read-only file system
chmod gets the same error message


texts: How can I adjust Drupal links on shared hosting so that they don't point at the root?

texts:
I have installed Drupal on shared hosting. Drupal is installed in the public_html folder of an Apache user directory (UserDir). Unfortunately, I notice that Drupal always defaults its administrative links to the root, for example: http://www.domain.com/?q=admin. I don't want this, since my site is located in the user directory. Therefore, I want Drupal links to look like: http://www.domain.com/~sitename/?q=admin. How do I get this to happen when the url contains a tilde?

Is there a setting(s) I can change to make a global adjustment?

Thanks in advance,
Doug


texts: How can I get webform file upload to display a thumbnail instead of a link?

texts:
I have a webform with a file field.
When I upload the file I want to return a thumbnail of the file.

Is this possible? If so how can I achieve this?


texts:
I am trying to get json response from my drupal7 site using Views.

Example : www.mysite.com/company company refers to a view which was created using json document

I also applied caching to the Company view as shown below

Yet, It is taking much time to load the web service. (nearly 8 sec). total records are around 200 posts. Further, the records will be increased to more number.

I also tried Boost module and set max and min time for cache to 1 hour and 0 sec. But still same problem.

I also edited .htacces file.

Can anyone suggest any solution so that i can enhance the performance of the site as well as mobile app.

Thank you


texts: Using views, how to keep details hidden until user performs filter/search

texts:
I created a view through which users can filter/search for users on my site based on a certain number of criteria (3).

My challenge is how to hide the results of the filter until someone performs a filter or search. At the moment, the view shows all users on my site by default. I found out making one of the filter criteria 'required' hides the users, however this prevents users from being able to filter independent of the 'required' criteria.

Thank you.


texts: Menu link tree only loads enabled elements in subtree regardless of parameters

texts:
When loading a menu tree without any custom parameters:
$tree = \Drupal::menuTree()->load('my-menu-name', new MenuTreeParameters());

The returned tree \Drupal\Core\Menu\MenuLinkTreeElement[] includes disabled items, which is what I want. I did not set onlyEnabledLinks() or addCondition('enabled', 1) to the MenuTreeParameters.
For some reason, though, every subtree returned beyond the root level excludes disabled items. Even if I re-query each subtree, it still happens:
foreach ($tree as $element) {

    // Do stuff

    $parameters = new MenuTreeParameters();
    $parameters->setRoot($element->link->getPluginId())->excludeRoot();
    $subtree = \Drupal::menuTree()->load('my-menu-name', $parameters);
}

The only way I have found to include disabled items so far has been to re-query each subtree twice with $parameters->addCondition('enabled', 1); and $parameters->addCondition('enabled', 0);, which is ridiculous.
I can't find anything in the documentation to suggest this is the correct behavior of Drupal, but I'm hoping someone can spot something I'm missing before I submit a bug report. This is in Drupal 9.1.


texts:
I have two different blocks.
One has a form and the other one is a view with some files uploaded from the form above.

On submit of the form I need to update the view results.
I thought I could do it using js but I can't make it work.

Please check my code. Any advice would be helpful!

Drupal.behaviors.myViewsRefresh = {
    attach: function( context , settings) {
        var viewName = 'application_documents';

        // Your views should be Ajax enabled
        var instances = Drupal.views.instances;
        var myViews;

        // then simply need to iterate through the various
        // views instances name to find the view
        $.each( instances , function getInstance( index, element){
            if(element.settings.view_name == viewName ){
                myViews = '.view-dom-id-' + element.settings.view_dom_id;
            }
        });

        $(document).once('mysubmitbutton').ajaxComplete(function(event, xhr, settings){
            if(typeof myViews !== 'undefined'){
                $(myViews).trigger('RefreshView');
            }
        });

    }
}

I can get into the ajaxComplete but the view doesn't reload. The view id is correct.

Thank you in advance.


texts: Help solve this error: Class CommerceLicenseEntityController does not exist

texts:
When I install the Commerce Licence module, in D7, I get this error. I think it might have to do with my Drupal installation, I'm not sure.
What steps can I take to find out what causes this?

The whole warning texts is (2 warnings):

Warning: class_implements(): Class CommerceLicenseEntityController does not exist and could not be loaded in entity_entity_info_alter() (line 1480 of /data/disk/o1/distro/002/drupal-7.54.2-dev/sites/testsite.com/modules/entity/entity.module).

Warning: in_array() expects parameter 2 to be array, boolean given in entity_entity_info_alter() (line 1480 of /data/disk/o1/distro/002/drupal-7.54.2-dev/sites/testsite.com/modules/entity/entity.module).


texts: Where do I get a webhook url for a facebook messenger bot?

texts:
I want to check out and explore this interesting drupal module made by the white house: https://github.com/WhiteHouse/fb_messenger_bot

I've successfully installed drupal on my Mac thru MAMP. I've also enabled the said module. But I got stuck on this step of the installation instructions as stated in the README:

"Complete steps 1-4 outlined in Facebook's quickstart documentation including the copying of the page access token in step 3 (note: this module sets up the webhook at /webhook/contact)"

To be more specific, Facebook is asking for a callback url, but I can't find it. Whenever I type https://localhost:8888/webhook/contact as the callback url, Facebook gives me this error message:

The URL couldn't be validated. Callback verification failed with the following errors: curl_errno = 56; curl_error = Received HTTP code 502 from proxy after CONNECT; HTTP Status Code = 502; HTTP Message = Private address

I am completely new to drupal and MAMP. Any help that would point me towards the right direction would be greatly appreciated. Thank you very much!


texts: Providing menu route parameter values from url

texts:
Suppose I have the following route in my ej.routing.yml file:

ej.form.user.profile:
 path: '/user/{user}/ej_profile'
 defaults:
   _title: 'EJ Profile'
   _form: '\Drupal\ej\Form\User\ProfileForm'
 requirements:
   _role: 'authenticated'
   user: \d+

Now I want to add a menu based on the above route to Tools menu. So I use the following in ej.links.menu.yml file:

ej.user.profile:
  title: 'EJ Profile'
  description: 'EJ Profile'
  route_name: ej.form.user.profile
  menu_name: tools
  weight: 100

However this gives me an exception saying: Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("user") to generate a URL for route "ej.form.user.profile".

The same works as a task entry. Basically I have a custom form that extends user profile to integrate with a third-party system and I need the user id from the url to fetch appropriate user's information.

How can I have the menu to pick route parameter from the url?


texts: Add a New [content type] on each content type

texts:
I want to create a block and put it in the sidebar of each content type that says "Add a new [content type]" So if the user was viewing an article, it would have "Add a new article", if the user was viewing a car, it would say "add a new car" etc.

Obviously I could make a different block and then control their display via context, but I'd rather create one block that essentially always links to add/new/[content-type] where content-type is whatever is being viewed.

Is there a way to pass in this argument via context?


texts: How to log the history of nodes viewed by a user, and report about them?

texts:
I want to have this feature that for each user logs the nodes that the user viewed.

In another words, recent nodes viewed by each user.
I want have a block that shows each nodes user viewed , something like imdb.com user history view.

How can I achieve this job? Do you know good module for Drupal 7?
Do you think it is possible achieve that with views or my custom query?
Or I should write custom simple module and get help hook_node_view .... ?


texts: How to get a taxonomy term in a custom node.tpl.php file and compare it to a string?

texts: I am using Drupal 7 and I have a taxonomy term reference in a content type. I am trying to get the value selected in the admin and do a comparison first and then based on the selected value, display the output. Somehow my if condition always fails. How do I get the actual term other than doing print render($content['field_name'] and instead get the term itself. Any help would be appreciated. Thanks.


texts:
I read a recent question about using date formats in forms, and using the code works OK in Google Chrome, but in Firefox and Safari it is not working.

The default date is shown like YYYY-mm-dd, while the datepicker renders a dd-mm-YYYY field. After submitting, I get an error about the date format.
When I use $form_element['#date_date_element'] = 'text', it works OK, but I do not get a datepicker.


texts: How to add an autocomplete field to a form

texts:
I've got a page that, in response to a button click, brings up a Bootstrap modal form.  In that form is a textfield with the standard Drupal autocomplete behavior; it's working fine.

I now want to set things up so that, after a value is put into that field, another mostly-identical autocomplete field is added to the form -- the idea is to let the user specify additional values for the property being handled by this part of the form.

I've hung a jQuery blur handler off the textfield that takes the HTML that ends up in the form for the initial autocomplete form, parameterizes it a bit to avoid duplicate ID numbers, and inserts this updated field into the form when the first field gets a value.  This is working fine from an HTML perspective, but the autocomplete behavior is not happening on the added form.

Minor notes:

After I insert the new field into the form, I re-run Drupal.attachBehaviors(), which I thought was going to make this all work.  I've also added a delay to make sure the rewriting of the form is completed before attachBehaviors() is called, but that has no effect.
The autocomplete behavior continues to work on the original field after the new field is added to the form.
The blur handler that does all this stuff to the first autocomplete field is not firing when I blur control from the second, added field.

It looks like some other bit of initialization stuff needs to happen, but I have no clue what it is.  Does anybody else?  Thanks!


texts: fetching records from webform_submitted_data table through following source code but showing error

texts:
How to display the records from the table by using the following source code?

  Notice: Undefined offset: 0 in eval() (line 20 of /var/www/module(80)
  : eval()'d code).

<?php
include_once(drupal_get_path('module', 'webform').'/includes/webform.submissions.inc');
$query = db_select('webform_submitted_data', 'u');
$query->fields('u', array('sid','nid','data'));
$query->condition('nid','159','=');
$results =$query->execute();

echo "<table>";
echo "<tr>";
echo "<th>  Profile Photo </th>";
echo "<th> Faculty  Name and Department  </th>";
echo  "</tr>";

if ($record = $results->fetchAssoc())
{
$sid = $record['sid'];
$nid = $record['nid'];
$submission = webform_get_submission($nid,$sid);
echo "<tr>";
echo $val = $submission->data[15][0];
}
?>


texts: How to list all nodes referencing a node in a tree view

texts:
I have a content type Company with an entity reference field which can be referencing a content of the same type (Company), this field is also set to have multiple values.

What I want to achieve is to list all the companies referencing a company, as a recursive tree (may be only first 2-3 levels).

For Example I have 5 Companies: CompanyA, CompanyB, CompanyC, CompanyD, CompanyE. Each of them referencing one or more companies. Let's say:

CompanyA:

CompanyC
CompanyE

CompanyB:

CompanyA
CompanyD

CompanyC:

CompanyA

CompanyD:

CompanyB
CompanyC
CompanyE

CompanyE:

CompanyB

If am viewing the CompanyA, I would like to have a list like:

Companies Referencing CompanyA:

CompanyB

CompanyD
CompanyE

CompanyC

CompanyA
CompanyD

I hope I was clear enough to explain my goal.


texts: How to add a select menu to a form with the ability to insert new values?

texts:
I need to add a select field to a form, but I also want the ability to add more values to select field later on. How can I accomplish this in Drupal 7?

I heard (read) some place that you can accomplish something like this with a custom content type? but isn't there any better method to do this?


texts: Is it possible to use %user_uid_optional as a view path?

texts: I am using %user_uid_optional in the path of a view, but it doesn't seem to be working because the tab is not showing. It looks like that the user_uid_optional_to_arg function is not being called. Do you have any idea?


texts: How to prevent term URL in webform email template (Webform References Module)?

texts:
I've configured a webform to send a custom email after submit. One of the fields in the webform is a taxonomy select (via the Webform References module). So the value in the email template looks something like this:

[submission:values:vocabname]

When the email gets sent, the selected taxonomy term gets printed out along with a reference to its URL listed at the bottom... like this:

Term Name [1]

And then at the bottom of the email is the URL:

[1] http://www.example.com/vocab-name/term-name

How do I prevent the URL from being included automatically in the email? I just want term name alone.


texts: icon_map in PHP annotation instead of layouts.yml

texts:
I need to add an Icon to a layout added by a contrib module. But I see it is adding the layout via plugin PHP file instead of layouts.yml.
The annotation looks like following
/**
 * A very advanced custom layout.
 *
 * @Layout(
 *   id = "lb_tabs_tabs",
 *   label = @Translation("Tabs"),
 *   category = @Translation("Effects"),
 *   path = "layouts/tabs",
 *   template = "lb-tabs-tabs",
 *   icon_map = ""
 * )
 */

I don't know how to represent the multidimensional array into this annotation form. When I tried simple [['region', 'region']] form it errored [Syntax Error] Expected PlainValue, got  '[' .
tried @Array(@Array('region', 'region')) as well but got
Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got '(' .
What is the correct way to add an icon_map there?
Also tried adding layouts.yml and moving these values to yml and the layout option just disappeared as a whole`.


texts:
I recently 'inherited' a website which has a Drupal installation on it. I know absolutely nothing about Drupal. I don't want to go on for too long, but the site is an absolute mess. It looks like there are two separate websites there that interweave. In all honesty, I dont think I could have paid someone to make a less understandable website. None of the code is documented, there is just no sense to any of it.

Well here's my problem -

I recently changed all of the FTP, SQL and site passwords so the previous ownership couldn't access the site.

On one of the pages there is a PHP script that processes a form. In the form, the php accesses a file called, "login_credentials.php" (sigh...) which contains the SQL login info.

Now, whenever someone tries to use the page, there is an error that says invalid password on line 12. I, of course, have gone into the login_credentials.php file and confirmed that the password is the new password.

I also went in and even changed the code so that the SQL connection is on a different line (line 13) but the error still says line 12. This is telling me that the page is somehow cached (maybe?), but I have no idea how.

What's even stranger is that if you are logged into the site as an admin, the error DOES NOT occur. This problem only occurs to the public. (only admins need to log in).

I honestly can't say what the problem is. I'm only moderately savvy when it comes to php/html etc, and know nothing at all about Drupal.

Any ideas?


texts: Multiple content types from Views module, not old nodes from one of them

texts: I use the famous Views module to show nodes of different content types. One of these content types has a field called "final date". If a node has an old date, smaller than today's date, I want it to disappear from the start page so it's always up to date. How do I solve this problem?


texts:
In Drupal 7, I could manually edit the {system} table in the database to disable a stubbon module.  In my Drupal 8 site, this table is gone.

How can I manually disable a module in Drupal 8?


texts: How can I combine the output of two separate fields in template.php?

texts:
I have two fields displaying multiple values from select lists. The first field's a term reference field, the second's a text list. So,

print render($content['field_term_list']) produces

Term1
Term2

and print render($content['field_text_list']) produces

Text-item1
Text-item2

I'd like to merge the output into a single list, preferably sorted alphabetically, and print it from a new variable:

<?php print ($combined_lists); ?>

Term1
Text-item1
Term2
Text-item2

How can this be done using theme_preprocess_node?


texts: How to browse the server to upload files from there in Drupal 7

texts: I need to upload the audios and videos on server in a specific folder via FTP and then let the content managers to select them when they want to upload any of them in add/content path (because it takes a long time to upload them via the Add Content user interface). Is there such a capability in Drupal 7?


texts:
I'm trying to add a +2000 video database (stored on youtube) to my website. I have an excel file with on every line the video title, the url and the keywords.

Is there an easy way to automate this process rather then copy pasting +2000 times in to new nodes?

Kind regards!


texts:
I have a page with two links visible to people, but on clicking  of either of two, user needs to log in to view, so in case user is not logged in, i am sending users to login page with drupal_goto('user'), i want that if the user clicked 1st link and is redirected to login page, after successful login, he should be redirected again to that 1st link
i tried with this code but did not work,

$query = array('destination' => 'node/id');
drupal_goto('user',$query);


texts: drush extension installation directory location

texts:
Where is the recommended location to install drush extensions?

I've downloaded drush_sup and have drush 5.4 installed.

drush_sup/README.txt says to look in the drush README.txt file for the recommended location:

  See the Drush README.txt for locations where Drush extensions may be
  placed.

drush/README.txt does not discuss extensions.


texts:
My site forces users to log in with a specific OAuth provider for some reasons. Users should not be able to log in using their username and password pairs. Only the site managers can have accounts independent of OAuth.

When first creating an account with OAuth, the 'pass' field is set to an empty string ''. My first question is whether it is the right and most secure way to prevent logging in using password.

The second question is about requesting new password via email. I implemented hook_menu_alter to customize user and user/login and to unset user/password. Now users cannot access user/password, I wonder if there is a bypass for it. This question is less important since almost all users would never bother with or even know the possibility of requesting new password.


texts: EntityStructureWrapper for file field is not being inflated properly while iterating

texts:
While trying to interate over file filed values, EMW cannot being created properly. using isset() for not iniated fields and then trying to set them is not helping.

I get the error:

  EntityMetadataWrapperException: Unknown data property
  field_discipline. in EntityStructureWrapper->getPropertyInfo() (line
  335 of
  /var/www/siradisisporlar.com/sites/all/modules/ssbasic/entity/includes/entity.wrapper.inc).

Note that file wrapper here is EntityStructureWrapper and node wrapper is EntityDrupalWrapper.

All properties of other entity reference fields, etc are being reached properly.

$filew::data is array and it has fid where $nodew::data is a proper node object.

mymodule_node_insert($node) {
  //.... ..... $nodew is node wrapper
  foreach ($nodew->field_media as $delta => $filew) {
    $a = $filew->field_taxonomy_entity_reference->value(); //error here
    $b = $nodew->field_taxonomy_entity_reference->value();
    $c = array_unique(array_merge($a, $b));
    $filew->field_taxonomy_entity_reference = $c; //error here
    $filew->save();
  }
}


texts: Render exposed filter without creating block

texts:
Can we place/render exposed filter to some other region(sidebar second) without creating exposed filter in block because when we creating exposed filter with block its autosubmit functionality stopped working ,without creating exposed filter with block its autosubmit functionality working fine.

I am using better exposed filter module https://www.drupal.org/project/better_exposed_filters.


texts: How to get core to leverage a MySQL master/slave configuration?

texts:
I read this question MySQL master/slave replication not working and its answer:

  Using slave databases is barely implemented in Drupal core. If you are
  developing your own modules then calls to db_query need to specify
  that they want to use the slave database using the $options array. See
  DatabaseConnection::defaultOptions for how to set this array.

Is there a way without killing kittens hacking the core to get db_query() and db_select() to make more slave SELECT queries ?

By default, these functions will query the master unless specifically told to query the slave (see their API). You have to write db_query($query, $args, array('target' => 'slave')) in order to query the slave and the core (and all the modules) aren't written to achieve this.

Only search (see the slave part) and aggregator seems to leverage this.

Edit: Oct, 25
I saw pressflow 7 is out but I'm not sure if it helps a lot right now.
I haven't found something relevant so let's try a little bounty to help this getting an answer.

Edit: Oct, 31
I'm mainly worried about Crell's comments regarding this topic: What to do with slaves?.
Mainly, is there troubles if I send SELECT queries to the slave, what happens with delays in the replication and the fact that I may want to do a node_load() just after saving a new node.


texts: "cannot use a scalar value as an array" warning for adding #prefix and #suffix in template.php via hook-form-alter – Drupal 7

texts:
I have the following code in my Drupal’s template.php file. What it does is to embed every element of my site's contact form (created with the Webform module) in a li element (the form itself is already embedded in a ul element).

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

  if ($form_id == 'webform_client_form_MYFORMID') {
    foreach($form['submitted'] as &$field) {
      $field['#prefix'] = '<li>';
      $field['#suffix'] = '</li>';
    }
  }

This works, but I get 'Warning: Cannot use a scalar value as an array in MYTHEME_form_alter()' when accessing a page that contains such a form. The warning shows twice, once for each of the two lines where I add the prefix and suffix, respectively.

I have searched far and wide, but I do not know what to do. To the best of my knowledge, this is how Drupal wants me to handle this. And like I said, it does work, but it would be nice to get rid of the warnings and do everything 100 % correct.

(I'm using Drupal 7 and PHP 5.6.24.)

Does anybody know a better / the correct way to do this? Thank you.


texts:
I'm trying to use jQuery Media, but it's not working.
I am getting the following error in Firebug:

  "NetworkError: 404 Not Found - http://
  demo.dolphin-sch.ir/nagara/fa/sites/default/files/mediaplayer/player.swf?file=http://demo.dolphin-sch.ir/nagara/sites/default/files/audio/12.mp3"

You can see the error on my website:

  http://demo.dolphin-sch.ir/nagara/fa/content/abc

First I enable jQuery Media (version 6.x-1.4-beta1) and jQ (version 6.x-1.2) and then upload the JW FLV Player to sites/default/files/mediaplayer/player.swf.  Next I change my template.php and create a filefield_file.tpl.php file.  Lastly, I set a media class .field-field-flash-file a, .filefield-file-audio a but it's still not working.

Can anyone help?


texts: How can can I get theme callback to work for an error page?

texts:
I've created a custom error handler for 404 errors (page not found).

I've set up Home » Administration » Configuration » System  » Error Pages for 404 errors to point to http://example.com/myerrorpage, and then I have the following in hook_menu

/**
 * Implements hook_menu().
 */
function MYMODULE_menu() {
  $items = array();
  $items['myerrorpage'] = array(
    'title' => 'myerrorpage',
    'access callback' => TRUE,
    'page callback' => 'myerror_page',
    'theme callback' => 'myerror_theme',
    'type' => MENU_CALLBACK,
  );
  return $items;
}

When I enter a non-existing path (e.g. http://example.com/bogus) the page callback is invoked as expected.

However, the theme callback is not.

To get the  theme callback to fire, I need to enter the following path: http://example.com/myerrorpage.

I do not understand why the theme callback does not fire at the same time as the page callback.

Is there any way to get the theme callback (or hook_custom_theme()) to fire when a non-existing path is given?


texts:
I'm trying to manipulate search keywords before submitted for search. Using Search API and Views. Unfortunately, hook_search_preprocess funciton does not work in my custom module.

function mymodule_search_preprocess($text) {
    $text = str_replace("dog", "cat", $text);
return $text;

Cache cleared, what is wrong with it ? any ideas ?


texts: How to remove duplicate view results from multiple blocks on same page in Drupal 8

texts:
I have multiple view blocks with different info on same page of same content type. I want to remove the duplicate results. I want one result to appear only once on whole page.

How can I achieve that in Drupal 8 ?

Thanks


texts:
I put together a simple entity form and am trying to enter a few default token values for fields on the form.
But when I choose something like [site:current-user:mail] from the list of available tokens, it displays literally as typed.
Which is to say that, in the input box where the user's email is supposed to have been inserted, I'm seeing the text - "[site:current-user:mail]" instead in that field, which is a bit strange, since tokens seem to be working everywhere else on the site.

I'm using the latest stable version of drupal 7 and the entityform module.


texts:
How can one add fields to site information section?

Maybe explaining the purpose can lead to an other approach.
Building a template site for Hotels/B&B's wich needs to feature simple re-usablity. For example the address data, contact data, location etc centralized to make it easy to setup an new instance of the template.
Sure I can use something like this, but I don't know I can use special fields like location or address fields.
.

 'checkbox',
      '#title' => t('Use my setting'),
      '#default_value' => variable_get('extended_siteinfo_extra_setting', TRUE),
    );
  }
}
?>

Maybe creating a content type site-information and creat one node with the info, is an easier approach but it feels very wrong...


texts: How do I plot a graph or chart on the confirmation message?

texts:
How do I plot a graph on the confirmation message, on a webform and Drupal 8?
I searched a lot, but did not find anything useful, but these results.

There are several modules involved in graphing, including the Charts module.

There is a programming solution (Display webform results data in a Google Chart), but I don't think it works, since the site will contain dozens of questionnaires. Drawing charts should be easy, something similar to Twing or only in the confirmation message textBox area.

images files can be displayed if uploaded to the site via the questionnaire in this way (from How to Display Image after submitting webform in the confirmation message page).
<img src="[submission:values:image_key]"/>

There are previous attempts at Drupal 7, such as the Webform Charts module. I don't know how it worked.


texts: Where to add "No results behaviour" to a view?

texts: I'm using an exposed filter. When there is no result, where do I add "No results behavior" for the view?


texts: Is it possible to attach a specific user profile to an organic group?

texts:
I want to have 2 seperate user profiles. One profile with a user picture and one without a user picture.
These user profiles shall be attached to a specific organic group.

I also need extra information stored with the help of the profile2 profile2 module. This question is similar to How do i assign profile2 (user) to a organic group?


texts:
I have a node display that shows about 20 different fields.
One of the fields is a list of years (multiple values). Instead of printing the list of years I would like to just show the first and last year, for example "1999-2005".

Views has a great formatter for those situations but I don't want to use views for the node display.


texts: How to deal with the "Payment failed at the payment server" error?

texts:
I'm trying to get my website integrated with SagePay.
Everything works well untill the payment is made.
Once a client makes payment he/she gets the following error message:

Notice: Undefined index: crypt in commerce_sagepay_form_redirect_form_validate() (line 55 of /sites/all/modules/commerce_sagepay/includes/commerce_sagepay_form.inc).

Payment failed at the payment server. Please review your information and try again.

And I get the following info in the logs:

Response could not be converted to tokens

Despite these errors the payment was taken, but the order remains in the shopping cart with the status Checkout: Review

I'm using Commerce SagePay 7.x-1.0 and the integration option is Form.


texts: Updating core to a specific version with Composer

texts:
My site hasn't been updated for two months, a few new updates has been released.
My site's core version is 8.5.6.
Before running composer update -with-dependencies I read the release notes to the latest version of core (8.6.2), they say:

  Sites on 8.5.x should update immediately to Drupal 8.5.8 instead, and
  plan to update to the latest 8.6.x release before May 2019.

How do I update the old core to Drupal 8.5.8 instead?
How do I specify that version in CLI, what command?
Eventually I want to update it to the latest version.


texts: How to reduce the time needed to export a view with 50k rows into a CSV file?

texts:
I am having a view with 50k records I want to export the view as CSV. I tried Views data export module but it takes around 20 min to export the data.

I have configured the view to use Batch export with Segment size 100.
I want to reduce the export time. Is there any way to do it?


texts: How can I make a module's configuration exportable by features?

texts:
At a high level, what needs to be undertaken to take a module's configuration data and make it exportable by Features?

Whether this is a contrib module that does not yet have Features support or a custom module that I have written, where can I start so that I can get it in code?


texts: I am new to drupal and views. I have successfully created views page and understood some basics of it and views theming. I have created a views page for content type(products) listing. Now on the views page i have successfully listed the products. and now i want to theme it and also would like to know how to do pagination for it?


texts: Modifying default workbench view filter via code

texts:
Workbench ships the 'My Content' view default in code. I want it to actually show "my content" by adding a contextual filter with the author by field = current user.

I've looked into http://blog.arvixe.com/altering-default-views-in-code/, but it is a drupal 7 implementation and doesn't touch on the filtering.


texts: Force capitalization of terms on entry with Autocomplete Deluxe module

texts: I would like to force the capitalization of taxonomy term entries, or alternatively make them case insensitive so that 'book' and 'BOOK' are not different taxonomy terms. Is there a way to enable this. The context is this form http://www.wequest.co.uk/user/register on the 'skills' and 'resources' field... I need these to be standardised because they represent catalogues of skills and resources and I don't want duplicates either: of terms or due to different cases.


texts:
I updated a site with "Composer update --with-dependencies"
and encountered the following problem:

User warning: The following module is missing from the file system: phpmailer in drupal_get_filename()

Then I ran: composer require drupal/phpmailer.

Terminal returned:

Using version ^3.0@beta for drupal/phpmailer
./composer.json has been updated

And

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

But the Status Report still showed that phpmailer module was missing.

So I attempted running "drush en phpmailer -y"

And it returned:

phpmailer was not found.                                             [warning]
The following projects provide some or all of the extensions not     [ok]
found:
phpmailer
Would you like to download them? (y/n): y
This codebase is assembled with Composer instead of Drush. Use       [error]
`composer update` and `composer require` instead of `drush
pm-updatecode` and `drush pm-download`. You may override this error
by using the --pm-force option.
phpmailer was not found.                                             [warning]
Unable to download some or all of the extensions.                    [warning]
There were no extensions that could be enabled.                      [ok]

What can I do to fix this?


texts:
How can I optimize multiple feed importer from cli?

Is there any way to optimize multisites using multicron for each site in drupal 7.?

I want to implement like this https://www.drupal.org/node/1294438

Looking for more description.


texts: how to retrieve password from within hook_user_presave()

texts:
I am trying to catch the inputed password on the user registration page from within the hook_user_presave(). I want to send this password out to an external database for storage. However, when I analyzed the $edit variable, I found that the password field was returning an encrypted password.

Is there any way for me to retrieve the actual password?


texts: css and javascript aggregation. Can I still edit files?

texts:
Am developing a site using drupal 7.15
I am having problems with displaying a ddblock in internet explorer and I think it may be due to too many css files.
If I aggregate them can I continue to edit them? Also, can I still use Firebug to view my css?
All the posts I read seem to refer to setting aggregation when you decide to "go live"
Sorry to ask such an elementary question.


texts: Theme the progress bar when in batch API with AJAX

texts:
I am looking to create a stylized theme for the progress bar for the batch API screen. I wish to alter the HTML and CSS being displayed in order to do so.

I know how to add the CSS to the page. I am aware of the hook theme_progress_bar, but according to the documentation "Note that the core Batch API uses this only for non-JavaScript batch jobs.".

What is the best method for overriding the HTML for AJAX driven batch API jobs?


texts: Search API autocomplete group suggestions

texts:
I am using Search API, Search API autocomplete and Solr search.
I'we made a view with an exposed filer that has a funcionality of search api autocomplete.

For now, autocomplete suggestions are just this boring regular template...

Important to notice is also that I am searching two Content Types (Book and Autor)

I would like to implement grouping in my autocomplete suggestion so that my autocomplete looks like this:

Book:     |     Autor
Book 1       |    Autor n
Book 2       |    Autor n
Book 3       |    Autor n
Book 4       |    Autor n
Book 5       |    Autor n
Show all      Show all