texts: I have a collection of points (latitude/longitude) that i would like to represent on a Map as route. Is there a module that permits this?


texts: How to implement a follow author (or user) function?

texts:
Is it possible to implement a Follow button for authors of posts in Drupal 7, so that users can:

Follow any one they wish, and
Be notified about the new posts of those authors.

This sounds like 'Mashable Follow button' for authors.

Do you have any suggestions about how to implement this?


texts: Private nodes in Private group are visible to non-members by their URL

texts:
I have a private group with private content which I set up with group visibility and group content visibility. Logged in as a non-member of this group I get access denied on the group page however when I enter the url of a node within that group I can see it fine.

I am using views cloned from the original OG views and I even tested it with the OG views and it is still allowing a non-member to see the nodes.

I have also rebuilt permissions a number of times.

I am unsure whether this is a bug in OG or a problem with my settings?


texts: How to create a new seller (store) under administrator using drupal commerce marketplace

texts:
I am using drupal commerce kickstart to create an eCommerce portal. I need to create sellers, re-sellers and sub-re sellers with in the site. i had installed commerce marketplace, but not aware of creating the new seller. Please help.

The hierarchy will be

The Service Provider has multiple resellers, each reseller can have multiple sub-resellers and finally end-users


texts:
I several folders containing symlinks to my drupal sites.  I'd like to use this folder structure to create an alias so I can run commands on each group of sites.

I'm trying to do what "drush @sites status" will do, but on a smaller subset.

I wrote the following based on the docs

// List the instances from the OU instances folder
$full_path = "/opt/drupal/sites/instances";
if ($handle = opendir("$full_path")) {
    while (false !== ($file = readdir($handle))) {
        if(is_dir($full_path."/".$file)) {
          if ($file != '.' && $file != '..')
            $instances[] = $file;
        }
    }
}

// Turn them into aliases so we just have to type @instance
foreach ($instances as $instance) {

    $site_list = [];

    // Look at each instance
    $site_paths = $full_path . "/" . $instance;

    if ($file_handle = opendir("$site_paths")) {
      // List out the folders in this instance
      while (false !== ($site_folder = readdir($file_handle))) {

        if(is_dir($site_paths."/".$site_folder)) {
          // If the folder represents a drupal site
          if ($site_folder != '.' && $site_folder != '..')
            // Add it to this instances list
            $site_list[] = '@' . $site_folder;
        }
      }
    }

   $aliases[$instance] = array(
            'site-list' => $site_list,
        );
}
print_r($aliases);

The cheeky print_r on the end shows my array as

 [partnership] => Array
        (
            [site-list] => Array
                (
                    [0] => @www.1.co.uk
                    [1] => @www.2.org
                    [2] => @www.3.org.uk
                    [3] => @www.4.org
                    [4] => @www.5.eu
                    [5] => @www.6.net
                    [6] => @www.7.com
                    [7] => @www.8-ri-2020.eu
                    [8] => @www.9.edu
                    [9] => @www.10.ac.uk
                    [10] => @www.11.org
                    [11] => @www.12.ac.uk
                    [12] => @www.13.co.uk
                    [13] => @www.14.org.uk
                    [14] => @www.15.ac.uk
                )

        )

I've changed the names to protect the innocent, but they are valid aliases.

When I run "drush @partnership status" I get

drush @partnership status
You are about to execute 'status' non-interactively (--yes forced) on all of the following targets:
Continue?  (y/n): y
Invalid argument supplied for foreach() backend.inc:661

How do I get drush to actually run through this alias list telling me the status of each site?


texts:
I have a legacy site running Drupal 6.19, and today, I found out that the entire side bar had disappeared. I haven't run any updates, and no administrators have been on the site for a while, so I'm not sure what could have triggered this. Does anyone have any suggestions for how to reverse this?

I have gone into the /build/blocks menu, and the proper menu items are listed as being there (right sidebar region), and if I add a test item to any block region, it won't show up. The site is using a custom theme; however, the issue persists if I change themes the the default Drupal theme. I didn't see anything in the theme or global theme configs that would indicate a problem.

Thank you for you help.


texts: jQuery is not working for inserting data

texts:
I want to save data from a textbox on a button click. I am using jQuery AJAX for this task. Please note that I made this tags inside theme function.

function theme_user_post_block($vars) {
  $themeUserCommentInput = '';
  $themeUserCommentInput .= '<textarea id="txt_1" rows="1" cols="50"></textarea>';
  $themeUserCommentInput .= '<input type="submit" value="Post Comment" align="center" class="btnPostComment" id ="btn_1" / >';
  return $themeUserCommentInput;
}

This shows me the textbox and the button inside the page. This is my JavaScript code.

(function($) {
  Drupal.behaviors.PostComment = {
    attach: function(context, settings) {
      $('.btnPostComment', context).click(function(event) {
        var post = "&newcomment=Comment1&logid=log1";
        jQuery.ajax({
          url: 'postcomment',
          type: 'POST',
          dataType: 'json',
          data: post,
          success: function(data) {
            alert(data);
          },
          error: function(jqXHR, textStatus, errorThrown) {
            alert(textStatus + errorThrown);
          }
        });
      });
    }
  }
})(jQuery);

Next I create a custom page as follows.

function postcomment_menu() {
  $items = array();
  $items['postcomment'] = array(
      'title' => t(''),
      'type' => MENU_CALLBACK,
      'page callback' => 'user_comment_post',
      'access arguments' => array('access content'),
  );
  return $items;
}

function user_comment_post() {
  global $user;
  $cid = db_insert('user_comment')
          ->fields(array(
              'comment_user_id' => $user->uid,
              'reference_id' => $_POST['logid'],
              'comment_desc' => $_POST['newcomment'],
              'createdon' => REQUEST_TIME,
          ))
          ->execute();
  if ($cid != 0) {
    //GetUserComments($i);
    drupal_json_output("success");
  }
}

So I have done all things that is required for jQuery+Ajax Submit functionality. When I press "Post Comment" button it gives me error in alert says "errorundefined". The alert shows as a result of error inside the jQuery.AJAX function. Also the custom menu callback is also not getting called.


texts: How to add a javascript snippet to track a 2nd Google Analytics account?

texts:
In my settings for Google Analytics I need to add a javascript snippet in the "after" section, to track a second account (the main account works fine).

I added this:

  ga("create", "UA-xxxxxxxx-x",  {"cookieDomain":"auto"}); ga("set",
  "anonymizeIp", true); ga("send", "pageview");

It does not work at all though. How shall I change this to make it work? The Google Analytics module version is 7.x-2.3.

Note: I don't think this question is a duplicate of "Google Analytics configuration setting for Drupal multisite (domain and submain)": the other question is about two different domains, I have only one domain, which is tracked by 2 accounts. Also under the text box where I am supposed to paste my javascript snippet in the GA module UI, you can find this text: '

  This is useful if you'd like to track a site in two accounts

... which suggests that you really can track 2 accounts for 1 site. My problem is that the snippet I entered does not work. The second account does not recieve any data.


texts: Keep menu open for custom content entities

texts:
I am writing modules that define content entities in Drupal 8. The Drupal console creates the menu items for the list builder. I would like the menu to stay open (having the menu-item--active-trail class) when I access the view or edit form page of, say, the content entity with id 4.

The breadcrumb navigation works perfectly out of the box, but the menu is completely closed for the content entity with id 4.

I am ok with writing a Menu Plugin or using a contributed module.


texts:
I am using Migrate Drupal-to-Drupal and migrating a D6 database to D7.

In D6, I have private and public files. They are in one field. In D7, I have a public file field and a private file field.  Migrate d2d MigrateNode class puts the source file field info in the 'upload' field which can only be mapped to one destination field:  public or private attachments.

My question is: Is there any way to conditionally check the value in the upload field in order to map the 'upload' to either the public or private field based upon that value?


texts: views exposed filter on non existent field

texts:
I have a content type which has the following fields:

month: List (integer) [jan, feb, ..., dec] (non mandatory)
year: Date (only collects year - mandatory)

I can normally create two exposed views filters, one for the month and one for the year.

What I'd like to do though is have a single exposed filter which, internally, would operate on the two fields above at once.

For example if the operator is "Is Between" and the user selects Oct 2011 to Feb 2012 I'd like the filter to return only nodes which have:

2011, Oct
2011, Nov
2011, Dec
2012, NULL month
2012, Jan
2012, Feb

Note that I've used two fields (month and year) instead of one so I can have the possibility of a monthless node.

What approach should I take? I've thought of the following:

use a third field which, on hook_node_presave will store the calculated (filter specific) date on the node. I wouldn't like this field to be visible on the edit node screen though
somehow (using a hook) calculate and rewrite the view filtering query. My problem here is how to display an exposed filter for a field which does not exist


texts: How can I access profile fields with a % variable in Drupal Actions?

texts:
I have an action setup in drupal to e-mail me when a new user registers for the site. Right now it is only telling me their user name (%username). Is there a variable that can access added fields so I can get their real name (First Last), or another way to add this info to the action message? So instead of my new user action having a message like:

"%username created an account" -> "jschmoe created and account"

I could have:

"%first_name %last_name (%username) created an account" -> "Joe Schmoe (jschmoe) created an account".

I'm using Content Profile module for the first and last name fields, though have few enough users at the moment that I could switch to Profile module fields.


texts:
When I attempt to enable the REST Server module, I get the following error message:

  A library is missing for rest_server to work (Currently using Missing library Please download spyc and create a file called spyc.php in rest_server/lib)

The spyc.php file is included with the module in the rest_server/lib directory, but the error is still reported, and prevents the module from being enabled.

Drupal version: 6.22

Rest Server module version: 6.x-2.0-beta3

I reported the issue on the module page.

Just wondering if you see any patterns that could help me debug this issue.


texts: Setting a Variable in PHP for use in rules

texts:
I have a variable I've defined via rules using 'Add a variable' called 'minimum_reached'. This is available to me for use in custom PHP code.

if($total >= $minimum_fund){
   $minimum_reached = 'yes';
   dpm($minimum_reached, 'min reached');
}

Once this is set to 'yes', the next action fires which Sets a data value of the current node's 'minimum reached' field to yes (depending on that above outcome). The variable is being set as the dpm works, but it's not being carried across to the next action. How do you define this variable in PHP for use later on? Thanks.


texts: Why do all my urls look like 'content/name-of-page'

texts:
I just installed pathauto module. After installing it the path sticks to 'content/' in front of all the url names.
So how to change the default URL.


texts:
In the past there were some hooks, such as described here:
How to run check on each page load?

to execute arbitrary code on each page load.

Now this has been replaced with an event based approach. I wrote this to check it out:

class MyModuleEventSubscriber implements EventSubscriberInterface {
    public function onLoad(GetResponseEvent $event) {
        \Drupal::logger('my_module')->info('test');
    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        $events[KernelEvents::REQUEST][] = ['onLoad'];

        return $events;
    }
}

However, it seems like there is any number of requests on each page load—it actually captures each request, and in my case there are five (5). My intended code, however, has to call an outside API, and I'd like to avoid unnecessary calls.

Is there an event that is guaranteed to run just once on each page load, without saving a state on my side (that seems quite complicated for this problem)?


texts: Add existing images from server to create gallery

texts: I want to create gallery based on folder structure on the server. Basically just auto create a node for each folder and add all the images from server in that folder. I also don't want it auto create thumbnails. I found this tutorial https://www.drupal.org/node/1266646 but the problem is it only works on version 6 but I'm using version 7. So anyone have any alternative solutions? please note I'm not a programmer so I wouldn't know how to update the code on that tutorial site.


texts: displaying taxonomy term as a header in a view

texts: I have a view that displays 3 latest articles from a certain taxonomy term. The issue im having is I need to display the taxonomy term as a Header. I dont see the [field_myterm] under Header > Global : Text area.. I also need this taxonomy term translated when I switch languages.


texts: How to get date values from field collection to a node?

texts:
I am trying to print the values from a field collection using following code in Drupal 7 node.But the date values are not getting.

$wrapper = entity_metadata_wrapper('node', $node);
 $formtype = field_get_items('node', $node, 'field_latest_schedules');
 foreach($formtype as $itemid) {

 $item = field_collection_field_get_entity($itemid);

 print $item->field_course_starts_on['und'][0]['safe_value'];
 print $item->field_course_ends_on['und'][0]['safe_value'];

 }

How can i print the date from a filed collection?


texts:
In other words: How do I get the URI for each of the files in a file field that's on a custom content entity called 'listing'.
Right now I have:
$images = $variables['elements']['photos']['#items'];

Where $images is a FieldItemList
How do I iterate over my FieldItemList to grab the URI for each of the files referenced therein?
Ok figured first part out with:
 $images = $variables['elements']['photos']['#items'];
   $photos = $images->getIterator();
   foreach ($photos as $photo) {
     xdebug_break();
   }

Now the question is:
How to get the URI for each of $photo, and assign it as a variable...?

Update
After Berdir's Comment and my own investigation this is what I went with.
  if (isset($variables['elements']['photos']['0'])) {
    $number_of_photos = count($variables['elements']['photos']['#items']);
    $listing_pics = [];
    for ($i = 0; $i < $number_of_photos; $i++) {
      $pic = file_create_url($variables['elements']['photos'][$i]['#file']->getFileUri());
      $listing_pics[] = $pic;
    }
  $variables['elements']['listing_photos'] = $listing_pics;
  }

This is in a Hook_template_preprocess_HOOK(), and now all of the urls from my multi-value file field are available to the template like this {{ elements.listing_photos }}


texts:
I am creating a view in drupal 7  here is attached screenshot

Here

And preview of this Screen Shot is  or output of this view is

Which is working fine .

Now when i try to pass contextual filter see

Named Edmonton it shows following result

And Result is not correct

It must show only filter with edmonton name

Any Body has idea what is the problem?
Thanks in Advance.


texts:
This is my problem:

I used views module to create several blocks of one content type and displayed those blocks in one basic page. My client would like to have that page included in search results when he searches for some word from those blocks.
Seems like Drupal's core search module indexes only content from pages, not content from displayed blocks.
Is there some module that I could use, which would index block's content too?


texts: Is it possible to pass dynamic values in tokens in Drupal 7?

texts:
When using tokens, I would like to be able to use a format similar to the following notation so I can provide the needed flexibility in how a content author can invoke these modals with minimal code experience.

[modal:view:<term_id>:<text_string>]

An example of this token in use would be:

For more information, [modal:view:33:"click here"].

What should happen from here is that I can grab the <term_id> and <text_string> and incorporate them in the output of the token replacement.

An example for the expected output would be something along the lines of:

For more information, click here.

Is this possible, and if so, how would I construct the hook_tokens function to handle these dynamic values?


texts:
I am using D7.4.

I have a vocabulary named 'recipes'. I want a tab/link in the Main Menu to take me to the Recipes category.

I also have a block of QuickTabs setup. Inside this block are individual views for: most recent, most viewed, most comments, most votes- all using the 'recipes' vocabulary as the input.

So when a user clicks on the Recipes Link/Tab on the main menu- they'll be presented with 4 choices- most recent/viewed/commented/voted.

I have the quicktabs portion working correctly. How do I get it to display off of a link from the Main Menu?  Do I have to create a separate Node, and declare that specific QuickTabs Block to ONLY show on that specific node, then link that node to the main menu?  Or, is there a better way via views?

It seems soo simple - just can't figure this out.


texts: Nginx vs Apache - Are there any actual usage comparisons and statistcs out there?

texts:
I have a new server to play with, and I am staring at a blank canvas. I can put anything I want on it. While I am comfortable with Apache, I keep hearing how nginx can handle so much more traffic than Apache, by factors of 10, 100, even more. Not only that it's "much much faster."

When I search for articles I can find lots of stuff unrelated to Drupal. Or, when I do come across a Drupal related article it's either 1) someone's configuration file with a quick attempt at explaining how to set it up, or 2) it's someone saying "no, don't use nginx, go with Apache with PHP fcgid" but there is never explanation as of why.

So, when it comes to Drupal, what is the reality here?

As an example, I am looking for something along the lines this 2bits.com article.  Here the author has taken a pretty extensive look at Apache mod_php vs Apache with fcgid, weighing the pros and cons of each, and provided a case study to illustrate the impact in the real world. There is enough information in this article for me to make an educated decision as to which approach would be best for my situation.

While that author compares mod_php to fcgid, I am looking for the same type of comprehensive, real world look at Apache vs Nginx.

Anyone switched to Nginx and been "blown away" by the difference it made compared to Apache? Even for highly optimized environments that are already using APC, Memcache, and aggressive caching like Varnish, when the only variable that changes is replacing Apache with Nginx, does make enough of a difference in and of itself to merit investing in this newer, alternative technology?

The site that will go on this server gets an avg of 2 million PV a month. LAMP stack running Cent OS 6. 4 core CPU with 8 GIGS of ram. Memcached and APC will be part of the mix. Nothing special about the Drupal install - basically vanilla 7 with about 50 modules.


texts: drupal default image field without "remove_button" on edit form drupal 7

texts:
I have created one event content type. On which I Have field_event_picture image field. Now what I want is, when user edit event form user will click on field_event_picture and browse popup comes up, without pressing remove button then again clink on browse button.

I have tried this with autoload module. But it will remove only upload button not works with edit form.


texts: Bilingual site - when adding translations to Organic Group, prevent creating a separate group/content node

texts:
We have a bilingual site. We use organic groups to separate suborganisations and their members.

The Organic Group content's multilingual option is set to "Enabled, with translation"

We just want the "Landing" page of the Organic Group to be translated.

When the Organic Group is translated, it creates a discrete Group that allows users to join.

Essentially, we'd like everyone to be in the same group, but still be able to see content in their preferred language.

Anyone have a workaround for this?


texts: How do I use page_callback or pageshow to display an existing article, view, page, block, or a slide show?

texts:
can someone give me these examples to show an article or a block, page that already existing in a drupal website using pageshow or page_callback?

I currently can only successfully showing a link of the article, and then it lead me to the node. Here is my custom js code:

/**
 * Implements hook_menu()
 */
function intro_menu() {
  var items = {};
  items['intro'] = {
    title:'Introduction',
    page_callback: 'intro_page',
    pageshow: 'intro_page_pageshow'
  };
  return items;
}

function intro_page() {

 try{
  var content = {};
  content['my_stuff'] = {
    //markup: '
Nice stuff!
'
    theme: 'link',
    text: 'SlideShow',
    path: 'node/12'
  };
  return content;
 }
 catch (error) { console.log('intro_page - ' + error); }
}

function intro_page_pageshow() {
 // drupalgap_alert('My pageshow event has been called!');
}

After some trying, I can now do it with the following code:

    //page_callback
function intro_page() {
  return '

';
}

function intro_page_pageshow() {
 // drupalgap_alert('My pageshow event has been called!');
 try{
        var nid = 3;
        node_load(nid, {
        success:function(node){
         var content = node.content;
         $('#' + 'my_node_' + nid).html(content).trigger('create');
          }
        });
  }
  catch (error) { console.log('intro_page_pageshow - ' + error); }
}

But it's just the content, not the whole node.

I am still trying to display a page of slide show... The problem is I cannot find the node id from a "page". I tried the "path", but it does not work.


texts:
With reference to post for the validation function in managed_file field, but i am facing an issue with file_desitination()

$file->destination = file_destination($destination_dir.$file->filename, FILE_EXISTS_REPLACE);

I want to replace the file with same name, entry is not been saved in file_managed table.

Code

    $form['image_fid'] = array(
    '#title' => t('Image'),
    '#type' => 'managed_file',
    '#upload_location' => 'public://',
    '#upload_validators'=>  array('file_validate_name' => array()),
    );

    function file_validate_name(stdClass $file) {
    $errors = array();

    //generate file name
    $new_filename = convert_filename_to_filename_date($file->filename);

    $file->filename = $new_filename;

    //changing file location
    $destination_dir = "public://file_location/";

    //check if file exists. if exists rename it append incremental number  until the filename is unique

    $file->destination = file_destination($destination_dir.$file->filename, FILE_EXISTS_REPLACE);

    // If file_destination() returns FALSE then $replace == FILE_EXISTS_ERROR and
    // there's an existing file so we need to bail.
    if ($file->destination === FALSE) {
    $errors[] = t('The file %source could not be uploaded because a file by that name already exists in the destination %directory.',
    array('%source' => $file->source, '%directory' => $destination_dir));
    }

    return $errors;
    }


texts: User role can't view/edit their own unpublished content

texts:
I have a Drupal 7 site where users have a listing they can edit.

This all works fine when the listing is published but as soon as it's set to unpublished they can't view the page or the edit page.

They've got all the relevant permissions:

View own unpublished content Edit own content

I've even got the Override Node and View Unpublished modules installed but still I get the page trying and trying to load but never actually loading.

As soon as I set it to published it's all fine.

Open to any ideas.

Thanks


texts: Edit admin email template for new user registrations

texts:
How do I edit the default email that gets sent to admin upon new user registration? I presume this is being managed by LoginToboggan because its being referenced in the email body text:

  UserName has applied for an account.

  http://example.com/user/XX/edit

  The user has automatically received the permissions of the LoginToboggan
  validating role. To give the user full site permissions, click the link
  below:

  http://example.com/user/validate/XX/XXXXXXXXXXX/XXXXXXXXX_XXXXXXXXXXXXXXXX-XXXXXXXXXXXXX/admin

  Alternatively, you may visit their user account listed above and remove them
  from the validating role.


texts:
After following instructions given here: https://drupal.org/project/ocupload#install-swfupload
I got an upload button. Further it is possible to upload images within the backend. After saving the page there are visible as well.

But if I call the page in frontend there's text only.

Is there a way to solve my problem for free?

ubuntu 12.04, drupal 7.28, ckeditor 4.4.1, firefox and chromium newest release


texts: How to iterate extra fields in a webform component

texts:
When I select the extra field of a webform component:

$webform_components = db_select('webform_component', 'c')
                          ->fields('c', array('type', 'form_key', 'extra'))
                          ->condition('nid', $nid)
                          ->execute()
                          ->fetchAll();

The extra field is something like this (the following example is a grid component):

"a:8:{s:13:\"title_display\";s:4:\"none\";s:7:\"private\";i:0;s:15:\"wrapper_classes\";s:0:\"\";s:6:\"sticky\";i:1;s:7:\"options\";s:20:\"5|poor\n10|excellent\n\";s:18:\"custom_option_keys\";i:1;s:9:\"questions\";s:159:\"mensaje|Each message is associated with a language, which may or may not be the\nactual|current user's selected language, depending on the type of e-mail being\n\";s:20:\"custom_question_keys\";i:1;}"

I want to get the options and the questions. In the previous example:

\"options\";s:20:\"5|poor\n10|excellent\

Option 1: 5 (key) | poor (value)

Option 2: 10 (key) | excellent (value)

\"questions\";s:159:\"mensaje|Each message is associated with a language, which may or may not be the\nactual|current user's selected language, depending on the type of e-mail being

Question 1: mensaje (key) | Each message [...] (value)

Question 2: actual (key)| current user's [...] (value)

I don't know how to process this extra string. I tried to transform it to an array and a json, but it didn't work.

Thank you for your help! :)


texts: How to Remove '-None-' option from Select List Field?

texts:
How can I remove the default option -None- in the Select list?
It should not be an option in my select list.


texts:
I'm trying to find the hook/module which can modify a views query.

The view is from Workbench module which is displaying the draft's of the actual user.

If I Disable SQL rewriting in the Query settings the display is ok,
so something is interfering.

What would be the method to debug?


texts: Best practices for protecting from injection on form fields

texts: I am building a form in Drupal 7. I have a textarea field and would like to know if it is safe to get the field content ($form['values']['field_name']) and save it to the database using something like db_insert, db_update or db_merge. OR do I have to do some sort of filtering to avoid SQL injection attacks. Thank you


texts: Workaround to post inline JS code at any time in D8?

texts:
In Drupal 7 this worked:

drupal_add_js("jQuery(document).ready(function () { console.log('Hello!'); });", 'inline');

which aims to print the messages from the PHP code onto DevTools JS console in realtime (on each page request), however in Drupal 8 the above function has been removed in favor of #attached.

I'm aware that I should use #attached in my library, but sometimes the $form is not accessible and I'd like to invoke some JS code on certain functions and conditions (e.g. in hook_tokens) for debugging purposes (like injecting some PHP variables into the JS message during the processing).

Is there any other way of doing this?


texts:
I have a module that provides an input filter for Drupal 6 and 7. It renders some elements using a (heavy) JavaScript module that I don't want to include on every page.

In Drupal 6 the input filter would run and if a element that needed rendering was present the JavaScript files were added using the drupal_add_js(...) method in the process step of the input filter. This works fine.

In Drupal 7 however, drupal_add_js(...) is only executed when I clear the cache. Otherwise the page is rendered but the JavaScript files aren't added. At first I thought that this was due to caching of the input filter. However I have set cache=>FALSE for hook_filter_info() and indeed $cache is FALSE in the process step.

Any suggestions how to fix this?


texts: Rename "-none-" option for select list field type

texts:
I have several list fields, one of which is a list (text) field. The default value for the form, where no value is stored if nothing is selected, is "-None-". Is there some way to alter this to say "-Select-" instead? The reason is that in the context of the field, the option of "-None-" doesn't make any sense. In this particular field, one of the actual selections being stored in the database is "None". Here's images of a few fields where -None- doesn't make any sense.

So, is there any way to change these aside from making them required fields?


texts: I have installed the "Webform" module with no problem, but when I create a new webform, I don't have the possibility to add a new field. I have checked the section config/content/webform. I get this message "Webform is currently not enabled on any content types". Since I am new to Drupal, I don't know what to do,can somebody help me please?


texts: How can I replace nodes in quicktabs on click of a link?


texts:
I'm getting this error in my custom module.

  [warning] Missing argument 1 for signin_menu(), called in
  /public_html/includes/menu.inc on line 2813 and defined
  signin.module:2

here is my code to create hook menu call back.

function signin_menu(&$items) {
  $items = array();

  $items['signin'] = array(
    'title' => 'Sign In',
    'description' => 'Sign In Form',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_login'),
    'access callback' => TRUE
  );

  return $items;
}


texts: How to use loadByProperties when one of the properties is an array?

texts:
I have this configuration entity and I want to load an entity using the properties label and subregions

Lets say I want to load the entity if it has the label CU and the subregions CU-04. Note that subregions is an array. I tried with this code but is not working.
$region = $this->entityTypeManager->getStorage('region')->loadByProperties(['label' => $region, 'subregions' => $subregion]);

How can I call loadbyProperties with properties being arrays?


texts:
I am struggling with this for a while. In my setup, every user gets to have the main profile. However if there are all fields empty, the profile is not created.
Problem: It is not possible to access fields in user profile, for example using rules or php. Rules gives error - The variable or parameter is empty.

After editing any of profile fields, the profile is created and available for extracting data.
So is this any sort of bug or is it somehow possible to save/enable even empty profile, to be able to work with fields?

Thank you


texts:
I am trying to understand and get the example working that was discussed here http://api.drupal.org/api/drupal/includes--ajax.inc/group/ajax

I understand the form building function.

function ajax_example_simplest($form, &$form_state) {
    $form = array();
    $form['changethis'] = array(
    '#type' => 'select',
    '#options' => array(
      'one' => 'one',
      'two' => 'two',
      'three' => 'three',
    ),
    '#ajax' => array(
      'callback' => 'ajax_example_simplest_callback',
      'wrapper' => 'replace_textfield_div',
    ),
    );

    // This entire form element will be replaced with an updated value.
    $form['replace_textfield'] = array(
    '#type' => 'textfield',
    '#title' => t("The default value will be changed"),
    '#description' => t("Say something about why you chose") . "'" .
    (!empty($form_state['values']['changethis'])
    ? $form_state['values']['changethis'] : t("Not changed yet")) . "'",
    '#prefix' => '
',
    '#suffix' => '
',
    );
    return $form;
}

What I don't understand is what is happening in ajax callback function.

function ajax_example_simplest_callback($form, $form_state) {
    // The form has already been submitted and updated. We can return the replaced
    // item as it is.
    return $form['replace_textfield'];
}

The same form field is returned. I thought we can change the value or something for the form item $form['replace_textfield'] through ajax callback function. Can some one pls help me to explain this part?


texts: One content type with several fields or several content types?

texts:
currently I'm working on a master data management system in Drupal.
We've got products for different sales channels (like ebay, magento, amazon etc.)
On field where I'm struggling is: Category
(CatEbay, CatMagento, CatAmazon, etc.)
for one and the same product.

Two options:
Add more fields to a sales channel (content type) or add different sales channels.
If I've got different sales channels, I need to implement a relation as well as the translation might be tricky.

If I simply add several category fields, it doesn't look very nice, but makes everything quite easy.

There is something like:
https://drupal.org/project/bundle_inherit
but does it work with translation or export node + it's alpha2 and we are in a production environment ... maybe it just adds complexity without a lot of benefit.

Would there be a disadvantage to point out by going the 'adding fields' way?

Thanks,
Chris


texts: How do I get the raw URL as a field in Views?

texts:
In views I need to return the raw url that is provided as the href value to the title field (when as a link) or the Content: link value.  I thought originally I could choose Content:link and strip the HTML in a rewrite, but no go.

I need the full URL so that I can pass it as a parameter in a field rewrite. Thoughts on how to get this only?


texts:
Drupal 7 system. minimalistic, almost no modules installed and the site works fine. The problem:

From the moment I've installed the module Jquery Update, There is no more Dropdown by the Admin Menu module... Please help.


texts:
I have two views that are block displays.  I'm trying to embed these views in a block.  When I include the block nothing is displayed.  If i add "test" to $block['content'] it displays test in the block body.

Here is my code ($gid is an organic group id as an argument to the block):

  case 5: // Create Mugshot block
    $viewName = 'display_most_wanted';
    $display_id1 = 'block_1';
    $args = array($gid);
    $wanted = views_embed_view($viewName, $display_id1, $args);

    $display_id2 = 'block_2';
    $convicted = views_embed_view($viewName, $display_id2, $args);

    $block['subject'] = 'CWPA OG Mugshots';
    $block['content'] = $wanted . $convicted;
    break;

  default:
    // Throw an error
    break;
}

return $block;


texts:
How I can define my node-title.tpl.php via dashboard?

Here what I did:

I created new content type page (our locations)
I uploaded a file to the templates: node-our-locations.tpl.php
I added new (our locations) content, and I set (our locations) in the title field


texts:
I have a content type 'project' and I want to theme the node add form for this content type, I tried to create a page--node--add-project.tpl.php but I don't have the list of form element to render in this file.
devel_themer don't print the variables list in the node add page
thanks


texts: Show list of users based on taxonomy term (D7)

texts:
I have a taxonomy vocabulary "Department". In the user account I have a taxonomy term reference field with this vocabulary. So each user can be assigned to one or more departments. I used the module Taxonomy Meny to show the taxonomy terms in my main menu.

Now I want to show a list of users when I click on a department in the menu. Does anybody have an idea how I could do this?

Thanks.


texts: Changing drupal project folder breaks links

texts:
I have a drupal project working in the server home directory. I want to move this from the server home directory to a subdirectory to make way for other drupal projects.

I move the whole drupal project from www/var/html to www/var/html/old_project

I change the $base_url in the drupal project settings to http://localhost/old_project

In the web browser I navigate to localhost/old_project. The home page displays but image links are broken. Links are broken to any other page I navigate to on the site. I can see that the urls are missing the .../old_project/...' part of the url.

Why is it omitting this and how can I fix it?

EDIT

Even when I access the urls directly typing in the '.../old_project/...' part I get 404 errors.

I have also tried adding RewriteBase /old_project in the .htaccess in /sites/default/files/ and rebuilding the registry.

Many thanks


texts: Create new page without using Views or Panels?

texts:
I'm now in process of reducing the numbers of module used in the website. I will disable Panels and several other modules, but still using Views.

(The website is not too complicated, but because many modules involved, it become quite slow.)

Instead of using Panels, I'm customizing the appearance through dozens of template files.

But I just wonder, is it possible to create new page without using Views or Panels?


texts: Views Send - Send bulk email programatically

texts:
This is for Drupal 6.

I've looked around for an answer to this, but I've been unable to find anything. Basically, I'm using hook_cronapi from Ultimate Cron to do a check every 24 hours, and if certain conditions arise, I want to send a bulk email using Views Send.

Super simple example of what I want to accomplish:

$view = views_get_view('people_to_email_to');
if (!$view) {
    watchdog('not_real', "Couldn't find view");
    return;
}

$view->set_arguments(array($emailText));
$view->build('email_all');
$view->execute('email_all');

// What do I do from here?

As near as I can tell I don't actually send an email on execute, and I can't seem to find documentation which could help. Any ideas?


texts: Drush does not work invoking the local Drush

texts:
I have installed new D8 on a remote server using this way https://github.com/drupal-composer/drupal-project .
I have pulled files from GitHub and I have run 'composer install' for getting the all vendor files include the local Drush (/vendor/drush/drush/)
When I run 'drush status' or 'drush core-status' on the root (or '/web') website directory I have:

vagrant@drupalvm8:/var/www/drupalvm/test8$ drush core-status
PHP Warning:  pcntl_exec(): Error has occurred: (errno 8) Exec format error in /usr/local/share/drush/includes/startup.inc on line 412
Warning: pcntl_exec(): Error has occurred: (errno 8) Exec format error in /usr/local/share/drush/includes/startup.inc on line 412
Error has occurred executing the Drush script found at /var/www/drupalvm/test8/vendor/bin/drush.launcher (errno 8) Exec format error


texts:
Recently we started a proyect where we need to implement a webpage that should be able to manage google maps markers and locations, with aditional info on them. However the requirement was to do it as a Drupal module in order for the client to embed it on his existing web page powered by Drupal.

I have a strong background developing web pages using java technologies like JSF, and I have had some previous experience using PHP MVC frameworks like cake php, but that's the reason why I think I'm so confused with the module development process used in Drupal (hook methods and conventions...).

First of all I have been looking at the Drupal 7 module development book by Packt, and I just finished the chapter 4 where you're supposed to implement and theme a single blog module. However by using the techniques showed until that point... I find it extremely difficult to implement a google maps powered (Block???) by just theming it as lists or using the render API.

What I found really interesting was the possibility to use theme templates and create the block content based on them; by just passing variables and priting php statemnets..., but it's not explained very well on the book either. So that's why I wanted to ask you where I could find more resources about theme templates, so that I could just put my html markup and js functions on that template, and pass to it the processed variables.

Anyway I think my best bet would be to extend existing module funcionality. In example for the maps I would use the OpenLayers Drupal module that's already done and tested. However, I need to execute my own code logic when a marker is selected, so that's another question..., how Could I insert a callback or intercept the OpenLayers module's functions so that I can extend them and save the data on my own tables or any operation I needed.

Should I rewrite the module files to add more functionality?? or could I implement my own modules and just intercept method calls?.

I'm just starting Drupal, and I think is really simple... but just for showing content, on the other hand interacting with the user, retrieving data from clients, seems to be really really difficult, because I have no idea how to show custom html markup, or add js functions, and then executing php ajax function callbacks on the server.
For all these reasons I'm felling a little bit overwhelmed, and I really really need some guidance, tutorials, resources to focus on..

The other question I had is..., what are the topics that I should focus most in order to start my module fast, what I basically need is the ability to put markers on a map (Using the Javascript V3 API I guess...), and then sending AJAX callbacks to the server in order to update the selected marker info and adding it to my Session?? variables.. (This is really easy using JSF, and a framework like Primefaces.. however in the php world I'm lost) I think I should look at Drupal Entities and Fields next... but also Widgets?? Right???

Thanks a lot.


texts: How can I pass user real name as a contextual filter in views

texts:
I am trying to simply provide a view of author content by passing a contextual link for the author ID to provide a URL with the author's name as selected with the Real Name module.

For instance: "/sitename/content-type/realname".

When I set up the filters, the only way I can get it to work is by providing the user name, not the real name as set by the real name module. I would like to keep the login name private, and use the real name as assigned.

Has anyone had any success doing this?


texts: Drush - /usr/bin/drush: line 129: /usr/bin/php: Success

texts:
When I run any drush command I am getting this line:

/usr/bin/drush: line 129: /usr/bin/php: Success

For example:

[root@061889 ~]# drush
/usr/bin/drush: line 129: /usr/bin/php: Success
[root@061889 ~]# drush cron
/usr/bin/drush: line 129: /usr/bin/php: Success
[root@061889 ~]# drush help
/usr/bin/drush: line 129: /usr/bin/php: Success

I've tried rebooting my VPS but am still getting the same issue. This has been discovered while trying to get past a "Attempting to re-run cron while it is already running" error, in case that has any relevance. But, you've guessed it...

[root@061889 ~]# drush vdel cron_semaphore
/usr/bin/drush: line 129: /usr/bin/php: Success

Any ideas?


texts: How do you get the tid from a taxonomy term page?

texts:
I've got a component on a taxonomy term page and need to use the TID in it's preprocess function.

How do I actually get the tid to save as a variable?


texts: How do I avoid duplicates when using a reference field?

texts:
I have a content type with an entity reference field. If I have more then one entity in this field, and display the field in a view, it displays  duplicates.

Anyone figured out how to remove these duplicates in Drupal 8?


texts: How to remove "Sort by Items per page" in drupal 7

texts:
I have a Drupal7 website. I have a Block-View in it with a title , header and a footer .
When I apply the view to the desired region , a "sort by Items per page" line show up on the webpage. I have not applied any sort criteria . How do i get rid of it ? Thanks !
The screen shot for the view is here and there is nothing in the Sort Criteria

The code for the view is here

  SELECT node.nid AS nid, node.title AS node_title, 'node' AS
  field_data_field_event_image_node_entity_type, 'node' AS
  field_data_field_event_date_node_entity_type, 'node' AS
  field_data_field_event_location_node_entity_type FROM  {node} node
  LEFT JOIN {field_data_field_event_date} field_data_field_event_date ON
  node.nid = field_data_field_event_date.entity_id AND
  (field_data_field_event_date.entity_type = 'node' AND
  field_data_field_event_date.deleted = '0') WHERE (( (node.status =
  '1') AND (node.type IN  ('event')) AND
  (DATE_FORMAT(ADDTIME(field_data_field_event_date.field_event_date_value,
  SEC_TO_TIME(-14400)), '%Y-%m-%d') >= '2017-09-13') ))


texts:
In some lists my content types all disappear. This especially affects Apache Solr for me. But also Views and Rules dont show the content types in some lists.

Interesting is that:

One content type is shown("Rezept") which is created by a custom module
All content types are shown correctly the moment i clear the cache.

Views:

Apache Solr Module:

The moment i clear the cache they show up correctly. But as soon as the cache clearing is finished and i reload the page, they disappear again:

Views while clearing the cache:

Apache Solr while clearing the cache:


texts: Edit old revision without changing the current revision

texts:
I'm using revisions to keep a public archive of changes in my nodes. Is it possible for me to edit an old revision of a node (both the message and the fields) directly, and not change the current revision? Basically, what I'm trying to do is what the User Revision Edit module does, but for nodes.

So far, in my custom module, I have something like this (notice that I'm also using the Revisioning module):

/**
 * Implements hook_menu().
 */
function node_revision_edit_menu() {
  $items['node/%node/revisions/%vid/modify'] = array(
    'title' => 'Modify this revision',
    'load arguments' => array(3),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('node_revision_edit_form', 1, 3),
    'access callback' => '_node_revision_edit_link_access',
    'access arguments' => array('modify revisions'),
    'file' => 'node_revision_edit.admin.inc',
  );
  return $items;
}

and the essence of the logic that I'm trying to apply:

function node_revision_edit_form($form, &$form_state, $node, $vid) {

  // Prepare loading the node edit form
  form_load_include($form_state, 'inc', 'node', 'node.pages');

  // Populate the form state.
  $form_state += form_state_defaults();

  // Save the form id for the current content type.
  $nfid = $node->type . '_node_form';

  // Rebuild the entire user edit form for our needs
  $form = drupal_retrieve_form($nfid, $form_state);
  drupal_prepare_form($nfid, $form, $form_state);

  // Setup the already existing log in the field
  $form['revision_information']['log']['#default_value'] = node_revision_list($node)[$vid]->log;

  // Set the "Modify current revision, no moderation" as the default revision operation
  $form['revision_information']['revision_operation']['#default_value'] = 0;

  // Unset the options that we do not need
  // unset($form['options']);

  // Create a new submit button since we do not want to invoke the standard callback functions
  unset($form['#submit']);
  $form['#submit'] = array('node_revision_edit_form_submit');

My problem is that I have no idea as to where to go from here. I obviously can't use node_save since it automatically handles revisions. Any ideas on what my next step should be? Is there a function that I'm missing and could be useful for my problem? Or will I have to go for direct database edits?

Any feedback is greatly appreciated.


texts: How to create a vocabulary and populate it with terms using features

texts:
I'd like to create a feature that creates a vocabulary and populates it with taxonomy terms.

Creating a vocabulary is easy with features and it can be done using UI (I only need to select the desired existing vocabulary and add it as dependency and a file features.taxonomy will be created)

However, there's no way to export terms to a feature, so I created a feature_name.install file and added the following function on it:

/**
 * Implements hook_install().
 */
function feature_name_install() {
  // Populates 'Vocabulary name' vocabulary with taxonomy terms.
  $vocabulary = taxonomy_vocabulary_machine_name_load('vocabulary_machine_name');
  $terms = array();

  $terms[] = t('Term 1');
  $terms[] = t('Term 2');
  $terms[] = t('Term 3');

  foreach($terms as $name) {
    $term = new stdClass();
    $term->vid = $vocabulary->vid;
    $term->name = $name;
    taxonomy_term_save($term);
  }
}

The problem with this code is that when installing the feature it is loaded before creating the vocabulary so tries to add terms to a vocabulary that does not exist yet and produces an error.

I have tried using hook_post_features_enable_feature but I didn't succeeded (I may be using a wrong syntaxis, see code below).

/**
 * Implements hook_post_features_enable_feature($component).
 */
function feature_name_post_features_enable_feature($component) {
  $component = 'feature_name';
  // Populates 'Vocabulary name' vocabulary with taxonomy terms.
  $vocabulary = taxonomy_vocabulary_machine_name_load('vocabulary_machine_name');
  $terms = array();

  $terms[] = t('Term 1');
  $terms[] = t('Term 2');
  $terms[] = t('Term 3');

  foreach($terms as $name) {
    $term = new stdClass();
    $term->vid = $vocabulary->vid;
    $term->name = $name;
    taxonomy_term_save($term);
  }
}

Can anyone tell me how to solve this?


texts: Best way to migrate content and various other changes from development to production

texts:
I'm about to make a bunch of updates and changes to content types, views, themes and actually adding content on my development server.  I was wondering if there was an easier way to migrate things from development to production beyond doing the following:

putting the production server in maintenance mode.
copying over everything  (development -> production) from site root (excluding sites/default/settings.php)
exporting the development database and importing it on the production server
crossing fingers and hoping that nothing crashes for unforeseen reasons.

I've seen that there's already some posts on workflows that involve using the features module, but does it actually export content or settings changes to things like blocks and views?  I was wondering if there was a module or a tutorial that I wasn't able to find on google that gave some good advice on this.


texts: Ajax call with Submit loses submitted form data

texts:
I've built a super simple form in D8 meant to check the format of the field then when submitted the form data is placed in the DB.  I check the format using a Ajax call -- yes, I know js is a better solution but there will be future needs for this solution. The Ajax event is 'change'.

If I use this procedure the form works as needed:

Enter data in textfield
Click outside the textfield
Ajax Call Occurs
Click Save
Submit function called w/ good data

This procedure fails:

Enter data in textfield
Click Save
Ajax Call Occurs
Form gets redrawn
Submit function called w/ empty data

Is there a customary design rule I'm unaware for handling this?

    <?php

/**
 * @file
 * Contains \Drupal\example\Form\ExampleForm.
 */
namespace Drupal\ssForm\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use PDO;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\CssCommand;
use Drupal\Core\Ajax\HtmlCommand;

include 'ssForm.config';

/**
 * Implements an example form.
 */
class ssForm extends FormBase
{
/**
 * {@inheritdoc}
 */
public function getFormId()
{
    return 'ssForm';
}

/**
 * {@inheritdoc}
 */
public function buildForm(array $form, FormStateInterface $form_state)
{
    $a = 1;
    $form['protocol_name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Your Protocol Number.'),
      '#id' => 'protocol_id',
      '#ajax' => [
        'callback' => array($this, 'validateProtocolNameAjax'),
        'event' => 'change',
        'progress' => array(
          'type' => 'throbber',
          'message' => t('Verifying protocol...'),
        ),
      ],
      '#suffix' => ''
    );

    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Save'),
      '#button_type' => 'primary',
    );
    return $form;
}

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

/**
 * {@inheritdoc}
 */
public function submitForm(array &$form, FormStateInterface $form_state)
{
    try
    {
        $dbName = 'CRUD_boogie';
        $pdo = new PDO("mysql:host=localhost;dbname=CRUD_boogie", 'root', 'root');
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    catch (PDOException $e)
    {
        die("DB ERROR: " . $e->getMessage());
    }

    // Build a Prepared Statement
    $stmt = $pdo->prepare("INSERT INTO REGISTRY (name, value, phone, protocol) VALUES (:name, :value, :phone, :protocol)");
    $stmt->bindParam(':name', $name);
    $stmt->bindParam(':value', $value);
    $stmt->bindParam(':phone', $phone);
    $stmt->bindParam(':protocol', $protocol);

    // insert one row
    $name = 'one';
    $value = 1;
    $phone = 'phone_number';
    $protocol = $form_state->getValue('protocol_name');
    $stmt->execute();
}

/**
 * Ajax callback to validate field.
 */
public function validateProtocolNameAjax(array &$form, FormStateInterface $form_state)
{
    $fieldValue = $form_state->getValue('protocol_name');
    $fieldPattern = '/^\d\d-\d\d\d$/';

    $valid = preg_match($fieldPattern, $fieldValue);

    if ($valid) {
        $css = ['border' => '1px solid green'];
        $message = $this->t('Protocol Name Valid.');
    }
    else {
        $a = 2;
        $css = ['border' => '1px solid red'];
        $message = $this->t('Protocol Name Not Valid.');
        $a = 1;
    }

    $testAry = array('test' => 'data'); //added-edit
    $form_state->setStorage($testAry);

    $response = new AjaxResponse();
    $response->addCommand(new CssCommand('#protocol_id', $css));
    $response->addCommand(new HtmlCommand('.protocol-valid-message', $message));
    return $response;
}

}


texts: How to query solr server from php in Drupal 8

texts:
How do you query solr server from php in Drupal 8?

I have installed search_api, search_api_solr and search_api_attachments.  Also have Solr v.8.4.0 installed.

I installed php SolrClient for Centos 7 following this guidance: https://stackoverflow.com/questions/22959330/fatal-error-class-solrclient-not-found
, but I still get "Class 'SolrClient' not found" every time I run

new SolrClient($options);

I have located documentation on querying Solr from php in Drupal 7 (apachesolr_get_solr()) but nothing in Drupal 8.


texts: What may cause "An illegal choice has been detected. Please contact the site administrator"?

texts:
When a user goes to create content, usually for a forum the following error is received.

  An illegal choice has been detected. Please contact the site
  administrator.

The forum topic can still be created however.
This doesn't happen if the user is administrator.

The following errors can be seen in error report

Type form
Date Wednesday, May 1, 2013 - 12:24
User 222_test
Location
Referrer    /node/add/forum
Message Illegal choice 423 in term_node_tid_depth_1 element.
Severity error
Hostname
Operations

Type form
Date Wednesday, May 1, 2013 - 12:24
User 222_test
Location /node/add
Referrer    /node/add/forum
Message Illegal choice 427 in term_node_tid_depth element.
Severity error
Hostname
Operations


texts: How can I add a CSS class to the body tag based on the current path alias?

texts: Is it possible in Drupal 8, to add a CSS class to the <body> tag based on the current path alias?


texts: Field-Group Tabs not displaying on product page

texts:
I'm trying to display a handful of fields as tabs on my product detail pages, but it seems that the field-group tabs are being completely ignored by the Commerce product display. Anyone else have this problem? Did I miss something in the tab setup/display?

The fields display as any other field for the Product, just output as regularly expected. As mentioned, just seems to ignore the 'tabs' display.


texts:
Let's say I have a team, which has members. I have a content type for team and a content type for individual team members. Let's say there are also other relationships, for instance teams can belong to departments, and there are projects that can be assigned to individuals or teams.

As I understand it there are two ways I can define the relationships between these entities - either Entity references, or using Taxonomy terms. When I should use one type over the other? Is it best to choose just one method, or mix them?

It seems to me that Taxonomy is the most flexible, because it is easy to build trees using taxonomy types, or for instance if within a team I then decided I wanted to build a hierarchy in the team the functionality is already there (just drag the taxonomy terms into the hierarchy) whereas if I've used Entity reference I can't think of a simple way to do that (other than adding taxonomy, which then results in redundancy).

It feels as if there is something I'm not understanding here, but I'm not sure what it is!

Any help would be appreciated.


texts:
In Drupal 8 I visited admin/structure/comment/manage/comment/form-display and disabled the subject.

1- The subject field is gone, but the subject label for comments is still shown. Is there any option to hide that, or should I change the theme?

2- It looks like there used to be an Allow comment title setting for each content type. Has it been removed in Drupal 8, or is it just me who cannot find it?

3- How can I avoid an empty comment title is automatically filled with the first words taken from the comment?


texts: A post var error upon webform submitting programmatically

texts:
I need to update a webform submission using function drupal_form_submit.

And upon updating an error is displayed.

  This form could not be submitted because $_POST was truncated to 5
  input vars. PHP max_input_vars is 10000 and needs to be increased

I tried to increase max_input_vars value even up to billion, but it doesn't helps.

The webform is very big and complicated.

Here I can't use function webform_submission_update, because some form alter and form validation functions must be executed upon the webform submission updated.


texts: How to transmit parameters to Rules Component upon using Rules Scheduler programmatically?

texts:
Now I'm trying to create a Rules Scheduler task programmatically.

I've created a Rules Action with parameters and callback, also I've created a Rules Component with this Rules Action.

But upon trying to create the Rules Scheduler task programmatically I can't transmit it parameters for the Rules Component.

I'm using code, found here.

$now = new DateTime();
    $component = 'yrv_invitation_coupon_test_rule';
    $task_id = $now->getTimestamp();

    rules_action('schedule', ['component' => $component])
        ->executeByArgs([
            'date' => $now->getTimestamp()+10,
            'identifier' => $task_id,
            'param_uid' => 10,
            'param_rid' => 5,
        ]);

It works, but with default parameters.That is, executed Action in the Component can't get param "uid" with value = 10 and param "rid" with value = 5.

Could ou clarify me, how can I assign parameters ?

Here's my Action

$actions['yrv_invitation_coupon_user_remove_role'] = [
        'label' => t('Remove a role assigned upon activation an invitation coupon'),
        'group' => t('System'),
        'base' => 'yrv_invitation_coupon_remove_role_callback',
        'parameter' => [
            'uid' => [
                'type' => 'integer',
                'label' => t('User ID'),
                'default value' => 1,
            ],
            'rid' => [
                'type' => 'integer',
                'label' => t('Role ID'),
                'default value' => 1,
            ]
        ],
    ];

And here's my Rule Component

$rule = rule();
    $rule->label = 'YRV Invitation coupon test Rule';
    $rule->class = 'Rule';
    $rule->action('yrv_invitation_coupon_user_remove_role', ['uid' => 1, 'rid' => 1]);
    $rule->active = TRUE;

    $configs['yrv_invitation_coupon_test_rule'] = $rule;


texts: Direct link to view unpublished node causes redirect loop

texts:
When I unpublish a node and have another user without permissions to view unpublished content trying to access that node (through an external link for example) it will generate a redirect loop. It just does a bunch of 302's to the same page, until the browser stops it.

I would expect an "access denied" page. What could cause the redirects to the same page?

Disabling "global redirect" module didn't have an effect. I don't have any rules or module code relating to it either.

Update:

Anonymous visitors get redirected to the /user/login page. Authenticated users don't have "view unpublished nodes" permission.

I guess I can change my 403 page to something other than /user/login to fix the redirect loop.

Question:

How would I create a regular page and show the login form if they are not logged in already, otherwise show a "page has been deleted" error?


texts:
In Drupal 7 I used this to unset unneeded elements and total overwrite meta tags:

function MYTHEME_html_head_alter(&$head_elements) {
  // Unset all.
  $remove_array = array(
    'system_meta_content_type',
    'system_meta_generator',
    'system_shortcut_icon',
    'metatag_canonical',
  );
  foreach ($remove_array as $key) {
    if ($head_elements[$key]) {
      unset($head_elements[$key]);
    }
  }
  // Optimize the mobile viewport.
  $head_elements['mobile_viewport'] = array(
    '#type' => 'html_tag',
    '#tag' => 'meta',
    '#weight' => -10,
    '#attributes' => array(
        'name' => 'viewport',
        'content' => 'initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width',
    ),
  );
  // ...
  // Many other my META tags
  // ...
}

But in Drupal 8 this doesn't work anymore. New elements such as $head_elements['mobile_viewport'] don't get added.

And old meta tags, such as

<meta name="Generator" content="Drupal 8 (https://www.drupal.org)">
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<link rel="shortcut icon" href="http://example.com/core/misc/favicon.ico" type="image/vnd.microsoft.icon">

are still in <head>. How can I remove them and add others instead in Drupal 8?


texts:
I am using Drupal 7.34 and I have a problem..

My module is reacting on node changes. When a node is updated one or more other nodes are automatically being updated, too. I call a function that triggers that update in hook_node_save.

Everything is fine until I try to make changes to the node that was initially saved and is passed to the hook_node_save. The reason is actually pretty obviuos: The changes prepared during the inital save process are overwriting the changes made during the function that is called in hook_node_save.

So here is my question with an example: I want to change field_a of node 100 after node 100 is updated from somewhere around the system. How do I achieve that while having access to the initially updated values of node 100?

Edit 1:

My hook_node_presave:

if (!$node->is_new) {
  $items = field_get_items('node', $node, 'field_oc_revision');
  if ($items) {
    _trigger_steps($items[0]['value'], $node);
  }
  debug($node);
}

The _trigger_steps() function changes the $node object passed by reference.

Now when I click save on a node form hook_node_presave is triggered twice. The first time the debug shows that the field is changed in the normal $node field, but not in the $node->original field. The second time the debug shows that the field is changed in the $node->original field, but not in the $node field.

Hope that gives more insight.

Edit 2:

One more thing to mention: When using the same code with manually calling $node = node_load(100); node_save($node); everything works like it should.

Edit 3:
This is the part of the code of the _trigger_step function that is executed.

$connected_node = user_activity_get_step_base_node($base_nid, $step['connected_node_type']); // In this special case this loads the node that was just updated

$items_base_field_name = field_get_items('node', $connected_node, $step['base_field_name']); // $step is a definition of a step to trigger.

$expert_uid = $process['coordinator_user'];

$expert_nid = $items_base_field_name[0]['target_id'];
$expert_nid = node_load($expert_nid) ? $expert_nid : '';
// check if expert uid is set and node is not already linked
if($expert_uid && !$expert_nid) {
  $expert_node = new stdClass;
  $expert_node->type = $step['node_type'];
  node_object_prepare($expert_node);

  $expert_node->language = LANGUAGE_NONE;
  $expert_node->title = $node_type_names[$step['node_type']];
  $expert_node->uid = $expert_uid;
  $expert_node->promote = 0;
  // connect the nodes
  $expert_node->{$step['assignee_field_name']}[LANGUAGE_NONE][0]['target_id'] = $connected_node->nid;
  // tree assignment
  $expert_node->field_oc_revision[LANGUAGE_NONE][0]['value'] = $base_nid;
  $expert_node->field_oc_tree_element[LANGUAGE_NONE][0]['value'] = $step['sid'];

  // save new node
  node_save($expert_node);

  // if the updated node is the one that we want to change here, we just change the passed node. it is saved after hook_node_presave.
  if($updated_node) { // $updated_node is passed by reference
    $updated_node->{$step['base_field_name']}[LANGUAGE_NONE][0]['target_id'] = $expert_node->nid;
  // if not we set save it directly
  } else {
    $connected_node->{$step['base_field_name']}[LANGUAGE_NONE][0]['target_id'] = $expert_node->nid;
    node_save($connected_node);
  }
}

Thanks a lot!
cheers
j


texts: Composer patches cweagans Core module update syntax - one patch not being applied

texts:
I'm using cweagans composer patches: https://github.com/cweagans/composer-patches
to patch Drupal 9.x
I've made a patch file.  The first patch applies but I think I have the path wrong for the core module,  layout_builder, which I am trying to patch.  Patch file below.  The patch seems to be completely ignored.  Layout Builder patch is applied to: core/modules/layout_builder/src/Form/OverridesEntityForm.php
EDIT:  something is wrong with my patches file.  I moved the patches back into the composer.json file and both worked (with changing "core/lout_builder" to "drupal/core"
When I moved the patches to a file, composer actually re-installed IMCE (from the first patch) but I didn't notice that it didn't re-apply the patch.  So neither patch was working.
{
   "patches": {
     "drupal/imce": {
         "Secuirty isued D9 imcefilefield": "https://www.drupal.org/files/issues/2020-06-25/ImceFileField-3149697-9-D8.patch"
     },
     "core/layout_builder": {
         "Default region for overridden layout of entity": "https://www.drupal.org/files/issues/2019-06-18/3053906-11-default-region-value.patch"
     }
   }
}


texts:
I can't understand somethings about commits.

For example, for the Webform module, in its project page it is written that last version is "7.x-3.15 2011-Dec-08," but in the commits page, it is written that there is commits to 7.x-3.15 in 25 February 2012.

I also checked the releases page; one of them has been released on December 2011, and another has been released on February 2012.

Does it mean that these versions were commited to git, but not released?
So it was an unstable version?
Is this usage common for Drupal module releases?


texts: how to set minimum quantity of products in the shopping cart?

texts: I want to set minimum quantity of goods that customer may order in the shop. For example minimum quantity is 20, so if customer order less then 20 his order won't process and there will be message telling him that he must purchase 20 or more and redirecting him to his shopping cart


texts: Is it possible to change the fields' names of the JSON generated by Services module?

texts: I have a mobile app, which calls a legacy system's HTTP REST interface. Now I replaced the legacy system with Drupal and Services module. I forgot setting field machine name to match mobile app client, however, there is no chance to modify the mobile app. So, as I asked in the title: is there a way to change the fields' names of the JSON generated by Services module?


texts: Narrow down which module is causing a PHP warning

texts:
All of a sudden a site on my development server has been producing this php notice:

Notice: Use of undefined constant FIELD_BEHAVIOR_DEFAULT - assumed 'FIELD_BEHAVIOR_DEFAULT' in _field_info_prepare_instance() (line 297 of /var/www/mysite/modules/field/field.info.inc).
Notice: Use of undefined constant FIELD_BEHAVIOR_DEFAULT - assumed 'FIELD_BEHAVIOR_DEFAULT' in field_behaviors_widget() (line 458 of /var/www/mysite/modules/field/field.info.inc).

Is there anyway to narrow down which module could be causing this error? I've tried disabling a couple but have had no luck so far. I don't want to just disable the display of the warning as I feel I need to find the root of the issue :)

Has anyone else seen this error before? I suspected it might've been the GMap and Location modules for D7, but I've now removed them and I'm still getting this issue.

Thanks for your help!


texts: How to import a display mode configuration from a custom module

texts:
I have a custom module with the file config/install/core.entity_view_display.node.event.featured.yml
which contains config for a display mode called 'featured' for the content type 'event'.

The problem is, Drupal won't import these settings because the view mode 'featured' already exists.

I'm aware it already exists. I don't want to create the view mode. I want to simply import the settings for that view mode. I.e. populate the settings for each of the fields in that display mode.

Is there a way to do this without deleting the view mode before installing my module?


texts:
I need to send the URL of a Drupal 8 route to a template. I read some documentation on Drupal API, but when I implement this in my module, nothing happens.

My route in my routing file looks like the following.

movies.addMovie:
    path: /movies/add/{system}/{id}
    defaults:
        _controller: 'Drupal\movies\Controller\InsertController:addMovie'
        _title: 'Add Movie'
        system: ''
        id: ''
    requirements:
        _permission: 'create movies_movie'

This is the code I am using to get the URL from the route.

use Drupal\Core\Url;
Url::fromRoute('movies.addMovie')

When I put the URL in a variable, the code stops when calling Url::fromRoute(). Can someone tell me what I'm doing wrong?


texts: I want to change the text shown for the Node:Link field, which by default is "View". How can I change it?


texts: Filter module won't let me add nested values to my configuration

texts:
I'm working on the D8 port of my xbbcode module; my latest sources are here.

The module is supposed to let administrators enable individual BBCode tags either in the global default settings or in an individual text format that overrides those defaults.

The settings structure for both is basically (in YAML):

tags:
  abbr:
    module: xbbcode
    enabled: 0
  b:
    module: xbbcode_basic
    enabled: 1
  [...]

The default configuration (set in the annotation comment of my filter plugin class) is

/**
 * Provides a filter that converts BBCode to HTML.
 *
 * @Filter(
 *   id = "xbbcode",
 *   title = @Translation("Convert BBCode into HTML."),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_MARKUP_LANGUAGE,
 *   settings = {
 *     "autoclose" = FALSE,
 *     "override" = FALSE,
 *     "tags" = {}
 *   }
 * )
 */

However, when I try to create a new text format, I get the following error:

InvalidArgumentException: The configuration property filters.xbbcode.settings.tags.abbr
doesn't exist.
in Drupal\Core\Config\Schema\ArrayElement->get()
(line 97 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

Drupal\Core\Config\StorableConfigBase->castValue('filters.xbbcode.settings.tags.abbr', Array)
Drupal\Core\Config\StorableConfigBase->castValue('filters.xbbcode.settings.tags', Array)
Drupal\Core\Config\StorableConfigBase->castValue('filters.xbbcode.settings', Array)
Drupal\Core\Config\StorableConfigBase->castValue('filters.xbbcode', Array)
Drupal\Core\Config\StorableConfigBase->castValue('filters', Array)
Drupal\Core\Config\Config->save()
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('bb2', Object)
Drupal\Core\Entity\EntityStorageBase->save(Object)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object)
Drupal\Core\Entity\Entity->save()
Drupal\filter\FilterFormatFormBase->submitForm(Array, Object)
Drupal\filter\FilterFormatAddForm->submitForm(Array, Object)
call_user_func_array(Array, Array)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object)
Drupal\Core\Form\FormBuilder->processForm('filter_format_add_form', Array, Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

Some examination of the StorableConfigBase class reveal that it seems to insist on merging my configuration values with the existing ones, down to the bottom level, and when it doesn't find the "abbr" key it shuts down. This seems pretty silly, because obviously an array can gain or lose entries when you save it.

The weird thing is that the global defaults have absolutely no problem when I change them with $this->config('xbbcode.settings')->set('tags', [...])->save() in my own ConfigFormBase settings form.

Edit: filter.format.* has a config schema, while my module doesn't. I'm not sure how to tell this schema "this array may have a number of keys, each of which has the form {enabled: ..., module: ... }


texts: How often does hook_cron happen? what is the periodic time for executing the codes inside this hook?


texts: How to use the node title in the "Override title" field of contextual filter

texts:
Situation:

A view has a contextual filter on a field named type.

The view sorts by date and has the pager set to display 1 item (I want only the newest node).

I want to show type + the node title as the view title.

So, what I want to put in the Override title field is
{{ arguments.field_type_value }} {{ title }}

But {{ title }} doesn't work. It outputs nothing. This isn't a surprise because (a) {{ title }} isn't in the Replacement Patterns list and (b) I assume the view expects to display multiple nodes, so there isn't just one {{ title }} to display.
Is there a straightforward way to do what I want to do using a view as I'm doing? There are reasons why I want to use a view.
UPDATE:

The view is set to Show: Content so I can use a Twig template I created. (I added this update after seeing No Sssweat's first two suggestions below that work perfectly for Show: Fields but don't work for Show: Content. Note that No Sssweat also gives a solution for the Show: Content situation.)


texts: How does Drupal handle concurrent user creation?

texts:
I can't understand a specific part of the Drupal code, namely this snippet:

  $account->uid = db_next_id(db_query('SELECT MAX(uid) FROM {users}')->fetchField());

  // Allow 'created' to be set by the caller.
  if (!isset($account->created)) {
    $account->created = REQUEST_TIME;
  }

  $success = drupal_write_record('users', $account);

This is from the Drupal 7 code

My question is about concurrency. I imagined that two concurrent sessions are executing this and because the lack of transaction handling here they might try to insert two records with the same uid.

Can you tell me why this works in production? How is it possible that Drupal uses no transaction management although for example creating a node usually involves writing records into many different tables.


texts:
I have a content type called profile where a user can enter data and thereby create an own profile. Now, most of the profile fields are numeric but two of them are text areas. As my site is in German and English the user should be able to translate these two text area fields (the Input not the Label) but no other fields.

Does somebody know if there's a way to grant translation access to users for specific fields?


texts:
I was looking into the new Events system for Drupal 8 and there's something I haven't been able to figure out.

I need to dispatch an event when a user logs something to the watchdog table using the new logging API.

// Logs a notice
\Drupal::logger('system')->notice($message);
// Logs an error
\Drupal::logger('system')->error($message);

https://www.drupal.org/docs/8/api/logging-api/overview

I already define a new Event in a custom module but I don't know what needs to be created so when a module logs/adds information to the watchdog table using the code above my event gets triggered.

Thanks


texts: How can I hide revision information on node forms?

texts:
Trying to figure out how to hide revision information from node form. When users create a node, they see revision info at the bottom which confuses them.
I can't seem to disable revision info from the content type edit settings since there are nodes already. So the only solution is to hide it.
The way that I am going is by trying to add this:
$form['revision_information']['#access'] = false;

My question is how can I add that to my theme-name.theme file?
The content type is QUESTIONS


texts: Generate price from item selected in drop down

texts:
I am using Drupal 7.14, Commerce 7.x 1.3 and Views 7.x 3.3.
I want to have a drop down list on my product display form (or content display form) containing, say:

Full Price, no coach required - £ 200
Full Price, Glasgow coach - £ 230
Full Price, Edinburgh coach - £ 230
Full Price, Liverpool coach - £220
....

and I want, when an item on the list is selected, the displayed price to change to the indicated value and, of course, this to be passed to the cart.

How can I do that.


texts:
I have some trouble with user path aliases. I want that every user has a small page under /member/username. To enforce that I build in the settings (/admin/config/search/path/patterns) under user path the plattern: member/[user:name].

This seems to work fine but if I look at the contact link I get the link /user/1/contact I expect the link http://example.com/member/username/contact.

I have the same problem for some other links like editing any node. E.g. I have a link in my menu called Updates which is aviable under /updates but when I try to edit this one I see the url /node/123/edit.

I know that there is a module called Extended Path Aliases but this one breaks one of my own modules.

The problem there is that I use taxonomy to build paths for topics e.g. photography and sports. Normal posted news are then aviable under /photography/a-great-day or /sports/scores that will work with Extended Path Aliases, but it compleatly breaks my module with this pathes sports/event/%date (notation from menu_hook). That one seems to be routed to /sports.


texts:
OK this one is driving me nuts. I've read the other question posted on DrupalAnswers and several threads on the Internet, but I still can't work this out.

In my menu hook I have this:

$items['import'] = array(
    'title' => '',
    'type' => MENU_CALLBACK,
    'page callback' => 'drupal_get_form',
    'page arguments' => array('_my_module_form'),
    'access arguments' => array('access content'),
);

Then I have these functions:

function _my_module_form($form_state) {
 if(!isset($form_state['storage']['confirm'])) {

  $form ['some_textarea'] = array(
   '#type' => 'textarea',
   '#rows' => 25,
   '#cols' => 10,
  );

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

  return $form;
 } else {
  drupal_set_message('hello');
  return confirm_form($form);
 }
}

function _my_module_form_validate($form, &$form_state) {
 if(!isset($form_state['storage']['confirm'])) {
 }
}

function _my_module_form_submit($form, &$form_state) {
 if(!isset($form_state['storage']['confirm'])) {
  $form_state['storage']['confirm'] = TRUE;
  $form_state['rebuild'] = TRUE;
 } else {
  drupal_set_message('hello2');
 }
}

When I submit the form, nothing happens. I would expect to see the drupal message 'hello', but instead I just get the original form again. However, if I submit the form a second time, then I see a drupal message saying 'hello2'.

Why does the comfirm_form bit not get executed? It seems to me like the form state is not being rebuilt so the 'else' part of the conditional never gets executed.

Note: I am pretty sure form_validate is not needed, but I just put an empty definition in there in case.


texts: Exposed form in block not found in block view drupal 7

texts:
I am facing an issue what I need is expose some fields for search criteria & put these search boxes/drop downs to my sidebar, I didn't find the option "expose from in block" in the Exposed Form section, I have a block view, It is showing on the view page but not on the block view why?

Is there any solution regarding?
Thanks


texts: Views not displaying on page, but show up in preview

texts:
I have a view setup to display all properties where a drop down box = portfolio 1. However, when I set up the view everything looks correct but when I go to the actual url it does not display the teaser or full content in the body.

When I set it up as a block I can add it to my right sidebar and it displays fine...

here is the export of the view:

$view = new view();
$view->name = 'portfolio_1';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Portfolio_1';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Portfolio_1';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['row_options']['view_mode'] = 'full';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'property' => 'property',
);
/* Filter criterion: Content: portfolio (field_portfolio) */
$handler->display->display_options['filters']['field_portfolio_value']['id'] = 'field_portfolio_value';
$handler->display->display_options['filters']['field_portfolio_value']['table'] = 'field_data_field_portfolio';
$handler->display->display_options['filters']['field_portfolio_value']['field'] = 'field_portfolio_value';
$handler->display->display_options['filters']['field_portfolio_value']['value'] = array(
  'port1' => 'port1',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'portfolio-1';

I can provide screen shots if that would help.


texts:
Is it possible to modify the next User ID when creating new users in a Drupal 7 database?

As an example,

I have a user at UID 100, I then create and immediately two user accounts (101, 102). When I next add a user, I want the UID to revert to 101 rather than default behaviour of 103.


texts: How to refresh new migrations in Drupal 8 migration module?

texts:
When writing Drupal 8 migrate processes I only can refresh new migration processes if I reinstall the custom migration module. drush cr doesn't work.

Explanation:

I have one module, ie: cm_migrations, which have 2 migrations:

cm_users
cm_tags

With drush ms I see:

Group: beer     Status  Total  Imported  Unprocessed  Last imported
 cm_users        Idle    3      3         0            2016-02-09 16:56:25
 cm_tags         Idle    4      0         4

I write a new migrate process:

cm_beers

I execute drush cr; drush ms and I see the same table as previous.

Only when I uninstall and install cm_migrations I can see the three migration processes:

Group: beer     Status  Total  Imported  Unprocessed  Last imported
 cm_users        Idle    3      3         0            2016-02-09 16:56:25
 cm_tags         Idle    4      0         4
 cm_beers        Idle    4      0         4

Any clue about  how can I refresh the migration processes without reinstall the module?

Thanks


texts: Drupal 7: Two submit buttons and custom field validation

texts:
I have a custom user registration form (D7). I added two custom submit buttons inside THEME_form_alter

  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Sign Up')
  );
  $form['actions']['submit2'] = array(
    '#type' => 'submit',
    '#value' => t('Sign Up & Take Survey')
  );

These render fine and both handle the registration equally well but when submit2 is clicked I want to redirect to a webform survey.

I added the following:

function tweakform_user_register_submit($form, &$form_state) {

  if($form_state['values']['op'] == $form_state['values']['submit2']) {
    echo 'Redirect to survey and populate fields with user details';
    exit;
  }

}

I refreshed the cache and this function does not seem to be invoked.

Alex


texts: Add CSS class to fieldset div element without extending the template

texts:
I only want to add a class to the  inside the fieldset from fieldset.html.twig. It's a bit overkill to extend the template for just to add a class.

How can I achieve this with a preprocess function?

function mytheme_preprocess_fieldset(&$variables) {
// $variables['children']['attributes']['class'][] = 'mb-4';
}


texts: Changing the text "Add to Comment" in a given content type

texts:
I have a pretty frustrating problem going on here. I have been reading the answers over at this question:
How to change "add to comment" in comment form?.

But unfortunately neither of the suggested solutions worked for me. I tried with the following code in template.php:

function custom_node_view_alter(&$build) {
  if ($build['#node']->type == 'bar') {  //extra check for content type (optional)
    $build['links']['comment']['#links']['comment-add']['title'] = t('Add new review');
  }
  kpr($build);
  dsm($build['#node']->type == 'bar'); // true
}

I've also tried adding comment-wrapper-<my content type>.tpl.php to sites/all/themes/custom/templates but its not picking up either of these changes.

I've flushed all my caches so many times I'm getting RSI, but it's not showing the change. Am I missing something simple here?


texts:
I know I can customize the template by overriding page-title.html.twig
but I'm looking for a way to have more than one title template. in my case, the suggested name form my path is  page__manage__customer_list So I tried to override it with page--manage--customer-list-title.html.twig.
how is that possible to override the title template?

to make the question more generalize and could be useful for other guys that looking for similar circumstances this could be helpful.

How can I override the title template based on content type or route?


texts: Test if template files (.tpl.php) are used by theme

texts:
I've inherited a custom Drupal 7 theme with many template files. I'm sure lots of them aren't actually used by the website, and were part of the testing process.

Is there a method to list which .tpl.php files are being used in the website, or for a particular page?


texts: Passing custom fields as parameters in a REST query

texts:
I am creating a REST Get request using Services 3.3 module on Drupal 7.15 which should get all the nodes filtered by a custom field field_asset_type

http://sharedrive/?q=rest/node&parameters[field_asset_type]=13

It returns following error
Invalid query provided, double check that the fields and parameters you defined are correct and exist. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_asset_type' in 'where clause'

Kindly tell me how to resolve this problem. The articles on the internet explains how to pass built-in fields which is working but I also need to pass custom fields.

Please help


texts: How do I troubleshoot PrivateTempStore for session data?

texts:
I am updated one of my Drupal 7 modules for Drupal 8 and I discovered that I need to use PrivateTempStore rather than $_SESSION variables. I followed some great examples online, but it does not seem to be storing the data correctly. I am even checking the database directly afterwards, but it does not have the correct data. I've done some debugging at the point where I am storing the data to see what is set, and it says it is set with the value I expect. However, the database does not show this value and reloading the page and outputting the value retrieved does not show what I expect. What are the method people use to debug these issues.

Currently running Drupal 8.8.1 on PHP 7.3.


texts: Views Slideshow gives duplicate row classes

texts: I use views_slideshow and I use it's option Items Per Slide and I set it to 2, so it shows two nodes at a time. Problem is now, I cannot give both nodes separate styling, i.e. I want first row to have padding to right and second row to have padding to left, I could do that if it didn't have identical row-number classes:


texts: How does a custom module architecture work?

texts:
I am a beginner with D8 and I need to create a module with a custom form.
I created the module and created the form. I also created a custom block in order to render the form (the plugin block and the form are in the same module). Is everything ok ?

I don't understand how twig works in this case. On my admin panel I can add the block on a specific page. But can I modify the template of the form by creating templates files in my module ? I'm I obliged to use the block ?

Thank you very much.


texts: Is there a simple way to organize upload files with date?

texts:
I am using CKEditor with CKFinder. I know how to change the upload path. But the setting only have "%u"(UID) and "$n"(UserName) token for the upload path. I want to organize the files by date. How can I achieve?

Sorry for my English. Thanks for reading this question.


texts: Can I have separate playlist for each node?

texts:
I have this problem:
I have a nodetype Audiobook.
In this page I set title, ahthor, description and other informations.
I want to insert episodes of this audiobook in a playlist that user can display on audiobook page.
When user clicks on an episode, it plays automatically.
I'm trying to use mediafront, but I must create a view for each list, it's tedious.
I tried to use nodehierarchy, by creating a content tuype "episode", but, when I click on one it opens a page and I can't switch to next easily.
Any idea? I searched the internet, but there's doesn't seem to be no module.


texts: How to create menu and submenu using taxonomy collection in drupal commerce kickstart?

texts:
I am using Drupal Commerce Kickstart for ecoomerce site. I created menu using taxonomy collection. I want to create submenu also using taxonomy collection. Is it is possble? I want to menu like this Image.

I am creating taxonomy vocabulary as 'collection'.i created 'computers'. then i can add the products in computers. If i want to add the products in computers->printers. How can i create computers->printers using taxonmoy?


texts: Can I make Drush use a pattern to name sql-sync dump files?

texts:
I'm using Drush to sync up my dev, staging and live sites using rsync and sql-sync. I want sql-sync to create a dump file named using a pattern. For example, I want the dump file to be named site_database_name__date_time. Looking in example.drushrc.php I saw you can use @DATABASE and @DATE for the --result-file option in sql-dump. I tried using the same pattern in my site alias definition but it didn't quite work. The dump file is created properly, using the replacement pattern. But when it tries to restore the database to the target site it throws an error saying there's no such file as "@DATABASE_@DATE.sql". So it's not making the replacement when it does the restore phase of sql-sync. Is there a way to get this to work? Or am I taking the wrong approach here?

I realize the sql-sync documentation references a "temp" directory for these dump files, implying they aren't meant to be kept around. My thought is to keep them around for a record of what was used for each sync in case something goes wrong.

Below is an example of the site alias I'm using, which specifies the %dump path alias used by sql-sync.

$aliases['dev'] = array(
  'uri' => 'dev.example.com',
  'root' => '/home/websites/dev.example.com',
  'path-aliases' => array(
    '%files' => 'sites/files',
    '%dump' => '/home/username/tmp/drush/@DATABASE_@DATE',
  ),
  'command-specific' => array (
    'sql-sync' => array (
      'simulate' => '1',
      'structure-tables' => array(
        'custom' => array('cache', 'cache_filter', 'cache_menu',
          'cache_page', 'history', 'sessions', 'watchdog'),
      ),
    ),
  ),
);


texts:
I'm newbie and made web form to fill with some values.
I want to sum all values on Column to make it has a total of column Value, like in excel to do sum of several values into one grand total.

Anyone experienced this ?

Thanks in advanced.


texts: My client requirement is to assign user points in decimal format. Later on when user wants to credit those points in dollar at that it might go in decimal again. I Installed User Point module in Drupal 7. When I was referring their api I came to know that they allow only integer points to add. I searched for the ways to make it compatible with Decimal or float. I found one suggestion saying like you can change their design of tables for that module. I would not prefer to do so. Is there any other alternate way to make this user points compatible with Decimal or Float point system. If you have any other suggestion then let me know.


texts: How to create a statistics dashboard of my users using Views?

texts:
I'm working on a Drupal website based on its users. They can login, pay their debts, set and update their personal and contact information, etc.

I would like to create a Dashboard showing statistics of these users, based on my user's fields, something like:

GENDER: Male 54% - 46% Female
ACTIVE USERS: 67%
AGES: 20% KIDS - 56% Young - 16% Old - 8% Other

I even have a design for it, I´m just trying to figure it out technically using the Views module. Any idea?