texts: Can I create a custom interface to power views search?

texts:
My content is well structured from an internal point of view, but I want to provide a more customer-focussed front-end to an advanced search form.

e.g. I want to offer a list of check boxes like

Show:
[ ] All
[X] Articles
[X] Yellow things
[ ] Super cheap things

I would then intercept this data and mangle it, so for example Article might become a parameter to node_type but Yellow things might be changed into node_type = things AND field_colour = 'yellow' while Super cheap things might be a different thing again.

i.e. I'd like to have a parameterised view set up but use my own customer-focussed forms, rather than use Views' own data-focussed exposed forms.

Is this straight forward?

(More info: I'm on Drupal 7.x. I'm very comfortable with PHP and SQL but I'm keen to do things the Drupal Way unless it's ridiculously inefficient)


texts:
In the weather module, if a user has not configured a custom weather block, the block does not display:

/**
 * Implement hook_block_view().
 */
function weather_block_view($delta = '') {
  global $user;
  module_load_include('inc', 'weather', 'weather.common');
  $block = array();
  // Handle the 'system_NUMBER' type of blocks
  if (strpos($delta, '_') === FALSE) {
    $display_type = $delta;
  }
  else {
    list($display_type, $display_number) = explode('_', $delta);
  }
  $forecast_days = (int) variable_get('weather_forecast_days', '2');
  switch ($display_type) {
    case 'user':
      if (weather_access_userblock()) {
        // Show the user's custom weather block, if there is already
        // a place configured. Otherwise, do not show the block.
        $places = weather_get_places_in_use('user', $user->uid);
        if (!$places) {
          return;
        }
        ...
        [from weather.module]

Is there a way of displaying a 'Please set your weather location' link, instead of nothing at all, without applying a patch to the module?

Thanks.


texts: Add HTML Chars To Breadcrumb Kickstart 2

texts:
How does one enable html special chars (eg. ® ) in the breadcrumb?

Apparently, the Kickstart 2 uses a custom Crumbs module and I can't figure out how to override the PHP generated as with a 'regular' Drupal theme since it doesn't use the core theme_breadcrumb() function.


texts:
We have an Ubercart website that handles large volumes of orders daily, processes them and runs other tasks like billing, delivery routing, and future order creation.

Some of these tasks are heavy and sometimes cause PHP to timeout. Is there a better way to run these tasks like through Drush or Batch API?

Speed is not necessarily a priority (although nice), but we want to avoid timeouts, which can sometimes cause issues with billing correctly and scheduling daily orders.

Is Drush script the better option, or Batch API? Are there any tutorials to make better use of both?


texts: Is there a way to get a fully themed node given the node id or path alias so that I can render it via AJAX / AHAH?


texts: How to create specific role permissions for authenticated users in Drupal 7

texts:
I'm developing a Drupal 7 based site. As an administrator of a site I want to add some specific access permissions for authenticated users.
By default in Drupal authenticated users can read the content. And they can view the author of content. I want to disable the feature of viewing the author, but only for concrete contents.
When an authenticated user creates content, I want to make him able to choose "creating a content as anonymous author", i.e. other users can read and comment that content, but unable to see it's author.
And additionally this feature shouldn't affect quantity of content posted by that user. When the user creates content it will be incremented in "Number of content created by this user", whether content was created as "anonymous author" or not.
I've looked up in "People > permissions" , but couldn't find a permission like that. I know a little PHP, so if the answer requires a knowledge of PHP, go ahead.


texts: Clicking any hash/"#" link, even in Seven themed edit page tabs, scrolls to top of page?

texts:
I have a custom themed Drupal 7 site here. If you click on the left or right arrows in the top slide show or bottom "logo parade", the browser will scroll to that hash tag (undesired). Also, when logged in and looking at an edit page (uses Seven admin theme, not custom theme), clicking on a vertical tab e.g. "Menu settings" will scroll to the top of the page. This is disorienting and disruptive!

What's most troubling is that I can't reproduce this issue on the local test version of the site. The home page slide show and logo parade cause no scrolling when clicking around. The edit pages are a dream without unwanted scrolling...

FireBug isn't reporting anything odd. I'm not seeing noticeable differences between the live and local sites. Another Drupal 7 site I have on the same production server is not having this issue. It works great locally. I'm stumped.

This might be unrelated (maybe a related clue!), but for this site specifically I'm also having some odd ajax issues when editing views via Seven theme (and it's working great on my local version). When attempting to add a field to any view I'm getting this message, followed by the overlay instead loading as its own page:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /admin/structure/views/ajax/add-item/articles/block/field
StatusText:
ResponseText:
ReadyState: 4

Any thoughts on where I should start to troubleshoot this issue? I truly appreciate the assist in advance! :D


texts: Given a File ID (fid) how can I get the HTML that represents that fid?

texts:
I'm looking to do something like this

$fid = 15;
$file = (array)file_load($fid);
$content = drupal_render($file);
echo $content;

file_load()
drupal_render()

And specifically this fid is from the 7.x-2.x version of the media module.


texts: Show a block within node content (field template) based on context/taxonomy?

texts:
I've created a block using Views that I want to display only on nodes that have a specified value for a taxonomy field (no taxonomy info in the URL). The catch is that I want to display it within the main content (between certain fields), not above or below the main content. I've tried doing this in various ways, but none of my attempts have quite gotten what I needed.

Using one method, I managed to use pre-processing functions and the specific field template for the field (field--body--story.tpl.php) to get the block to show up in right place, but it showed for all the nodes of that content type. I tried evaluating for other fields' values within mytheme_preprocess_field, but those field values don't seem to be available within that function? (They don't show at all using dsm($vars) on the page, I think because the display of that field is hidden.)

Using another method, I used the Context module to get the block to show up only on the nodes of that content type that had that field set to the desired value, but then I could only get it to show above or below the main content, not between specified fields within the main content.

I'm new to Drupal (but am otherwise an experienced web developer), so I'm probably over-complicating this and/or not understanding some major concept. I'm sure there is an elegant way to do this, but I just can't get it (at all, much less elegantly). What am I missing?


texts:
I'm running Drupal 7.12. I have a requirement to index files attached to nodes. (DOC, PDF, XLS, etc).

After quite a bit of trail and error, reading and searching I have been unable to get any of the attachment file indexing modules to work.

Search API Attachments  seems the most promising but after configuring it doesn't seem to index any of the documents. It does call Tika to process attachments to new nodes, but doesn't seem to re-index any existing nodes. Searching on any file contents yields no results.

Any thoughts on what I should investigate to track this down would be greatly appreciated. Anyone running this module successfully? If so how did you configure it.

More info:

I followed these instructions: http://permalink.gmane.org/gmane.comp.php.drupal.support/22390

To see if I can track this down:

I configured a fresh installation of Drupal 7.12.
I installed Search API, Search API DB and Search API Attachments

projects/search_api_db-7.x-1.x-dev.tar.gz
projects/search_api_attachments-7.x-1.2.tar.gz
projects/search_api-7.x-1.0.tar.gz

I installed Tika and verified that it is working per instructions.
I created a field called Attachment1 of type File for the "Article" content type: structure -> content types -> article. label: Attachment1 name: field_attachment1, field: File.
I created a search server in Configuration -> Search and metadata -> search api using the database service class.
I then edited the Default Node Index to use the search server I defined and enabled it.
I then went to the Default Node Index fields and using "Add Related Fields" added Attachment1 » The file.
I checked the box next to Attachment1 >> The file and Attachment content: field_attachment1
I created a single Article and attached a word document to it.
I ran the cron service from the admin menu.
In the database I ran select * from search_index and I notice that only the terms from the node content are present, nothing from the document that I uploaded.
I verified that Tika was being called by adding the syslog call prior to shell_exec which yields:

  Mar 17 13:32:06 xeon httpd: Calling Tika: java -Dfile.encoding=UTF8 -cp '/usr/local/tika' -jar '/usr/local/tika/tika-app-1.0.jar' -t 'http:///drupal/sites/default/files/Resume_0.doc'

However, if I select to re-index the site by going to Configuration -> Search and metadata -> search settings -> clear index and re-run cron I notice that Tika is NOT being called.

Also I notice that selecting clear index does not affect the search_index table. (Should it?)

I have separately verified that Tika is properly extracting the text from the document by logging it to a file prior to the call.

My feeling is that I'm missing something obvious.


texts: How to make steps optional in multistep form

texts:
I want to skip some steps in multistep page break forms.

Let's say a user filled the first step then at the end there will be message.

Do you like to go to part 2 of the form or submit the form now?

Yes / No

If they choose Yes it should submit the form without going to next page break. If they select No then it will submit the form without next step and shows thank you message.


texts: Apache SOLR index or retrieve the node a file is attached to

texts: I'm building a search engine with Apache SOLR (8.7.0) where PDF files are indexed and searched through, that part is working (with search_api_attachments in case you're wondering). However, the client wants to show a link to the node where this file was referenced from. This is using plain file fields, no media library. Is there a way to either index the node ID with the file, or get this reference somehow in the view with a relationship or something? Spent a good day on it but couldn't figure it out, maybe I'm just overlooking it. Or is this something that would require me writing a custom hook to add the field to the index? (it seems like quite a general use case to me though)


texts: Call to undefined function making site unavailable

texts:
After making a Backup/Migrate copy of source site files, the very source site for unknown reason broke down with this error:

  Fatal error: Call to undefined function link_field_property_info_callback() in /sites/all/modules/entity/modules/field.info.inc on line 30

Most probably it comes from references to the Link module.
I have googled around, but the solutions good for others are not for me, as I cannot access admin to un-install the module. Is there anything I could do here without Drush?

I really do not quite understand the origin of that situation, but I would more like to focus on resolving the effect.


texts:
I'm trying to get data out of an .NET Web API into drupal in code. Everyting is working when the Web API is not secured/authenticated using the code below.

$request = drupal_http_request('http://10.129.132.253/StappAncor/api/person/1');
$items = drupal_json_decode($request->data);
dpm($items);

But when I publish the Web API onto my live server (behind authentication and https), I can't use the default drupal function drupal_http_request because it only supports basic authentication.

Any suggestions? Are the other WebClients I can use?


texts: Move $title variable to region--content.tpl.php

texts:
I'm having a bit of trouble sorting something out. I'm trying to move the $title variable to region--content.tpl.php.

I think a preprocess function - some variation of template_preprocess_region is what I need and then set the variables, but I haven't been able to sort it out or find examples.

Any guidance will be much appreciated.


texts:
I try to display a list of content with exposed filter in Drupal 7 and Views 3, I create a page and it works, but I also want to display a map with the filter, so I create a block for the gmap and for get the information about the filter I add a contextual filter with php code like this (where province is the name of the field)

return $_GET["province"];

In Drupal 6 it works this method, but in Drupal 7 I receive this error

  Notice: Undefined index: province in eval() (line 1 of /pathtomodule/views/plugins/views_plugin_argument_default_php.inc(49) : eval()'d code).

So where is the error, I return only one argument (I know that I need some control if the code is null, but in this case I )


texts: Display author profile fields in nodes created by that user

texts:
I have a user profile with extra fields like company address and company name etc.

I also have a content type job where i'd like to use the author's profile info (company name, address) in the content created by that author.

How do I use fields from the author profile in my nodes created via the job content type?

Is there something like a token field that I can use in my content type to display profile fields?

I know in views there's an option to use relationships, but I'd like to not use views for this if possible.


texts:
Has anyone gotten the Quicktabs module to work on mouseover/hover instead of click?
There was a patch for version 6.x-2 that does not work with the current version.


texts: How to get fields definitions of a vocabulary in drupal 8/9?

texts:
I needed the field list related a vocabulary item.I was able to list the fields related to a content type by using like this:
\Drupal::entityManager()->getFieldDefinitions('node', 'article');

But I can't find a way for the vocabulary items.


texts: Best way to set up attributes/variations

texts:
This is probably an embarrassingly basic question, but I haven't been able to find a definitive answer after a fair bit of searching.
If you're setting up a store with Drupal Commerce (2.x, in Drupal 8), and each of your products come in a variety of colours, but the range of colours is different for each product - should Colour be a single attribute, added to a single product variation type, and then assigned to a single product type (assuming no other significant variations in product structure)?
Or should each specific set of colours be a different attribute and/or a different product variation type, which I suppose would mean each individual product would need a unique product type?
To clarify, we're talking several dozen products, each of which might come in anywhere from 10-30 unique colours that are only used for that one product, so the total possible number of colours would be well into the hundreds, if that makes a difference.
I'd like to set this up in the most efficient and user-friendly way possible, since the staff who will be maintaining the site and adding items in the future may not be very technical... So the less configuration they have to do for new products, the better. But on the other hand, having hundreds or thousands of colours showing up in a single dropdown when they're trying to create product variations might be overwhelming.


texts:
The registration of my website works by user email verification.

How can I change a waiting time of new user activation? I have many spam users that register at my website; they register and never activate the account.


texts: Performance for file serving and storage

texts:
I intend to allow users to upload images to my website, but I'm concerned that Drupal's default handling of files might not be cut out for storing and serving potentially thousands of files without bogging down. Should all files be stored in the same directory? Should I use something like amazon instead of the same server the website is stored on?

What are the best practices for serving images, potentially thousands or tens of thousands, through a Drupal 7 site? Is it reasonable to expect Drupal to perform well if I just leave it the file handling as is?


texts: getting error while showing a user online or offline

texts:
While setting a user online or offline status with the Views module, I get this error message:

  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) < 30, 1, 0) AS users_node_is_online, 1 AS expression FROM node node LEFT JOI' at line 1

How do I fix it?


texts:
I have installed the apachesolr module and it all works fine.
To display more details about results, Ivs decided to add indexes.

But Im stucked, because the
hook_apachesolr_index_document_build(ApacheSolrDocument $document, $entity, $entity_type, $env_id) is not called.

Im using the last version of both solr and Drupal module.


texts: Can I attach a jquery.ui.datepicker widget to a form element using the form api?

texts:
I have a generic form element:

$form['date'] = array(
    '#type' => 'textfield',
    '#title' => t( 'Date' ),
);

That I want to add the jquery ui datepicker to this element. Is there a way to do this through the form api, or do I have to add the following using drupal_add_js:

$('#edit-date').datepicker();

Or is there another, even better way?


texts: populating a webform select list from a view?

texts:
I have a webform in D7 where I want the user to select a value from a dropdown list. These values I want to be dynamically updated from a view. How can I do this?

I found the webform viewreference module, but it's D6. There is a d7 port that someone made using coder, but, like author notes, I get an error when I try to view the form with the view reference webform component.

Are there any solutions out there?


texts: How to hide Article Fields which are displaying on the front end

texts:
Please help me, i just started learning drupal and implementing it.

I have a problem in hiding fields which are displaying in article pages.

Please check this page . "Body" field is displaying in all Articles. Please help me.

Please find the attached screen shot for reference.


texts:
I created a view that displays my user profile picture.  I created a template for this view using 'views-view-fields--name.tpl.php.  This is the output I get.

What I want to do is add a link to my image, like so:

 ......

But it keeps adding that line to just before the "user-picture" div, and I want it after it.  Is there any way to achieve this? Custom templates seems to not do the trick.


texts: Is there a way to expose the pager fields?

texts:
I'd like to let the user pick how many items are gonna be displayed on the page. Therefore, I need to display a field with a select or something.

Is there a way to make that directly through the UI, not with coding?


texts: Is there a way to create a report view of all links ( tag) contained within all published content?

texts:
Is there a way to create a report view of links contained within all Page nodes of my Drupal site? We want a list of all hard-coded URLs (href="https://example.com/example/example") but don't care about links that reference other nodes (i.e. href="/node/12345").
I already know how to create a view, but I'm having difficulty understanding how to scrape each individual <a/> tag within a rich text field (ex. Content:Body) and then outputting those links into a table View.
Drupal 8


texts: Remove child elements from Taxonomy List Exposed Filters

texts:
I have a view with (Taxonomy Reference Field) as Exposed Filter, The vocabulary contain parent terms and some child terms, I want to see the first level terms only and remove any children if any.

Currently It look like this

I want to remove the Keyboard Type 1, Type 2 and so on.

I was thinking of using a hook_form_alter, but not sure about the exact usage to remove any child term.


texts: how to assign different Text formats for each Long Text fields?

texts:
In my node creating form i have two Long Text fields, they are:

Article
Lists

And i have created two Text Formats they are:

Article
Lists

Now, is there any Drupal way to assign:

Article (field_article) field with Article Text Format
Lists (field_lists) field with Lists Text Format

If not, then how i can do it Programmatically in node node--article.tpl.php? or any other idea?
- Thanks


texts: How to add Profile2 form to ctools multistep wizard

texts:
I've been basing this off of Grashmash's article over building a multistep registration with Ctools, and I can't seem to get the Profile2 form in. I don't want to use the Field Group multistep option as I need to add additional forms to the wizard, but I'd like to get past this first.

I can successfully get past the initial account creation, but then the profile doesn't show up. Any ideas?

    $form_info = array(
    // Specify unique form id for this form.
    'id' => 'multistep_registration',
    //Specify the path for this form. It is important to include space for the $step argument to be passed.
    'path' => "user/register/%step",
    // Show breadcrumb trail.
    'show trail' => TRUE,
    'show back' => FALSE,
    'show return' => FALSE,
    // Callback to use when the 'next' button is clicked.
    'next callback' => 'kidb_register_subtask_next',
    // Callback to use when entire form is completed.
    'finish callback' => 'kidb_register_subtask_finish',
    // Callback to use when user clicks final submit button.
    'return callback' => 'kidb_register_subtask_finish',
    // Callback to use when user cancels wizard.
    'cancel callback' => 'kidb_register_subtask_cancel',
    // Specify the order that the child forms will appear in, as well as their page titles.
    'order' => array(
        'register' => t('Register'),
        'profile' => t('Complete Profile'),
        ),
    // Define the child forms. Be sure to use the same keys here that were user in the 'order' section of this array.
    'forms' => array(
        'register' => array(
            'form id' => 'user_register_form'
            ),
        'profile' => array(
            'form id' => 'profile2_edit_main_profile_form',
            // Be sure to load the required include file if the form callback is not defined in the .module file.
        ),
    ),
);


texts:
I am developing a site which has many advertisers. The idea is to have a specific advertiser emailed when a user shows interest in their product.

To do that, I need to create one webform which will change the recievers address dynamically depending on the advertiser who posted the product of interest.

It sounds like a custom module solution but I need the opinion of those who know better than I do.

Thanks


texts: How can I specify the URL alias when importing nodes into Drupal 7 (with the Feeds module)?

texts:
I'm importing a site into Drupal 7, using the Feeds module.  I don't see any way to specify the URL alias for each node (which I want to control on most every page).  How can I do this?  (If the Feeds module cannot do it, is there a way to do it in bulk after the import?)

Update: in case it's not clear, I want to have a column in my CSV that lists the URL alias that I want for a particular node.  I don't want the URL automatically generated.  I want completely control over the URLs, without having to manually specify them in the Drupal admin UI.


texts:
I created a custom view field with the hook _views_data and a custom Class who extends FieldPluginBase.

With the render method, I can return a sample string :

class MyCustomClassViewsField extends FieldPluginBase {
...
    public function render(ResultRow $values) {
      $node = $values->_entity;
      return $node->id(); // My view field shows the nid of the current node
    }
...

Now, I want shows a link with my field. I tried :

class MyCustomClassViewsField extends FieldPluginBase {
...
    public function render(ResultRow $values) {
      $node = $values->_entity;
      return "custom link"
    }
...

But my field in my view shows :

custom link

and not

custom link

How can I show the link as an html element, not a sample text ?

Thank you =)

UP

This code work :

return array('#markup' => \Drupal::l("test",\Drupal\Core\Url::fromUri("http://www.example.com")));

ut the l() function is deprecated. If I use Link::fromTextAndUrl instead :

return array('#markup' => \Drupal\Core\Link::fromTextAndUrl("test",\Drupal\Core\Url::fromUri("http://www.example.com")));

I get the error :

  [Sun Sep 18 22:17:59.444188 2016] [:error] [pid 2143] [client
  192.168.1.48:53322] Recoverable fatal error: Object of class Drupal\Core\Link could not be converted to string in
  /var/www/xxxxx/core/lib/Drupal/Component/Utility/Xss.php
  on line 67, referer:
  https://192.168.1.45/admin/structure/views/view/customview

  [Sun Sep 18 22:17:59.446098 2016] [:error] [pid 2143] [client
  192.168.1.48:53322] PHP Fatal error:  Uncaught Error: Call to a member function get() on null in
  /var/www/xxxxx/core/lib/Drupal/Core/Session/SessionHandler.php:76\nStack
  trace:\n#0
  /var/www/xxxxx/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php(89):
  Drupal\Core\Session\SessionHandler->write('BTaHaVF0t-bMk2Z...',
  '_sf2_attributes...')\n#1
  /var/www/xxxxx/core/lib/Drupal/Core/Session/WriteSafeSessionHandler.php(75):
  Symfony\Component\HttpFoundation\Session\Storage\Handler\WriteCheckSessionHandler->write('BTaHaVF0t-bMk2Z...',
  '_sf2_attributes...')\n#2
  /var/www/xxxxx/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php(77):
  Drupal\Core\Session\WriteSafeSessionHandler->write('BTaHaVF0t-bMk2Z...',
  '_sf2_attributes...')\n#3 [internal function]:
  Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->write('BTaHaVF0t-bMk2Z...',
  '_sf2_attributes...')\n#4 [internal function]:
  session_write_close()\n#5 {main}\n  thrown in
  /var/www/xxxxx/core/lib/Drupal/Core/Session/SessionHandler.php
  on line 76, referer:
  https://1xxxxx/admin/structure/views/view/customview

How can I replace the l deprecated function ?


texts: Adding translation capability to Hierarchical Select

texts:
I am trying to translate the taxonomy terms loaded by Hierarchical Select. I have the i18n module installed and I have set the taxonomy vocabulary to  localize translate, but nothing happens.

Can anyone see what I am doing wrong?


texts: Reference a block plugin, or Form, from a Paragraph?

texts: Is there a way for a Paragraph to reference either a custom Form (built with Form API) or a block plugin that renders the same form? I only see a way to have a field that references either custom blocks (content) or configuration blocks, but not both. How can this scenario be solved?


texts:
I am trying to code as follows:

  $uri='public://admin/myfile.txt';

but if (file_exists($uri)) fails

the complete path

  $uri='/var/www/html/www.mydomain.com/sites/default/files/admin/myfile.txt';

works and passes (file_exists($uri))

drupal_realpath('public://') returns /var/www/html/www.mydomain.com/sites/default/files

What am I missing here?


texts: I am using Bootstrap theme, attempting to build a basic skeleton site that will use Nice Menus dropdown. Cannot get it to work: if putting in a block it displays alongside main menu, if disabling block and enabling Nice Menu 1 in Structure -> Blocks it does not behave correctly, no dropdown on hover


texts: Losing custom #theme settings set in hook_field_widget_form after an error

texts:
I have defined a custom field in a custom module.  The new field applies a custom font to the options, and I have run into an issue with the widget form after an error. I have implemented hook_field_widget_form in a manner similar to the following:

mymodule_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  switch ($instance['widget']['type']) {
    case 'mymodule_custom_widget':
      $element += array(
        '#theme' => 'mymodule_checkboxes',
      );
      break;
  }
  return $element;
}

mymodule_checkboxes and mymodule_checkbox have been defined in hook_theme as follows

function mymodule_theme() {
  return array(
    'mymodule_checkboxes' => array('render element' => 'element'),

    'mymodule_checkbox' => array(
      'template' => 'mymodule_checkbox',
      'pattern' => 'mymodule_checkbox__',
      'arguments' => array('element' => NULL),
    ),
  );
}

To put it shortly, theme_mymodule_checkboxes calls theme(array('mymodule_checkbox'), array('element' => $current_element)); on every element in the #options array.

Everything is working great on the initial load of the form, the theme_mymodule_checkboxes function is called and the options are output using my custom template (the template isnt really necessary, I plan on replacing it with a theme function but havent gotten around to it. I don't think that particular oversite has any bearing on this issue but I may be wrong).  After I submit the form with an error - say I don't input a title or some such - the field is rendered using the default checkboxes theme.

Is there some hook I am missing in which I can define the default theme for the form widget before hook_field_widget_form?  One that hopefully fires even after a form fails validation?  I think I might be able to require a form rebuild in my custom field validation, but that forces extra work, and I would like to avoid that.


texts: How to allow view mode selection during content creation?

texts:
We have a content type, basic page, that can be of three types

Publication
Webcast
Audio/Video

There is a field that based on the Basic Page type, we switch the fields that are displayed. So for when type="Audio/Video", then we display fields A-C, but if type="webcast", then we display fields D-G on the node edit page.

Based on the basic page type, the node view should display as per the type. We were thinking of using Display Suite to help control the output/rendering of the fields and have three different view modes that are consistent with the three types.

Then based on the view mode, the different fields are shown on the node/edit page and on the node/view page, then the appropriate display is used.

We are having trouble presenting the content authors the ability to change the view modes. How would we allow for the choice of view modes during the node creation process?


texts: Search API Attachments Facet returning part words

texts:
I’m using these modules for the search :  Search API attachments; Search API Attachments Field Collections; Solr search; Search Facets

One of the Fields I’m searching is from attachments and I’m using type ‘Fulltext’ .

Then when setting up a Facet for this field it return a whole heap of the most common keywords.  The only problem being that in some cases it's returning part words.  For example in the attachments the words 'manage' 'management' 'manager' would exist, and the Facet is returning 'manag' as my keyword.  Has anyone else come across this; and do you know how I can make it so that only whole words are returned.

Thanks


texts: How can I show parent and child terms in facet search filter block for a taxonomy field having simple hierarchial select as widget type

texts:
I am using facet filter to filter views values . I have a taxonomy term using widget type [Simple Hierarchial Select][1]  . I want to be able to filter parent and child terms both in facet filter block

Tax A
-- Tax A child
---- Tax A child of child

I want to use each one of the above as a filter in the facet filter block

How Can I achieve it?

I have ticked 'index hierarchy ' but it just shows the deepest term e.g. "Tax A child of child"

http://example.com/admin/config/search/search_api/index/*server name*/workflow


texts: Drupal 7 Commerce Price field not available to views

texts:
I am using Drupal 7.14, Commerce 7.x 1.3 and Views 7.x 3.3
I have created several products and also the corresponding content. Fields in the product type are the default fields - Product SKU, Title, Price and Status. The content type upon which the related content is based contains some extra fields - image, product reference, author and type.
The products display singly perfectly with all the fields (image, Body, price, author, add to cart button and type).
If I create a view to display this content the available fields do not contain the price field. All the others, however, display correctly.
Why is the price field missing?
Would be most grateful for anyone's help.


texts: Redirect taxonomy term page links to a View page's exposed filter

texts:
I'm trying to make every taxonomy term page link direct to a pattern like this:

  /viewpage?[term:vocabulary][]=[[term:tid]]

So, for example instead of material/bronze where bronze has term id 7, you'd have:

  /viewpage?material[]=7

...and you'd go to a views page where the user could then turn off the materials filter and turn on other filters.

I've tried setting this pattern up using PathAuto at /admin/config/search/path/patterns, which does the opposite of what I want: while it does make links to a taxonomy page point to URLs that look like viewpage?material[]=7, it then intercepts these and sends them to the default taxonomy term page, breaking the exposed filters!

I've tried using Global Redirect, but it doesn't seem able to apply patterns, it seems I'd need to enter the redirects by hand which isn't sustainable.

Redirect Tokens module looks to be designed to do what I want, and even has an example very similar to my case but with users not taxonomy and facets not exposed filters, but on closer inspection a) it only accepts tokens in the "from" field not "to" and b) it only works with global tokens like current user.

I've figured out that it's potentially possible using cTools Page Manager:

Enable and edit the Taxonomy View page
Set it the HTTP Response Code variant
Select 301 redirect then input the new URL...

...but I'm not sure how to inject the [tid] into the new URL pattern. The help text says "You may use keyword substitutions from contexts" but there doesn't seem to be any way to view or edit contexts for a page override.

How can I bulk redirect all current and future URLs of taxonomy term pages to this exposed filter view?


texts: Javascript hotel price/availability calendar

texts:
I'm trying to create a Javascript calendar which will show the price and availability of hotel rooms by date. Similar to this example (see Availability tab), however mine needs to show prices and availability for three different room types on each date.

So far I've tried out the Availability Calendars and Rooms modules, but both would require significant work to adapt to my needs.

I've also been looking into using a straight-forward calendar module. First I tried Calendar, however this reloads the page when moving to the next/previous month which won't do. Then I tried Fullcalendar, but I can't figure out how to make multi-day items appear as separate daily items (they appear as one item spanning many days), and there's also a problem rendering the calendar on a quicktab (it only shows the next/previous buttons and not the calendar until you actually click next or previous).

So I'm looking for some ideas on how to proceed...

PS I'm using Drupal 7.15


texts:
Hi I wont to know about how can I use discount rate ?

$report_query = db_select('commerce_order','co');
$report_query->fields('co');
$report_query->orderBy('co.created','ASC');
$report_res = $report_query->execute();
while ($re = $report_res->fetchObject()) {
    $o_id = $re->order_id;
    $o_load = commerce_order_load($o_id);
    echo "<pre>";print_r($o_load);
}

Output:

[1] => Array(
[name] => tax|vat_cst
[price] => Array(
        [amount] => 27556
        [currency_code] => INR
        [data] => Array(
                [tax_rate] => Array(
                        [name] => vat_cst
                        [display_title] => VAT/CST
                        [description] => VAT
                        [rate] => 0.125 // here display tax rate
                        [type] => vat
                        [rules_component] => commerce_tax_rate_vat_cst
                        [default_rules_component] => 1
                        [price_component] => tax|vat_cst
                        [calculation_callback] => commerce_tax_rate_calculate
                        [module] => commerce_tax_ui
                        [title] => VAT/CST
                        [admin_list] => 1
                    )
            )
    )
[included] => 1
)

[2] => Array(
   [name] => discount-20% Off
   [price] => Array(
        [amount] => -49600
        [currency_code] => INR
        [data] => Array(
          [discount_name] => discount_full_discount_20_
          [discount_component_title] => 20% Off
        )
   )
   [included] => 1
)

In vat_cst the rate is 0.125 but,how can I know which rate is used on total order?


texts: How do I get Facebook latest uploaded images for an account?

texts:
I am new in Drupal, I want to get all the images from my Facebook account and want to display them into front end.

I tried Facebook Album Fetcher module but this module give me the facility to get images only for a particular album not for overall. I want to get and display only the latest uploaded images from my whole account (Images will be anywhere like profile images or timeline images or album images etc).

So can anyone please tell me, is there any module which can fill my above requirement? If not then how can i get all the latest uploaded images to display them into front end?

Please help.

Thanks in advance.


texts:
When I ran drush sql-dump --result-file, it came back with a warning and a success message.

system(): Cannot execute a blank command exec.inc:36                 [warning]
Database dump saved to                                               [success]
/my/homedir/drush-backups/unknown/20150113014628/_20150113_014628.sql

However, I checked inside the directory and no .sql backup file can be found. I have also read this issue, but I am not using drush aliases.

How can I fix this and backup my database using the command line?


texts:
I have made a form with form loop as I am setting the $form_state['number'] for the fields count.

I want to remove a full row after clicking on remove button in front of row by taking row_id. So I want to ask is there any way to pass id of row in submit function of remove button or check which button pressed and fetching id of that button in submit function.

 for ($i = 1; $i <= $form_state['number']; $i++) {
    $form['myform'][$i]['email'] = array(
        '#type' => 'textfield',
        '#size' => 18,
        '#autocomplete_path' => 'mypath',
        '#prefix' => '
',
    );
    $form['myform'][$i]['roles'] = array(
        '#type' => 'select',
        '#options' => array('' => '', 'master' => 'master', 'student' => 'student'),
    );
     $form['oldfeedbackmarkup'][$i]['remove'] = array(
       '#type' => 'submit',
       '#value' => t('Remove'),
       '#submit' => array('mysubmit_button'),
       '#ajax' => array(
              'wrapper' => 'myform_wrapper',
              'callback' => 'submit_by_ajax',
        ),
        '#prefix' => '
',
        '#suffix' => '

',
    );
}


texts: Drupal cache issue while we use same domain using different theme for mobile and desktop

texts:
I'm new to drupal and I have an issue with drupal7 caching system. I have enabled drupal cache and it will refresh the cache for every 1 hour. I have couple of themes for my site. One for normal desktop users and another one for mobile users. Now the problem is once I open the site from mobile for the next 1hour the mobile theme is caught by drupal cache and the same is sent to desktop request also. Even though I open the site from desktop it self I can view the pages of mobile theme only. After clearing cache manually or after 1 hour I can view the desktop theme.

Note: I'm using mobile_switch for theme switching.


texts: How to display a set of custom contents in Taxonomy URL?

texts:
I am working with Drupal Commerce using core Drupal 8 and the type of data I am using is Product. When I tag a product with a taxonomy term and visit page for that taxonomy term, I don't see anything. On the other hand, when I tag article with a taxonomy term, I can see all the articles tagged when I visit page for that tag. What influences behavior of taxonomy term and how can I manipulate it to display products?

I believe that it only works with a content type and product is not a content type. In older version of Drupal Commerce there was a product display content type which had Product as reference. That is no longer the case, now product can't be used as reference.

Edit: Product can still be used as reference. You can use it as reference to create something similar to  Product Display in older version of Drupal Commerce Kickstart


texts: No reply from rest service after creating two nodes

texts:
I had to fill a website with 12000 nodes , so I wrote a c# application which sends nodes (encoded in JSON format) from my local computer to website.

using services module proper resources are implemented.

now the problem is :

  after posting 2-3 nodes , REST service stops responding to my
  application

I thought that might be caused by some limitation in REST service provided by Services Module.

Any idea how to deal with this problem? or any suggestion how to import these models to my website as a node?


texts:
How can I remove the some links from the Tab, when we are login as a particular user. Please see the below picture. I want to remove the tab Items maked in red rectangle (deny access to this link).

I tried with hook_menu_alter, but it do not worked and also understood, hook_menu_alter only hide the item in the tab.  Please give me a solution. I am using drupal 7 version

Please note:
I am using node gallery module to this content type to attach gallery with a node. I have added roles & assigned role to a particular user. Also give permission form that this content type in permission tab. The problem is that, when we logged as user, only the edit link is disappearing, not the gallery attached  with it. I want to set this in page wise. The same user want to edit the gallery in some page & also want to edit the node. I used simple access module, but no use. it only remove the edit of that page, not the gallery attached with it. I also tried hook_node_access(). For that also the same result.  Please give any solution.

Please see: node gallery permission is separate, which is not connected with a content type. I need to deny below url based on the roles.
1) node/#/items,
2) node/#/upload
3) node/#/sort


texts: How do you make a ctools modal resizable so scroll bars appear when the content overflows?

texts:
I'm using Color Box and CTools modules to create a modal with some content. When the window is extremely short the modal can't be big enough to accommodate the contents, and they are cut off. I would like the modal to use scroll bars when there is overflow (e.g. auto or scroll), but setting the "resizable" option to TRUE does nothing.

Is there another option I can set?


texts: I would like to create custom styling for the label in a field for a table in a view. Is this possible within the view edit page? Or will I have to define a custom CSS class and write the styling in the css pages included in the theme?


texts: Is the mail_logger module safe for production?

texts:
I'm having intermittent problems with emails that are silently failing on a production environment. I'm troubleshooting with the mail_logger module, and it would be extremely helpful on production.

However, for some reason I feel that this is a 'development/debugging' module and not something recommended for production. Are my fears unfounded?


texts:
I'm having trouble with changing the url of a drupal localisation. All urls are clean, but contain a non-clean localisation part; ?q="language", e.g. ?q=de, ?q=fr.
The site runs on nginx + mysql + php5.

I want to change this to either site.tld/"language"/page or to no url at all, e.g. site.tld/page.

How to change this in the rewrite rules?


texts: What is better for performance in views, using fields or a teaser view?  Assuming you would be adding all fields necessary for it to look just like the teaser.


texts: I need to prevent the translation of admin + toobar interface

texts: Hello I am using Internationalization module. I want to keep the admin and the toolbar in English despite the language variable, despite the node translation operation. Is it possible?


texts: What is the replacement for menu_link_load()?

texts: Drupal 7 has menu_link_load() to load a single menu item. What is the Drupal 8 equivalent?


texts:
Problem

The latest in my series of nginx problems.

I'm trying to get Perusio's nginx config working with AdvAgg. However I get an error, 404 requests are not getting through to AdvAgg. Basically nginx is intercepting them.

The solution other people have mentioned is to comment out the following line in the AdvAgg blocks however this has no effect.

try_files $uri @drupal;

How could i solve this? Here's hoping someone has come across it before.

Extra Thinking & Tests

First here's the full error, I left out the printout of the nginx 404 page.

AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory.
If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it.
If you are reading this, it means that something else is handling the 404 before AdvAgg can.

Raw request info:

    stdClass Object

       (
          [request] => GET /sites/default/files/advagg_css/css__1385728578.css HTTP/1.0
          User-Agent: Drupal (+http://drupal.org/)
          Host: 192.168.1.95

So the two relevants chunks are in the drupal.conf file. This is called from the website/server config file in sites-available.

Basically the following chunk is included in the server block:

location / {

....

  ## Advanced Aggregation module CSS
  ## support. http://drupal.org/project/advagg.
  location ^~ /sites/default/files/advagg_css/ {
      location ~* /sites/default/files/advagg_css/css_[[:alnum:]]+\.css$ {
          access_log off;
          add_header Pragma '';
          add_header Cache-Control 'public, max-age=946080000';
          add_header Accept-Ranges '';
          #try_files $uri @drupal;
      }
  }

  ## Advanced Aggregation module JS
  ## support. http://drupal.org/project/advagg.
  location ^~ /sites/default/files/advagg_js/ {
      location ~* /sites/default/files/advagg_js/js_[\w|-]+.js$ {
         access_log off;
         add_header Pragma '';
         add_header Cache-Control 'public, max-age=946080000';
         add_header Accept-Ranges '';
         #try_files $uri @drupal;
      }
  }

  ....
  try_files $uri @drupal;
}

Test 1: I know it's hitting the right place, because if I comment out the inside and put in deny all; then all the CSS disappears.

Test 2: The try_files $uri @drupal not inside the AdvAgg blocks is to enable Clean URL's. Unfortunately AdvAgg needs clean URL's so I can't test if that's what breaking it.

Here is a full pastebin of my drupal.conf and mysite conf from sites-available.


texts:
I set up a rule that blocks access to a specific piece of content. In fact, for simplicity's sake, I made a rule that blocks everything:

function namhost_node_access($node, $op, $account)
{
    return NODE_ACCESS_DENY;
}

The problem is, if I go to:

/node

And browse through all the content, I still see data that I deliberately blocked. Why are these showing? Is /node some kind of view with full access to anonymous users? Is my access rule not being enforced for some other reason? Am I not understanding what the point of /node is and if I just block that path will I be fine?

Also, are there any other ways that people can access content types I've blocked? It's making me worried that I am able to access content that has been deliberately blocked.


texts:
I've got physical products on my website (specifically vinyl records) that includes a digital download. I've so far used an external download-engine for this but would love to build it into Drupal for user integration reasons.

I want this simple solution. I print download vouchers and insert them in vinyl sleeves. A download voucher includes a 100% discount code valid for one SKU only (the digital version of the lp).

The commerce discount module generates a world of errors on the site, so would like to avoid using that till it's more mature.

Any other ways to achieve this?


texts: How to prevent email address from displaying on edit profile page?

texts:
I have set up my site so that some users with a specific role can't edit their email address. This works fine - users with role type A can navigate to the edit tab on their profile and edit their email address, and users with role type B are unable to edit their email address. However, these users can still view their email address field on the edit tab, it just appears disabled. I do not want this to be the case.

I used the User Protect and Field Permissions modules to achieve this. For all of the other fields that I prevented users with role type B from editing (e.g. their name), the fields did not appear at all on the edit tab. I have used the same settings in field permissions for these fields and the email field but for some reason the email field appears under the edit tab but the others don't. How can I prevent the email field from displaying when users don't have permission to edit it?


texts:
Third day I'm looking for a solution, but I can not find an answer.
I use Taxonomy term as a filter (Better Exposed Filters) on Views.
To Taxonomy term added a field image. How programmatically display the Image field before Taxonomy name in Better Exposed Filters?

I tried modules  taxonomy_icon, vocabulary image, taxonomy image
All of them do not provide an opportunity for filters Views to derive taxonomy terms in the form of "image taxonomy name".


texts: How to set available/unavailable dates in date webform component?

texts:
I have a webform with a date component.

Then the visitor is able to select a date in a popup calendar. So far so good.

I need to show available and unavailable dates in the calendar, then visitors only can select an available date. Look my capture:

I'm trying with the availability_calendars which is a great modules. But I have 2 problems with it:

1) it is a 2 steps process, you choose the date in the calendar and then you are directed to the webform to fill the rest of information (name, phone,...)

2) the calendar allows the visitor to select 2 dates: Arrival and Departure dates. I only need one date.

How can I accomplish this?


texts: Smart way to compare drupal instance files with official release to search for modified files

texts:
I was asked to update (just install new core and modules versions) a Drupal site that uses roughly 100 (yes: hundred) contributed modules. I suspect that some of these modules might have been modified, maybe including core.

I'm looking for a smart way that would allow me to utilize git (or some other tool) to automatically search for files that differ from the ones available in official release for specific module version (contributed or core).

I could use drush to dump installed modules names and versions or use some shell script to read that data from *.info files. Then I could use that to generate git commands. So in theory it is not that difficult. But that's just a theory :)

So any input on this would be helpful from people who did similar things. Any caveats? Maybe other approach or just some code examples?

Or maybe there is a Drupal module that can do this for me?


texts:
I am trying to add a link in views header. I enabled multilingual module. Added a Global Textarea in the header. Then added

Click

I want to set the url as

Click

So the link may be

Click

or

Click

SELECTED_LANGUAGE_CODE is the language selected in the url.

English version of my site is http://example.com/en
French version http://example.com/en


texts:
I'm new to Drupal (using Drupal 8) and have been struggling to get content from a block I've create to display when accessing the view.

I've created a "service" view (page) which lives at the path "/service". I've configured the view to display the desired fields from the "service" content type. The view uses a contextual filter on the title of the "service" content type which allows clean URLs to work "/service/name-of-service"

The above works well. I'm running into problems with an "info" view (block) that I've created. The "info" block pulls in different fields from the same "service" content type. I decided to use a block for the remaining fields as it allowed me to place them in a specific block region that works for our desired page layout.

I've tried setting up a contextual filter in the block to filter by "ID" and provided a default value of "Content ID from URL", but I can't get this to work, no fields display at all. If I flip the setting to "Display all results for the specified field", fields do display, however, the content of the fields displaying in the "info" block is not pulling from the same node (because there is no contextual filter).

Is there a way I can setup a contextual filter to accomplish this? I've been able to use the contextual filter by ID successfully when working with the node itself, but can't get the same behavior when using views.


texts: Save user selection after search in views

texts:
I am facing a problem with views. Is it possible somehow to save the user selection when a user is doing a search?

To get it clearer, I'm having a list of users. Let's say, I am searching for customer A via filters, then select the found customer, change my filter to find customer B and select him to. But every search, resets my selection. I'm looking for a possibility to save the selection and have A and B selected in the end.


texts: Taxonomy Term Reference Tree Widget with Other field

texts:
I am using Drupal 7 Taxonomy Term Reference Tree Widget my requirement is, user should be able to create new term while adding the content. Is it possible in this module? Any patch available?

Please help me.

Thanks,


texts:
I'm working on an old D7 site and have been asked to remove a Block from a particular page.

First thing I tried was to go to the page in question, click the gear icon next to the block and select Configure Block. I then added the page's alias to the list of excluded pages (ie: "All pages except those listed").

I saved, cleared cache, but this had no affect - the block remains on the page.

I then went to see if I could remove the Block from its region, so I went to admin/structure/block/ and found my Block - but the thing is it's unassigned. It's in the Disabled category.

Would anyone know what's going on here and how I can remove the block from just one given alias?


texts: How to make a popup on a node's content using the colorbox module?

texts:
In Drupal 7, all I had to do to add a popup with colorbox was add the CSS class colorbox to the link to create a nice popup.  Now, using Drupal 8, I cannot figure out how to do this.

I can add colorbox to my fields, but I want to add it directly to the link <a class="colorbox" href"".../a> in the content body, but it is not working.  I cannot figure out how to use inline colorbox either, if that is the solution.

How can I add the popup?


texts: How to perform a Database API Inner query

texts:
I have this Database API code, and I'm trying to add a sub-query to it:

$query = db_select('' . $base_table . '', 'n')
      ->extend('PagerDefault');
      ->extend('TableSort');

to turn this:

SELECT
FROM
taxonomy_term_data n
ORDER BY n.tid ASC

Into this:

SELECT
FROM
(SELECT * taxonomy_term_data LIMIT 10) n
ORDER BY n.tid ASC

I've tried passing a db_select statement into another db_select statement. I've tried query->addExpression() and db_query() to no avail.


texts: I am trying to pull ldap server information from the ldap_servers table in drupal

texts:
I have a user search module in drupal that creates contact cards base on LDAP user information.  Everything works fine, I just need to make it more flexible, so that if the same module is used in a different drupal install, it can just set the same ldap server that is set in drupal.  Currently it is hard-coded.

first, I tried using this to get the server info:

  $ldapServer = db_query("SELECT address FROM ldap_servers WHERE `binddn` = 'cn=Directory Manager'");
  print_r( $ldapServer);

This is what the query returned:

  DatabaseStatementBase Object ( [dbh] => DatabaseConnection_mysql
  Object ( [needsCleanup:protected] => [target:protected] => default
  [key:protected] => default [logger:protected] =>
  [transactionLayers:protected] => Array ( ) [driverClasses:protected]
  => Array ( [MergeQuery] => MergeQuery [SelectQuery] => SelectQuery [UpdateQuery] => UpdateQuery [InsertQuery] => InsertQuery_mysql )
  [statementClass:protected] => DatabaseStatementBase
  [transactionSupport:protected] => 1
  [transactionalDDLSupport:protected] => [temporaryNameIndex:protected]
  => 0 [connectionOptions:protected] => Array ( [database] => tlsconnectapp [username] => drupal [password] => drupal [host] =>
  localhost [port] => [driver] => mysql [prefix] => Array ( [default] =>
  ) ) [schema:protected] => [prefixes:protected] => Array ( [default] =>
  ) [prefixSearch:protected] => Array ( [0] => { [1] => } )
  [prefixReplace:protected] => Array ( [0] => [1] => ) ) [queryString]
  => SELECT address FROM ldap_servers WHERE binddn = 'cn=Directory Manager' )

I'm sure I did something wrong, but I'm not sure what this means, and the server isn't in there.


texts:
in drupal 6 I have an ajax view that I cache manually. The following is a block of the function that returns the markup of the view:

....

$cache_key = sprintf('user:products_listed:%s', $account->uid);

$products_listed = cache_get($cache_key);

if (! $products_listed) {
  $products_listed = views_embed_view('products_listed', 'default', $account->uid);
  cache_set($cache_key, $products_listed, 'cache', time() + 60 * 60);
} else {
  $products_listed = $products_listed->data;
}

return $products_listed;

The view always shows fine, but its ajax pager works fine only when the view shows for the first time (when it is not cached yet). As soon as the view is cached, that is, when I get its content from the cache, the pager doesn't work and it just reloads the page adding the "?page=1" in the URL.

How can I solve this problem?

Thanks in advance.


texts: How do you re-direct an alias at a scheduled time?

texts:
I am using Drupal 7(.40 or .41) and what I am trying to achieve is to completely change a pages content at a specific time & date (00:00:01 01/01/2016 to be specific)

Because the content changing is about 90% of the page, I presumed that I could set a node to unpublished at 23:59:59 with the alias and then publish the new node at 00:00:01 with the same alias. However it throws up an alias is in use error.

There is nothing obvious in my URL Alias config (/admin/config/search/path) that would indicate this is possible so I am probably looking at it the wrong way, short of using a different URL.

Thoughts and methods would be welcome.


texts: Bootstrap external login from subfolder isn't working

texts:
Consider the following script.

define('DRUPAL_ROOT', getcwd() . "/..");

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$username = "Silox";
$password = "hidden";

global $user;

$account = user_authenticate($username, $password);

// Woah, it seems like we don't know this user, let's create him!
if (!$account) {
    $userinfo = array(
        'name' => $username,
        'pass' => $password,
        'init' => $username,
        'status' => 1,
        'access' => REQUEST_TIME,
    );
    $account = user_save(drupal_anonymous_user(), $userinfo);
    $account = user_authenticate($username, $password);
}

$user = user_load($account, TRUE);
drupal_session_regenerate();
?>

This script logs me in or creates a new account when the username and password combination doesn't exist. When I put this script in the base directory of my Drupal installation, everything works perfectly fine.

However, when I put it in the root directory of the PhpBB subdirectory and change the DRUPAL_ROOT to getcwd() . "/.." to compensate for the extra folder, it doesn't work. If I print out my user array at the end of the function, I get a nice array with corresponding correct info but however, if I return to my Drupal site, I am not logged in.

How can this problem get solved?


texts: How can I make my menu children display horizontally below my main menu?

texts:
So the dark blue menu is the main menu, and the light blue lower menu is the children of Help. How can I set my menu up so that it functions like this mockup?

Also, I don't want this to be a dropdown menu. I want the children to stay open while you are on either the parent page or on one of the child pages.

UPDATE:
I set it up the way you suggested, but instead of displaying the children in the sub-menu, it displayed the main menu and made the Help link a dropdown. Here is a pic of what happened.


texts: I'm unable to access variables in template from preprocess function

texts:
I am using a preprocess function to get data from specific content types. I am able to print the data in the pre-process function but unable to view the same in the twig file.

This is the code I am using.

    function themename_preprocess_node__custom_content_type_name(&$variables) {
      $query = \Drupal::entityTypeManager()->getStorage('node')->getQuery();
      // Get all products node IDs.
      $nids = $query->condition('type', 'content_type_products')->execute();
      // Load all product nodes.
      $nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
      // Pass them to node--custom-content-type-name.html.twig.
      $variables['products'] = $nodes;
     //echo "<pre>";
     //print_r($variables['products']); exit;
    }

print_r($variables['products']) shows the content of $variables['products'], but the node--custom-content-type-name.html.twig file doesn't print anything for {{products}}.

Why?


texts: how to get the url to usefor a private path

texts:
if I have a file saved in private:://somefile.txt  , what function can I use in drupal to give me the external URL to access that?

I tried PrivateStream::getExternalUrl()
but I get this error

PHP Fatal error:  Call to undefined method Drupal\mymodule\myservice::getTarget() in /opt/DrupalSites/drupal-wcms-migration/docroot/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php on line 50


texts: I can translate a normal menu easily, but how do I translate an Organic Groups Menu?


texts: what is the use of form[#special] in a drupal form?

texts: Now i'm working with forms and trying to add template in to it, I have form['#special'], but i don't know how to set it and what's the use of that and its usage.


texts: How to output custom field of Content type in page.tpl.php?

texts:
I want to display a custom field which I created in my custom Drupal theme.

The field I created called "Startnummer" so the machine name of the field (I didn't change it) was created as "field_startnummer".

Furthermore, I found an article of that topic an the answer is to put the following line into my page.tpl.php:

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

Unfortunately, that doesn't work!

The next problem is, I do not know how other people would call that problem, so I can't find any solutions.

Any help?


texts:
I use Views Aggregator Plus to calculate sum of a column.

----------------------
Item         Data
----------------------
A              20
B              30
C              50
----------------------
                100
----------------------

Then I want to add additional column for percentage.

-----------------------------------------
Item         Data         Percentage
-----------------------------------------
A              20
B              30
C              50
-----------------------------------------
                100
----------------------

I know Global:Math expression. But I don't know how to get the sum, the sum field is not available. Only [value], [value_1] and [value_2] available for A, B and C respectively.

Is there a way to add a percentage column?


texts: Load all configuration that has a particular config dependency?

texts: I want to load all entity form display configuration that has a particular, DIRECT, config dependency. I feel like this is something that should be doable with an entity query but I haven't been able to figure it out. Any thoughts on how to go about this?


texts: Let users create content by using the default (non-admin) theme

texts:
sorry to ask a more conceptual question but I am really stuck.

I have a Drupal 7 site where users will sign in and then create a certain kind of content. I have the content set up ready to go.

Do I just let them have access to the /node/add/[content-type] page? If so, how can I theme this page so it has the headers / menus / footers of the rest of the website (and not the standard Drupal 'admin' view)?

I am able to add a custom node-form.tpl.php file but when I output the form using echo drupal_render_children($form); it still looks like the Drupal admin backend, and not a form that is consistent with the style of the rest of the website. I want it to look more like, say, a webform. Perhaps there a way to insert a node/add form into a panels page for example?

I feel like there is a "Drupal way" of doing it, it must be a fairly common use case but it seems my Google fu is failing me. Any help or advice appreciated.

TLDR; I want a node/add form to look like a standard website webform and not part of the Drupal admin/backend.

PS: I am using a custom theme and I am comfortable with custom modules.


texts: Show menu link descriptions for a custom navigation menu

texts:
I have the following navigation, displayed in page.tpl.php:

theme('links', array('links' => menu_navigation_links('menu-site-navigation')));

There are four navigation elements that show up. I would like to display the description that goes along with these elements as well, how do I go about that?

In my template.php file I have the following code, but I can't figure out how to only apply this change to menu-site-navigation

function MYTHEME_link($variables) {
   // if there is a description for the menu item, show it
  if(!empty($variables['options']['attributes']['title'])){
      return '' .
      ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) .
      '
' . $variables['options']['attributes']['title'].'
';
  }
  else{
    return '' .
    ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) .
    '';
  }

}


texts:
I have created a menu on my site and have used features to export it. The first 2 menu items are translating to different languages but the third is not.

The third word is Contact. I have gone to /admin/config/regional/translate/translate and searched for Contact. I get the following.

At the bottom of my features it has

  // Translatables
  // Included for use with string extractors like potx.
  t('Contact');

So we can see that is there OK.
When looking at my menu at /admin/structure/menu/manage/menu-example it is all in English. If I go to /fr/admin/structure/menu/manage/menu-example Contact remains in English and the other words change.

Contact is a mailto:link if that makes any difference.

  $menu_links['menu-teleplan_contact:mailto:a@a.com'] = array(
    'menu_name' => 'menu-example',
    'link_path' => 'mailto:a@a.com',
    'router_path' => '',
    'link_title' => 'Contact',
    'options' => array(
      'attributes' => array(
        'title' => '',
      ),
      'identifier' => 'menu-example_contact:mailto:a@a.com',
    ),
    'module' => 'menu',
    'hidden' => 0,
    'external' => 1,
    'has_children' => 0,
    'expanded' => 0,
    'weight' => -48,
    'customized' => 1,
  );

Why is the word in my menu not translating?


texts:
I'm curious if anyone has made attempts to "cache" the bootstrap process in Drupal.

Normally, Drupal will run the 7 bootstrap phases on each request, but perhaps on a deployed production system, one could "do away" with some or all of these?

Possible suggestions I have in mind could be

Serializing the bootstrapped state and sticking it into memcache
A script could generate a patch for bootstrap.inc that will hardcode certain information into the file.
I believe David Strauss has tried to keep a bootstrapped Drupal running on libevent.
Other craziness?

What attempts are there, and which are known to be (somewhat) reliable?


texts: Update conflicts with the Address module

texts:
I am trying to update Drupal 8.4 with the Drupal Commerce module version 2, but the Address module and Drupal conflict with each other.

I have tried using addressing ^1.0 but that is no help I think the dependencies have changed in Drupal Commerce and there is no new supporting documentation.

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

  Installation request for drupal/commerce ^2.0 -> satisfiable by drupal/commerce[2.0.0].
  drupal/commerce 2.0.0 requires drupal/entity ~1.0 -> satisfiable by drupal/entity[1.x-dev, 1.0.0-beta1, 1.0.0-alpha4, 1.0.0-alpha3, 1.0.0-alpha2, 1.0.0-alpha1] but these conflict with your requirements or minimum-stability.

  Problem 2

  drupal/address 1.0.0 requires commerceguys/addressing ~1.0 -> satisfiable by commerceguys/addressing[1.x-dev, v1.0.0-beta1, v1.0.0-beta2, v1.0.0-beta3] but these conflict with your requirements or minimum-stability.
  drupal/address 1.1.0 requires commerceguys/addressing ~1.0 -> satisfiable by commerceguys/addressing[1.x-dev, v1.0.0-beta1, v1.0.0-beta2, v1.0.0-beta3] but these conflict with your requirements or minimum-stability.
  drupal/address 1.2.0 requires commerceguys/addressing ~1.0 -> satisfiable by commerceguys/addressing[1.x-dev, v1.0.0-beta1, v1.0.0-beta2, v1.0.0-beta3] but these conflict with your requirements or minimum-stability.
  Installation request for drupal/address  ~1.0 -> satisfiable by drupal/address[1.2.0, 1.1.0, 1.0.0].


texts: Facet API pretty paths in combination with solr search form

texts:
I'm building a website with the panopoly distribution in Drupal 7. One of the client requests is a faceted search page combined with a search box to search on specific keywords and the possibility to sort on date and name.

To build this I used the following modules:

apachesolr
apachesolr_sorts
apachesolr_panels

After configuring everything I got this search page working (without clean url's)

http://i.imgur.com/mxDzhi4.png

To enable clean url's I used the following module:

facetapi_pretty_paths

Now the search box always uses the first argument in the url, after I enable the pretty paths module the first argument in the url is the active filter (taxonomy field name in combination with the taxonomy term name).

http://i.imgur.com/5x7Xyoa.png

What would be the best approach to use the search box in combination with the facets and pretty paths (and the sorting option)?


texts: How do I run cron as an authenticated user?

texts:
On my site, user profiles are not public; the anonymous user does not have permission to access them.  However, I want to send a view containing a list of member profiles in an email with Rules Scheduler.  I am attaching the view to the email with views_embed_view().  However, the view content is not displayed because Rules Scheduler use cron, which embeds the view as anonymous user.

So my first thought was to somehow run cron as an admininistrator, but the Drupal documentation states this:

  Running cron as an authenticated user (Drupal 6 and earlier only)

  If triggering cron.php via the methods above, cron tasks will run as
  the anonymous user. For most cases this should be fine, but if Drupal
  cron has been customized to include tasks that must run as a certain
  site user (e.g. custom logic has been implemented in hook_cron() that
  requires special user permissions), the following script may be
  useful. This script authenticates a user of your choosing before
  calling cron.php.

  Note that as of Drupal 7, cron always runs as an anonymous user, so
  this will not work in Drupal 7 and later versions!

It doesn't give the reason why, but I assume this is some kind of security issue, and there is no alternative listed.  Is it flat-out impossible to run cron as an admin in Drupal 7+?


texts: Disable coupons field from checkout page when order total amout is less than $500

texts:
I am working on Drupal commerce site. Using commerce_discount_extra and commerce_discount for discount and coupon code.

I just want to display Coupon apply filed into checkout page while the total amount of order will be >=$500. Below $500 the coupons field will not display into checkout page.

So can anyone please tell me how can I disable the Coupons fields from checkout page when the order amount will be less than $500?

Thanks in advance.


texts:
I love admin-menu's Enable Developer Modules menu item.  How can I toggle this from the command line?

Admin menu already has a configuration of "developer" modules set up in settings.php.
I can access this array with drush vget admin_menu_devel_modules (well sort of, that returns two entries).  Now I want to 'pipe' those items to drush enable.  I know that's not literally possible but this is my thought process.

How can I script this command?


texts: No logged in status on frontend nodes (domain access)

texts:
I'm using Domain Access Module with five different Domains. On one subdomain I cannot do any changes to my templates, JavaScript files, blocks etc. If I add some code to a template or place a new block in a different region - it works only on "admin" sites. If I switch to my front page or any other node the new stuff is not there. The HTML code even says "not-logged-in" as CSS class. But when I go to .../user I am loggen in. Admin bar is also missing if I'm not on a "admin" page.

Any ideas????


texts: How do you build a query to get a series of nodes and their field values filtered by field values?

texts:
Hopefully someone with Drupal 7 experience can point me in the right direction.

I'm creating a custom module to query some nodes and group and sort them by their field values.

I tried to use Views but it seems that it's not possible to get the results in the format I need so I've decide to query the database directly and build my own output.

What's the easiest way to query nodes in Drupal 7 as I notice there is a table for every field now which would seem to make any query that I have to write extremely complex?

Are there any methods to query node data and filter/group the results or can it only be done using raw SQL.

If the latter can you show me an example query that includes Drupal 7 Field values?


texts:
i have an app that sends username and password to a php script. This script checks that a user exists on Drupal 8 with username and password entered but does not log the user. I need the user to log in. Can someone help me? thanks
Follows script code
use Drupal\user\UserAuthInterface;
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
// Boot Drupal.
$autoloader = require __DIR__ . '/autoload.php';

$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', FALSE);
$kernel->boot();
// Recupero Nome utente e password
$nome_ut = $_POST['nome'];
$pass_ut = $_POST['pwd'];
// effettuo il controllo
$user_auth = \Drupal::service('user.auth');
$user_storage = \Drupal::entityTypeManager()->getStorage('user');

$accounts = $user_storage->loadByProperties(['name' => $nome_ut, 'status' => 1]);
$account = reset($accounts);

if ($account) {
    if ($user_auth->authenticate($nome_ut, $pass_ut))
       {
    // The credentials are correct.
       $id = $user_auth->authenticate($nome_ut, $pass_ut);
       print ("Accesso riuscito!");
           // Force session start if we don't already have a session.
               $session = \Drupal::service('session');
               if (!$session->isStarted()) {
               $session->migrate();
           }
           if (\Drupal::currentUser()->isAuthenticated()) {
               // This user is logged in.
               print ("Utente Loggato");
           } else {
               // This user is not logged in.
               print ("Utente non Loggato");
           }

       }
}


texts: Understanding database structure for auto-migration

texts:
I am trying to come up with a good way to get this handed down Drupal project to work as smooth as possible. Ideally, my goal is to do changes local, and when that looks okay, I should be able to git push this to the server. Earlier I've made myself able to push structure changes through git hooks/post-receive, CodeIgniter Migrate and some bash scripts. This was worked out really neat, and I'm interested in similiar solutions for my Drupal project.

Ideally, I would like to upon git push have my php script generate a .sql file, send it to the server and let the server execute it so that it replaces live tables as ideal. Since our main page will handle products, orders and such that can't be overwritten, I can't simply just clone the database.

The thing I'm mostly puzzled out is, how do I tell what tables do what in my Drupal database? I have around 300 tables, and am not fully sure how dependent the tables are of each other, which that handles structure changes such as enabling and disabling modules and so on. Does anyone share an insight regarding this?

Maybe there's some easy solution for what I'm after that I've missed?


texts: How Webprofiler EntityManagerWrapper overrides EntityTypeManager?

texts:
In trying to understand the new paradigm of Dependency Injection, I attempted to install Webprofiler into my D8.6.10 project but it seemed it causes a conflict with my already installed fullcalendar_view. It has a dependency that is expecting an instance of Drupal\Core\Entity\EntityTypeManager which is important in this new world to declare what is required for your class/method to work.

Stepping through the stacktrace, at some point Drupal is aware that the fullcalendar dependency is requiring EntityTypeManager but the call is co-opted by WebProfiler into EntityManagerWrapper and it breaks the site.
I could only get past it by removing the EntityTypeManager requirement. My frustration is that I'm trying to understand when I should pull this stunt to remove a requirement for things like Webprofiler and when I should not. I apologize that I don't have the means to ask a focused question because I don't have enough knowledge about this new paradigm yet.

Which is why I ask here.

Is it Webprofiler not respecting the fullcalendar_view requirement and invoking the EntityManagerWrapper or is the fullcalendar_view asking for the wrong requirement?


texts:
Im printing the node body in my tpl file with this:

 <?php print render(field_view_field("node", $node, "body", array(
  "label"=>"hidden",
  "type" => "text_summary_or_trimmed",
  "settings"=>array("trim_length" => 150),
))); ?>

The " and ' characters in the node's content are breaking the page as im putting this in a mailto link. How can I make sure these characters are printed as non html entities eg &#34; instead of ".


texts: How to Add a field that asks for more details under product display just like add to cart/add to wishlist?

texts: I have an e-commerce site , i want to add a link or a button under each product display to ask about price with view integration, if i click on it i will be redirected to a form to add my informations.Any help will be appreciated.


texts: How do I fetch the user ID from the shipping profile?

texts:
I'm trying to get the User ID from Shipping Profile in Drupal Commerce using the following code, but eventually, $entity->getOwnerId() is returning me NULL in any case, if it's an authenticated user or admin it's giving me 0 as the UID.

function mymodule_entity_insert(EntityInterface $entity) {
    if ($entity->getEntityTypeId() === 'profile') {
        /** @var \Drupal\user\Entity\User $user */
        $user = User::load($entity->getOwnerId());
    }
}


texts: How do I completely uninstall version 2.19 of the module?

texts:
I'm supporting a Drupal installation (8.9.0) with commerce 2.19 installed. The customer wants commerce to become uninstalled. I've managed to get rid of the majority of commerce configuration.
What stays are: order type recurring and order item type recurring. There is no way to delete those, as the delete option is hidden.
The uninstall site shows:

Commerce Recurring    Provides recurring billing for Drupal
Commerce The module "Commerce Recurring" can't be uninstalled
because:
The field type "Billing period" is used in fields: commerce_order.billing_period, commerce_order_item.billing_period

There is no way to delete either field. If I try to delete the fields via drush cdel it leads to other errors and doesn't help. How to continue with uninstall task? As long as this module can't be uninstalled the rest of the commerce will remain.


texts: How to add Javascript in Drupal 7 with jQuery?

texts:
I am trying to provide the option that users be able to put comment under each paragraph. So at the end of the article, I have something like this:

Comments for paragraph 1

  /* here I show the comment for paragraph 1 */

Comments for paragraph 2

  /* here I show the comment for paragraph 2 */

Comments for paragraph 3

  /* here I show the comment for paragraph 3 */

so  I have added the following to node.tpl.php:

    for($b=1;$b<$number;$b++)
   {
         echo "Commentsfor Paragraph $b:" ."
" . "
" ;

        foreach($cid_numbers as $no)
          {

             $e=($content['comments']['comments'][$no]['#comment']->paragraph_id);
             if($e==$b)
             print render($content['comments']['comments'][$no]);

           }
        }

and it works. But now I want to hide the comments and only when users clicks on a link like:  Comments for paragraph 1, then he be able to see the comments.

In order to do that I have added the following to node.tpl.php file:

and also changed the first code to this:

    for($b=1;$b<$number;$b++)
   {  ?>

<?php echo "Commentsfor Paragraph $b:" ."
" . "
" ; ?>

 <?php
   foreach($cid_numbers as $no)
    {

  $e=($content['comments']['comments'][$no]['#comment']->paragraph_id);
   if($e==$b)
    print render($content['comments']['comments'][$no]);

   }   ?>
 <?php

   }

This is the website that gave me the idea that how to do the hide/show: http://renaudjoubert.com/en/article/how-add-javascript-drupal-7-jquery?utm_source=twitterfeed

But the output looks like this:

comments for paragraph 1

 here it show comments for paragraph 3

comments for paragraph 4

and then when I click on the link "comments for paragraph 1" then  it displays the comments for paragraph 1 and also the link " comments for paragraph 2".
So what is my mistake? Have I put  tag in the right place? Or do you have any suggestion that how can I hide comments and show them when click on the link?


texts: Checking for string in variable fails in twig

texts:
I'm working on a twig template for use with a commerce product. Each product has a term applied to it like "Green Ball", "Yellow Ball", "Red Block", and "Purple Block".

I'm trying to take the variable that holds the term, check if it has a string in it, and then use that as the basis for a label. For example if its a Green Ball it would say "Order Ball" and if it was "Red Block" it would say "Order Block".

I'm marking this up based on examples but it always returns false.

{% if 'Ball' in product.field_myproduct_type|field_value %} Order Ball {% endif %}
{% if 'Block' in product.field_myproduct_type|field_value %} Order Block {% endif %}

I've both tried outputting the variable on its own to confirm the variable is correct and also tried replacing the variable from the conditional with a string to make sure the conditional is the proper syntax and both work as expected. I just can't seem to check in the variable.

I'm doing this from within a twig template that is a variant on commerce-product.twig


texts:
I’m using drupal 7 with Ubercart version 7.x-3.8

I would like to now if there is a way to mass import different taxonomy vocabulary from a csv file.


texts: "access ckeditor" permission missing - buttons inactive

texts:
I have my ckeditor basically up and running. Users with the role 'editor' however can see and use it, but the buttons appear to be inactive. Just the "Source" and "Format" are accessible for editors.

And in under permissions > ckeditor I have no permission for "access ckeditor". Any help / pointers welcome! Thank you!

ps: Editors do have permission to use the related text format "full html".


texts: How do I compare a shipping address with a profile address field?

texts:
Does anyone know if its possible to set up a rule that would compare the users core account shipping address field (not a commerce profile) to the shipping address field used on the check-out form during check-out?
I have the site configured to auto-populate the billing and shipping address fields during check-out using the core account shipping address field (which uses the "Address" module), not commerce shipping profile so that my client can control a list of registered shipping addresses for a B2B site. The customers need to be able to either use their registered shipping addresses, or enter a unique shipping address and pay $3.00.
What I need to do is determine if the user over-wrote the auto-populated shipping address value with a custom address (which implies they are attempting to drop-ship their order to a residential location, and therefore adds $3.00 to the order total) by comparing the value in the shipping address field used during check-out to the value in the core account shipping address field. And if they DO NOT match, add three dollars to the order.


texts:
I have these modules installed:

cck-6.x-2.9

i18n-6.x-1.10

token-6.x-1.18

views-6.x-2.16

I would like to set the language of the website by checking the language used by the browser and set that as the website language.

Is this something that is possible?
Can you show an example of how to do this?


texts: The security danger of publicly exposing an upload field

texts:
On older drupal 7 websites I once faced security patches for the webform module, because file upload fields were considered insecure. There was en exploit where people could end up uploading .html files (via ajax) to your files storage and started spamming to those links.

I'm currently working on a drupal 8 project where anonymous users can fill in a form and upload their resume in a file field. I chose to create a content type and a custom form mode. Now the form is shown in a custom controller on the site.

My questions:

How (un)safe is the public exposure of a file upload field?
Are you aware of any steps taken in drupal 8 to further secure this?
Any suggestions to do this even more securely?

Thanks in advance.


texts: How do I override a function in a module

texts:
I want to batch override (there are hundreds of terms) menu paths generated by the Taxonomy Menu module for a custom menu I require.  I know not to edit the module itself. I assume I create a separate module containing the replacement function to substitute the desired path I want, but I am not certain how to direct Drupal to use it instead of the original.  Or am I using the wrong strategy for this?

UPDATE:
I have solved the specific example in the question using a panel tied to a view. However, I am still interested in the question itself. A theme function can be overridden by including the replacement function with my theme name replacing the original theme name in the function name. Drupal handles the substitution from there; the same renaming option is not available for module functions.

I have continued to research this and found several posts at Drupal.org, that suggests it is not possible to override module functions in the same way you override theme functions.  There was a module for this in Drupal 6 (Override_Function), but it required additional software and appeared to have some problems working with PHP 5.2 & 5.3. The only workaround I have found so far is to hack it, but keep track of your changes so that it can be reinserted after updates.


texts:
does Twig provide any way to translate string which is passed to macro? I thought that it would work in similar way to Wordpress translation function where instead of string I just provide the variable. But it does not work.

Here is my macro:

{% macro input(type, name, placeholder, value, class) %}
<input type="{{ type|default('text') }}" name="{{ name }}" placeholder="{{ placeholder | t}}" value="{{ value | e }}"
       class="{{ class }}">
{% endmacro %}

Then I call it in this way:

{{ macro.input('text', 'name', 'Name...') }}

I want just to translate the placeholders but when I use | t filter drupal returns the error:

InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 140 of F:\xampp\htdocs\va\core\lib\Drupal\Core\StringTranslation\TranslatableMarkup.php).

I am aware that input is not great example and I should use form API, it's just the easiest to explain. Is there any way of translating strings which are passed to macros?


texts: How to use JavaScript code in the confirmation message?

texts:
I need to add JavaScript for a 3rd party service to the confirmation pages of multiple webforms (Drupal 8, Webform 5); staff need to be able to easily manage this so I can't hardcode a single item, and they'll be creating lots of webforms over time so a developer shouldn't be needed. The WYSIWYG editor on the field strips out the HTML that is pasted in, so that doesn't work.
Is there a way of disabling the WYSIWYG editor for the confirmation message field so that the admin has full control to add JavaScript?
I looked into creating a new plugin to handle this, but the confirmation system isn't cleanly extendable like other parts of the system, so I opened https://www.drupal.org/project/webform/issues/3167055 as a feature request.


texts: Drupal 8: Custom display settings for a html table

texts:
Result of custom sql query needs displayed in table format. The custom query unifies results from two entities (which is not possible through views UI) and creates an html table.

A settings form needs to be created that would provide an ability to

Hide/show all available columns in this table.
Provide an ability to customize the display formats for each column in # 1 (for example time in different formats, description trimmed or full, etc). This will be similar to Manage Display UI

How can #2 be accomplished programmatically? Essentially replicate Manage Display like capability on a custom settings form.

Should this table, instead be generated using views which inherently provides hiding/formatting options via Views UI? If so, how can the views query be supplanted by the custom query which merges and unifies two entities?

Also like to avoid using Display Suite module and stick to core modules.


texts: How do I find (or create) a File Template override in Panels 3?

texts: So I'm using Panels 3 and Drupal 7 and it makes it damn easy to override the default templates for a taxonomy term template, a node template, even the front page template.  However, I don't see anything on the default panel page admin list that allows me to override the default FILE template.  When I try to Add a New Page and use the file/%file path, the system forbids it, as this URL structure already exists.  How do I harness the power of Panels for other page templates that the Panels module does not offer an override out-of-the-box?


texts:
I'm trying to print a comment form with the following code.

<?php
    print drupal_get_form('comment_form', array('nid' => $row->nid), t('Post new comment'));
?>

All I get is the following error repeated 40 times:

  Warning: Attempt to assign property of non-object in comment_form() (line 1845 of /home/admin/public_html/website.com/modules/comment/comment.module).`

The comment form is called from inside a PHP Views field. What is the proper way to add a comment for to a node in Drupal 7?

There are actually a lot more errors, most of which repeat at least once:

  EntityMalformedException: Missing bundle property on entity of type comment. in entity_extract_ids() (line 7501 of /home/admin/public_html/website.com/includes/common.inc).
  Notice: Trying to get property of non-object in comment_form() (line 1854 of /home/admin/public_html/website.com/modules/comment/comment.module).


texts: drupal_http_request not responding with redirect_url

texts:
I have a form like this:

<FORM METHOD="POST" ACTION="https://some.url/with/data.asp" id=form1 name=form1>
    <INPUT type="hidden" NAME="name1" value="value1">
    <INPUT type="hidden" NAME="name2" VALUE="value2">
    <INPUT type="hidden" NAME="name3" VALUE="value3">
    <INPUT type="hidden" NAME="name4" VALUE="value4">
    <INPUT type="hidden" NAME="name5" VALUE="value5">

    <input type="submit" value="GO" id=submit2 name=submit2>
</form>

Which I have to submit by using drupal_http_request since it has to be done in a redirect_form within a Drupal Commerce Checkout-flow.

$url = 'https://some.url/with/data.asp';

$headers = array('Content-Type' => 'application/x-www-form-urlencoded');

$data = array (
    'name1' => 'value1',
    'name2' => 'value2',
    'name3' => 'value3',
    'name4' => 'value4',
    'name5' => 'value5',
);

$response = drupal_http_request($url, $headers, 'POST', http_build_query($data, '', '&'));

The response I get in return contains all information I need except for the redirect_url. It's not present in the response and by so I cannot use a drupal_goto for example to redirect my users to the paygate...

What did I miss? Or is drupal_http_request not the correct way to emulate above form? Maybe I should go with cURL?


texts: Drupal System cron temporary file/folder error

texts:
I have very specific problem which I can't resolve. Thing is, I've created few files with function that creates temporary files and then system cron after running should delete them. Problem that I have is that I have manually deleted (temporary) file named "user-upload" and then created folder which has exact same name. Now when system cron runs it gives me two errors:

  Could not delete temporary file "public:///user-upload" during garbage
  collection public:///user-upload is a directory and cannot be removed
  using file_unmanaged_delete().

I think I should somehow clear something in database but not exactly sure where to look at. Running drush cc all isn't helping in this case.

Thank you

EDIT:
Eh, it takes you to ask question so you can get better idea. For the reference, solving this issue is locating particular file under database table "file_managed" column "filename" and then manually deleting it.
Maybe it will help someone...


texts: How can i load a specific CSS file for a specific View?

texts:
What's the best way (best practice) to load a specific stylesheet for specific View. i managed to do it like this, in the template.php file but i'm thinking this is pretty awkward and there is a better way.

if($variables['theme_hook_suggestions'][0] == 'page__dvd_products') {

drupal_add_css(path_to_theme(). '/css/dvd-product-display-view.css', array('group'=>CSS_THEME));
} else {

drupal_add_css(path_to_theme(). '/css/dvd-product-display.css', array('group'=>CSS_THEME));
}

what is a better way to do this? i'm still kind of new at this. any feedback would be greatly appreciated. thanks


texts:
In Drupal 7 we could edit the system table to set a module a version back to let the hook_update_n run again.

In Drupal 8 there is no system table.

Where can I find what version of the module is installed so I can change this and make sure the update hook is run again?

This is useful while developing hook_update_N() of my module so I can test this.


texts:
I am trying to override / hook theme_table from theme.inc.
My theme name is stat.
I have added following function to my theme template.php.

function stat_table($variables) {
  //table logic here
  return $output;
}

I have dev env configured with xdebug and while function is 'loaded'/processed when displaying page with table, it is never called.
Original theme_table is called instead.
I already tried clearing cache via drupal_theme_rebuild();
Using Drupal 7.

Is there anything I am doing wrong?
How can I debug why is the function not called?


texts: Insecure content warning with D7 and SSL

texts:
I'm running Drupal 7 with Drupal Commerce module. I have SSL enabled on my server. I've confirmed that the SSL is properly enabled (If I replace Drupal's index.php with a simple index.html, Chrome allows me to browse to my domain via https).

I'm getting a bunch of error messages like this:

  The page at https://example.com/ ran insecure content from http://www.example.com/sites/default/files/css/css_TsVRTbLFUpEZAfw-_bWPJu840QT523CPjUVJ5MRWfyk.css

There are about 20-30 of these errors - mostly .js and .css files, some .png etc.
Questions:

How can I configure d7 so that it accesses these files via relative paths
Are there any other workarounds here, to enable https on my drupal install?

Much thanks in advance.


texts:
I would like to carry a field (i.e. Name) entered on the 1st page of a multi-page WebForm and reflect that field on the Confirmation (Thank You) page.

How would I go about doing this?

I am using Drupal 7.