texts: Webform Radio buttons are not getting "radio-checked" class when clicked on

texts:
I've developed webforms before where I set a component to "Select options" and the design has required these options to look like buttons, so with a bit of simple CSS, we can achieve this:

form .form-radios label{background-color:#bebebe; border-radius:3px; margin-right:5px; border: 1px solid #b6b6b6; padding: 10px; text-align: center; color:#232323;}
form .form-radios label{float: left; width:200px;}
form .form-radios label .form-radio {xposition: absolute; xleft: -99em;}

(the prefix "x" added to the last 2 styles are obviously removed before deployment, it's just so I can see the radio buttons)

Now, when I click on the pretend buttons, they usually gain the class "radio-checked" as per this example on a previous site I've built https://www.feelthepulse.co.uk/request-callback

However, it doesn't work on my current build (you click the button, but no extra classes are added). I've looked for any modules I might have forgotten about, and I can't see any options for the webform regarding ajax or anything.

Has anyone else had this problem, or know what I'm missing ?


texts: How can you change the temporary directory?

texts:
I migrated the site from the local server to live server. But the images do not appear - the website logo and some PDFs. I've been seeing the problem could be here "Config" >> "file system" and my temporary directory is: /Applications/MAMP/tmp/php because I need to change that. But I do not know how. if you can help me. please

  Warning: move_uploaded_file(temporary://logo_verde_maior.png): failed
  to open stream:
  "Drupal\Core\StreamWrapper\TemporaryStream::stream_open" call failed
  in Drupal\Core\File\FileSystem->moveUploadedFile() (line 81 of
  core/lib/Drupal/Core/File/FileSystem.php).

This is error:

  Warning: move_uploaded_file(): Unable to move '/tmp/php9al1tV' to
  'temporary://logo_verde_maior.png' in
  Drupal\Core\File\FileSystem->moveUploadedFile() (line 81 of
  core/lib/Drupal/Core/File/FileSystem.php). File upload error. Could
  not move uploaded file.


texts: db_affected_rows() return "1" when the query is wrong

texts:
I have a query like UPDATE user SET creator = 'creator'". The "user" table has not the "creator" column, so db_affected_rows() shoud return −1, not 1.

Why?

Update: mysql_affected_rows() returns -1 for this query. I created a "creator" column (unique); after I update the user table, I get the error "User warning: Duplicate entry," but db_affected_rows() still returns 1.


texts: How to display cck node fields' values at the search result page?

texts:
I need to display some specific cck fields such as Telephone Number, Address, etc. at the search result page.

As I see the search-result.tpl.php, there is no $node->... So how can I get the node fields into search result page?


texts: Creating a marketplace for tour activities

texts:
I am tying to setup a website that will sell tour activities.

People (local guides) can login in and create a profile and define 1 or multiples activities (i.e. a waking tour of Manhattan) with a description, a price and a calendar of availabilities (maybe just now a simple calendar system not linked to availabilities).

Tourists will come on the web site, choose an activity (by category, location...) and will choose a date for it and book it online.

I need to track the orders in the admin area and have it in the Profile of the person who created the activity.

I tied to do this with D7, marketplace module, calendar module and Ubercart but I have lots of difficulties to do it.

Do you have tips on which modules would be the best to do that (Ubercart / Drupal Commerce)... ?

I have also been looking to "rooms", "simple reservation" modules but it seems that they does not fit my needs.

Regarding the invoicing, payment, commission revenues tracking, I will plug the API of an external system like LemonWay.

Thanks.

Emmanuel.


texts:
I'd like to know when a field from a node it's a paragraph, I only get the type, that it's entity_reference_revisions, I use this method to get the information:

\Drupal\field\Entity\FieldStorageConfig::loadByName()

But I'm not able to get this information

 [settings:protected] => Array
    (
        [target_type] => paragraph
    )

The only way I get it's to check directly to the database to see it the name of the field it's in the table paragraphs_item_field_data.

Thanks

Oskar


texts: Og Membership entity not created when assigning new node to Group; works when editing node

texts:
Using Organic Groups 7.x-2.9, I have two content types:
- Series (Group)
- Event (Group Content)

When creating an Event, a users has a select list of the Series they can assign this Event to (og_group_ref).  However, upon saving this new Event there is no og_membership entity created (recorded in the table og_membership) and, therefore, the new Event is not in the Series group.

If you then edit this event and select the Series, the og_membership entity is created and the relationship is reflected on the Event. (Possibly related, there is no data in the table field_data_og_group_ref).

Using breakpoints - everything appears to be the same with one exception: When OgMembership::save() is called during the creation of a new entity the event entity object does have the nid; however, the node (Event) has not yet been saved in the node table.

What needs to be done in order to have the relationship when a new node (that is a group content) is created?

[EDIT] It seems the og_membership entity is being saved and then deleted.  I found this issue regarding data loss.  I don't think it's related (as of yet) because I don't have any active OG rules; however, it did make me check further.  When creating group content and associating it with a group, the og_membership table auto increment does increase by 1, although no record was written.  This tells me a record was written and deleted.

[EDIT] The above linked issue led me to another hook_node_insert that is used in this site.  This hook uses entity_metadata_wrapper to set a field value, commenting this out stops the og_membership entity from being deleted.


texts: Seemingly random  being added into views node header for content type

texts:
I've got what seem to be random empty
s appearing whilst displaying a custom content type as a teaser in a pretty standard blocks display through Views. Now this is only a problem because it's adding dimension and padding, which can be aleviated but I'd actually rather like to get to the bottom of why it is happening.

        ...

We've created a subtheme of Zen and only have the following files overriden:

block.tpl.php
node.tpl.php
node--news_story.tpl.php
node--product.tpl.php
page.tpl.php
views-view--page.tpl.php
views-view-unformatted.tpl.php

I've cleared the views cache, cleared all caches, not got "compress JS/CSS" etc. selected, rescanned the template files but it makes no difference.

I've not added any custom classes to the views display settings, I've not done anything funky in the custom content types either, not the default/teaser displays. Nearly everything is as it is by default. And we're not using grouping, which I've read can be a problem.

In our custom "news_story" template (and the product one too) we'd carried over something in the header from an old build. This was displaying an empty h3 but commenting it out fixed it completely. And it was not in the rendered HTML at all. Unlike the other blocks, like the Features section.

  <?php if ($title_prefix || $title_suffix || $display_submitted || $unpublished || !$page || $title): ?>

        <?php //DONT DO THIS WITH THE H3: it injects it even if the field_news_category is ignored?>

      <?php
        //hide($content['field_subtype']);
       //hide($content['field_field_news_category']);
      ?>
      <?php print render($title_prefix); ?>

However, we've not overriden the other custom content types and I can't find anything in any of the other templates that has any h3 or anything. I've looked through Zen and there's nothing there. I've looked through the Views module and in the Theme folder there was a h3 in "unformatted" so I overwrote that and commented out the
 ...

<?php

/**
 * @file
 * Default simple view template to display a list of rows.
 *
 * @ingroup views_templates
 */
?>
<?php if (!empty($title)): ?>

<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
  <div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
    <?php print $row; ?>

<?php endforeach; ?>

And since we're using the "unformatted" format I can only presume that's all that's needed. I also tried commented out the
 in the views-view-unformatted.tpl.php file in the Views module's Theme directory. And clearing Views caches with Drush. But somehow there's still a h3 getting in there...


texts:
I have created a textarea field using admin ui. It allows users to add Bio to their profile. I want to do 2 things with this field.

Limit the characters to 255.
Use a text format. Note: I do not want to allow users to choose a text format.


texts:
This is specifically a question about Pantheon best-practice workflow, which I'm new to.

I run from a Win7 machine and do not have a full dev environment set up locally: it's just too much hassle to get Windows to play usefully and smoothly as a dev space behind my hosted *nix worlds. So, I am in the habit of developing online.

With Pantheon there is no shell access, but there is git and drush.

I don't use git because the workflow there asssumes that I want to move something off of my local repository up to Pantheon (eg, if I have a local working environment I would apply the patch, then push the patched code to my Pantheon dev), but this is not my usecase.

Using drush seems like an option, but I can't figure out how/if applying a patch is supported.

So...

How to patch a contrib module on Pantheon given no local dev environment?


texts:
After adding a block file to src/Plugin/Block I can't add the block on the Block Layout admin page. When I filter by block name I can see it, but then when I try to place it I can't get to the configure block screen (pressing the 'Place block' button produces no effect).
I do not get any errors.

What could be the reason for such a behaviour?

The block file contents:

    <?php

namespace Drupal\Core\Block\BlockBase;
use Drupal\Core\Link;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Provides a block with a link to start the toru.
 *
 * @Block(
 *    id = "iai_tour_link",
 *    admin_label = @Translation("Link for the IAI Product Guide tour"),
 *    category = @Translation("Links"),
 *    context = {
 *       "node" = @ContextDefinition(
 *         "entity:node",
 *          label = @Translation("Current Node")
 *        )
 *     }
 *   )
 */
class TourLinkBlock extends BlockBase implements ContainerFactoryPluginInterface{
    /**
     * The current user.
     *
     * @var \Drupal\Core\Session\AccountInterface;
     *
     */
    protected $currentUser;

    /**
     * Constructs an TourLinkBlock object.
     *
     * @param array $configuration
     * A configuration array containing information about the plugin instance.
     * @param string $plugin_id
     * The plugin_id for the plugin instance.
     * @param mixed $plugin_definition
     * The plugin implementation definition.
     */
    public function __construct(array $configuration, $plugin_id, $plugin_definition, AccountInterface $current_user){
        parent::__construct($configuration, $plugin_id, $plugin_definition);
        $this->currentUser = $current_user;
    }

    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition){
        return new static(
            $configuration,
            $plugin_id,
            $plugin_definition,
            $container->get('current_user')
        );
    }

    public function build(){

        $node = $this->getContextValue('node');
        if ($this->currentUser->hasPermission('access tour') && $node->getType() == 'book'){
            $url = Url::fromRoute('<current>', array(), array('query' => array('tour' => 1)));
            $build['tour_link']= [
                '#type' => 'markup',
                '#markup' => Link::fromTextAndUrl(t('Take the tour!'), $url)->toString(),
            ];
            $build['#attached']['library'][] = 'tour/tour';
            return $build;
        }
    }
}


texts: A custom template file is not properly rendered

texts:
I know this issue is covered quite well, but at the moment I'm really perplexed on this.

First, I'm using the Zen theme. In my template folder I've created page-music.tpl.php, page-gallery.tpl.php, page-bio.tpl.php, page-front.tpl.php, and so on. I've tried putting the code in the template.php for the custom pages, but I can't redefine the zen_preprocess_page() function. The custom pages won't render the admin menu module, or display the modules properly for that matter. The JavaScript code is all funky.

I'm not sure if I'm using the right code for the the template.php. There seems to be a lot of jumbled imformation on this matter.


texts: EFQ SQL error when using filedCondition on two different taxonomy terms

texts:
I'm using the below code to select a 'store' content type which has two taxonomy fields: category and brand.

$queryStore = new EntityFieldQuery();
$queryStore->entityCondition('entity_type', 'node')
  ->entityCondition('bundle','store', '=')
  ->propertyCondition('status', NODE_PUBLISHED)
  ->fieldCondition('field_city','tid', $city_id, '=')
  ->addMetaData('account', user_load(1))
  ->execute;

 if ($_GET['category'] != 'Choose a category'){
   $queryStore->fieldCondition('field_category','tid', $category_id, '=');
 }
 if ($_GET['brand'] != '') {
   $queryStore->fieldCondition('field_brand','tid', $brand_id, '=');
 }

However when I choose a brand like Chanel and a category like Food (naturally such node doesn't exist since Chanel doesn't do food), I get the following error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND (field_data_field_city0.deleted...

I'm using Drupal 7.
Is there a way to avoid such error?
I appreciate any help given

Thanks


texts: Nexus theme tb mega menu showing below slideshow

texts: I am using the Nexus theme however when using tb mega menu it shows below the slideshow. I know it has something to do with the z-index but where and how do I change this?


texts: Hide local tabs in specific content type

texts: I want to hide the local tabs for a specific content type. How can I do this? I don't want to complete remove it since I want to show them in other content types


texts:
I'm on Drupal 7 and have tried the appropriate versions of both the Persistent Login and Remember Me modules.  However, I don't want to provide a "remember me" option to remember users' passwords.  Instead, I want to automatically remember the username and present that pre-filled upon a user's next visit.

Is there a module for this?  If not, could someone roughly outline the approach I might take to do this (using cookies, etc.)?


texts: On User Creation, send user registration email in his language preference

texts:
Is there a way to send the welcome message to a new user in his preferred languages ?

As an Administrator of the website, I create all the users with their preferred languages. I Check the button to notify the user when the user is created.
The email is sent correcly but not in the languages that I specify for a particular user.

I already install the I18n module and made the translation between each languages.

Thanks a lot


texts:
I'm moving my Drupal 7 website to https but I keep having issues with some images that gets loaded with full path, but with http://. For example the site logo and view images have http:// path. (Inside DB table file_amanged files are all saved with public:// path.) They are all files loaded through the Drupal UI.

How can I force all images to use https?


texts: Duplicating Database For Local Development

texts:
I've recently started putting some Drupal installations in to source control. Editing modules and the like is pretty easy since they're obviously just text files. I run in to issues with the database though.

My current idea is to run a cron job to pull in database from the live server every night to keep things up to date.

The current method is to just drop the local db and then mysqldump the live one on to my local machine.

I'm pretty sure doing it the way I currently am could cause me to lose things like content types and fields if I make new ones on the local machine and then the 'outdated' live db gets pulled in.

What is the best way to approach this situation?


texts: Views SQL-query slow with big dataset and exposed filters

texts:
I have a problem with a Drupal 6 site working with many nodes.

This is the SQL given by Views:
https://gist.github.com/ranbogmord/79bfa50e40db1322c9e0

The query takes 5-10s to run through and the specific content-type has 30 fields bound to itself. 21 of those are exposed.

Imagine this as orders in a business system.

Thanks!


texts:
I'm setting up a way for a Drupal site to import data from third party sites using a PHP script that creates a XML structure.

I'm using the Feeds module, which otherwise works fine. But I miss something.

Now, I need to add a custom source from the feed that adds data to a field.

Like that I have a  inside the XML  that I want to be used for the nodes image_field. I need more then just a image, but as an example.

How do I do that?

Is there perhaps a way that will work so that I wont have to code it by myself?

PS. Since I've coded the script that creates the XML, I could easily change XML to about anything else that might work better. DS.


texts: Dynamically grow menu based on terms in vocabulary?

texts:
As terms are added to a vocabulary, I need these terms to be incorporated into a menu with a custom URL structure.  For example, I might have the Restaurant Taxonomy which has the following terms:

McDonalds
Taco Bell
Wendys

I need to have a menu generated that matches a particular pattern with the term names plugged in - this pattern can be arbitrary.  For example, I have the pattern /restaurants/<term-name> would generate a menu with the following links:

/restaurants/mcdonalds
/restaurants/taco-bell
/restaurants/wendys

As terms are added, this menu needs to grow dynamically.  How can this be accomplished?


texts: Q: How to control theme colors for Drupal 7 mass contact email

texts:
I'm using the Corporate Clean theme as the basis for my site.  I've customized some theme colors to my liking.  I have installed the Mass Contacts module to send bulk email.  I've specified in the mail system configuration to use the Corporate Clean theme.  The customizations do not appear to cause the following problem since I can't see any color settings that reflect what I'm seeing with the problem.

Problem:

The email that is received (via Thunderbird) is displayed with a dark gray background and light gray lettering.  It is readable, although, I'd like to make it easier on the eyes.  On my phone, it is unreadable - the text actually shows as black text on a dark gray background.  I'm assuming that the color is specified somewhere in the theme or css.  However, I have not been able to locate the settings that would allow me to change the color combinations.  I've read a similar, but, old post but did not quite understand if there was a solution mentioned.

I'd like to get a better understanding of how to control the theme colors for email.  Can anyone tell me how the colors are controlled and how I can change them?


texts: How to add custom css files in a theme from drupal.org?

texts: I am using the Zen theme on my site, but would like to add custom CSS files that the theme should use. How can I achieve this?


texts: Admin block listing showing unwanted debug info

texts:
Suddenly my Drupal 8 admin panel is displaying some unwanted objects/arrays in different places. Below is a screenshot of the block layout page.

This is a localhost site that is not available to public.


texts: Address book not visible to registered users

texts:
We are using drupal commece 2 on drupal 8 and I noticed, that /user/xx/address-book/ only works for the admin user, not for normal registered ones.
It appears to be a permission issue, but under /admin/people/permissions I can not find anything billing / shipping / address related.
Anybody knows which box to tick?


texts: How to force migrations to not copy files

texts:
I have a migration with an image field and the files already exist on the server where I want them.

There is a file, some_file.jpg that already exists at sites/default/files/some_file.jpg but when I run the migration, it tries to copy the file from sites/default/files/some_file.jpg to sites/default/files/node_type/some_file.jpg and then also creates another file entity for it.  I just want it to re-use the file and file entity that already exist for it.  The destination field type is an image field.

I have this on the field mapping for the file field:

$this->addFieldMapping('field_upload_image', 'field_res_upload_photo');
$this->addFieldMapping('field_upload_image:preserve_files')
     ->defaultValue(TRUE);
$this->addFieldMapping('field_upload_image:file_replace')
     ->defaultValue(MigrateFile::FILE_EXISTS_REUSE);


texts: Let New Users Connect with Twitter OAuth only (not Facebook)

texts: I would like to let new users register with a Twitter OAuth for new' signups' to my project so not really wishing for Facebook implementation as yet. There seems to be a range of subjects & options via Drupal.org etc, but I'm simply looking for a quick and easy 'out of the box' solution to getting this going without having to waste lots of time trying to figure out which route to go. I already have a Twitter account so just need a pointer to best 'free' option geared towards Twitter for signup purposes to my projects. Thanks.


texts: Flexslider field: number of thumbs, number photos and thumb slider

texts:
I just installed the module Flexslider. I want to create an image gallery similar to this one: http://flexslider.woothemes.com/thumbnail-slider.html, with a main big photo slider and thumbs sliders (carousel).

I'm using Flexslider field (that means it will create a gallery with the images of the node) instead of Views. I'm not sure how to show all thumbs (all the images I uploaded to the node) in the strip.

I was playing around with the settings in the section "Edit optionset" of the Flexslider module, specially with Item width, Minumum items and Max items. When I change the values, sometimes it shows 2 thumbnails, sometimes 3, etc, depending of the quantity I put in the values.

The weird thing is, when displaying the node if it shows only 3 thumbnails, the main big slider just will have 3 photos, even if the node have a lot of more photos.

What I need is simple, create a gallery that shows all the images in the slider and per each image it should shows one thumb. How I do that? And what means the fields Item width, Minumum items and Max items

Thanks in advance.


texts: Why do I get "Warning: Division by zero in __TwigTemplate"?

texts:
I created the connectedFilters.js file in /themes/custom/module/js/ with the following code.

(function ($, Drupal) {

    Drupal.behaviors.connectedFiltersBehavior = {
        attach: function (context, settings) {

            console.log("im working!");

        }
    };

})(jQuery, Drupal);

In module.libraries.yml I added the following lines.

connectedFilters:
  js:
    js/connectedFilters.js: {}
  dependencies:
    - core/drupal
    - core/jquery

In the appropriate view, above the top HTML element I added {{ attach_library(‘module/connectedFilters’) }}.

When I refresh the page I get the following warning.

Warning: Division by zero in __TwigTemplate_803bc8c08db6c9bfff48088195ee1e9f3bfaa4c94fad1e00b868ab6b41a67f00->doDisplay()

When I remove{{ attach_library(‘module/connectedFilters’) }}, the error goes away. Why?


texts: token_replace : operate on two different 'user' entities?

texts:
I've got an e-mail message with the following contents:

Dear [receiver:name],

[sender:name] would like to recommend the following link [node:url].

Now, I could certainly implement hook_tokens() and make sure that all 'receiver' and 'sender' tokens are replaced, but these entities are plain old 'user' objects. It would be great if I could just use the functionality already available, but as far as I can see, that requires me to specify replacement patterns in the format [user:name]. However, that doesn't work as it would mix up the sender and receiver.

Any idea if this is doable withouth having to reimplement the 'user' replacement logic?


texts: Background Process Module Limitations and Efficiency?

texts:
Drupal's Background Process module has been suggested as an alternative to Cron and Batch when heavy lifting is required. The API documentation on background process is good but does not go into details on how it actually works and its' limitations. Can someone explain how Background Process gets around the PHP timeout issue and keeps tasks alive - and whether it operates efficiently (e.g. vs. Batch).

Thank you!


texts: How can I keep a long-running Drush script from gradually exhausting available RAM?

texts:
I've got a drush script that's used to clear out old, unpublished nodes that have come in from feedapi. The script is fairly simple: get all the nodes with status 0 of a certain type ("post") and age (older than 90 days), loop through them, delete each one.

The script runs through about 4,000 nodes at a time, then exhausts the memory available to its PHP process. I can watch the script's footprint grow from top and the 4,000 node limit is somewhat consistent. I've got over 100,000 nodes to work through, though, so I don't think it will be practical to just jack up the RAM available to the process long enough to get a run out of it.

Is there anything I can add at the bottom of each iteration to release the RAM it's consuming?


texts: Search based on user profiles in Drupal 7

texts:
I want to develop user matching feature on website. A user will search by giving some search criteria (like we give search criteria in dating / real estate website to filter out search results), and system after, filtering out, will return the users matching that search criteria.

How can it be accomplish in Drupal 7 ? Is there any module or combination to modules to achieve that goal ? Thanks in advance.


texts: why does entity_delete_multiple use a cursor not a set?

texts:
I am getting a lot of hits on the quiz module on my site, several thousand a month.
And I am finding from user feedback that I need to delete the old tests (they are all under anonymous login) to keep the quiz performance acceptable.

The act of deleting several thousand sets of quiz results can be very tedious because you can't just delete them all, something overflows and it errors out, so i need to delete a few hundred at a time. (Although now i have moved hosting company that has improved a lot)

It seemed to me that the delete function was deleting data one at a time. When i checked the code it invokes "entity_delete_multiple" which apparently gets passed a result set, but then instead of deleting the set, it opens a cursor an deletes them one by one.  This seems so counter intuitive that there must be some good reason?

foreach ($ids as $id) {
  $info['deletion callback']($id);
}

Is there anywhere in the api set that can get passed a set of ids and them does the equivalent of 'delete from table name where id in (set)'?

TIA


texts:
I need to POST to a url with php code in order to make a phone call. This is an example of javascript:

<script>
        function callme() {
            var XHR = new XMLHttpRequest();
            XHR.addEventListener('readystatechange', function() {
                if (XHR.readyState == 4 && XHR.status == 200) {
                    document.getElementById("result").innerHTML = XHR.responseText;
                } else {
                    document.getElementById("result").innerHTML = "ha ocurrido un error: " + XHR.responseText
                }
            });

            var FD  = new FormData();
            FD.append('number', document.getElementById("number").value);
            XHR.open('POST', 'doC2c.php');
            document.getElementById("result").innerHTML = "calling ..."
            XHR.send(FD);
        }
    </script>

And the doC2c.php file must be:

<?php

$apikey = ""; //API KEY MUST BE PUT HERE GOT FROM DB
$origin = ""; //ORIGIN EXT MUST BE PUT HERE OR GET FROM SOMEWHERE
if ($apikey == "") {
    header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
    echo "APIKEY MISSING";
    die();
} else if ($origin == "") {
    header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
    echo "ORIGIN MISSING";
    die();
} else {
    $opts = array(
       'http' => array(
           'method' => "GET",
           'header' => "Content-type: application/json\n"
                       ."X-Api-Key: ".$apikey,
       )
    );

    $context = stream_context_create($opts);
    $response = file_get_contents("https://....../api/originatecall/".$origin."/".$_POST['number'], false, $context);

    //echo $response;
    echo "CALLING...";
}
?>

I would like to make a D8 module that create a URL I could POST to execute the php code, but I want to have Drupal API to query de DB and so on. I know how to make a module with a form and a route to show it, but I don't know how assign a route to a php code file.


texts: Is there a way to stop comment_node_view from firing?

texts:
I need to use the Commentsblock module, but it is turning out to be pretty buggy.  I've got an issue in the queue with a patch for comments not displaying for anonymous users.

Now I've got a second issue posted about how paging is broken, but I'm stumped on how to fix it so wanted to see if anyone else had an idea.

Here is the issue: http://drupal.org/node/1513910

My question is: Is there a way to prevent the comment_node_view function from executing?

Or....should I be going about this an entirely different way (backup plan is to use Views to display comments in a block, but I can't think of a way to respect threading so would like to avoid that if possible).


texts: A quick one - is it ok to use this? I can't seem to get access to $base_url in my node which is set in my settings.php file.


texts:
I ran into a timeout issue using migrate the other day and started to wonder how the Batch API works internally.

The way I understand it is that in its simplest form you'll pass an array of values (nids for example) and a function to operate on those values.
The batch API then processes a fixed number of those values with each request until it's finished.

When a batch is running the page seems to use Ajax requests to show the progress of the batch operation (% done and messages). I assume it waits until the request has finished to update the progress and then start the next request immediately afterwards?

If the page with the batch request is closed does the batch processing stop? Will it restart when the same URL is opened again? The migrate module sometimes continues but it's probably using queues?


texts: How can you add a node dropdown list to choose from when adding a link inside ckeditor?

texts:
We have ckeditor on our wep page which allows users to select text and format it as link by clicking that little chain icon. Users can set the protocol, the target, etc.

We wondered if there is a way to add a dropdown of all nodes (which the user has access to) to pick from? Is there a module/plugin which does that?


texts: Store custom checkout pane data to order

texts:
I've created a custom checkout pane according to documentation. When I submit my Order and go to admin page, where all my orders are listed, I can't see this custom pane field there. I've already tried to add $this->order->save(); at the end of submitPaneForm function but that seems to make no difference. I've already created field with machine name "field_test_me" in my Order type and also have added this field to enabled fields on "Manage display" tab, but the field seems to be empty.
Is there anything I'm missing to get my custom pane fields to be displayed on the "Order detail" page, please?
This is how my buildPaneForm function looks like:
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form)
{
$pane_form['billing_info'] = [
  '#type' => 'fieldset',
  '#title' => $this->t('@title', ['@title' => $this->configuration['title']]),
];

$pane_form['billing_info']['field_test_me'] = [
  '#type' => 'textfield',
  '#title' => 'Test me',
  '#wrapper_attributes' => [
    'class' => ['col-md-6']
  ],
  '#default_value' => 'MY CUSTOM STRING'
];
return $pane_form;

}
And this is how my submitPaneForm function looks like:
public function submitPaneForm(array &$pane_form, FormStateInterface $form_state, array &$complete_form)
{
    $values = $form_state->getValue($pane_form['#parents']);
    $this->order->setData('field_test_me', $values['billing_info']['field_test_me']);
}

I'm using other functions for displaying value on "Review" page, but those are not part of my issue.


texts: Commerce 2.x confusion about multiple order types and order item types

texts:
I have two different order types and two different order item types. Let's say they're "Default" and "Custom". On the configuration page for the Default order item type, I've specified Default as the Order type. On the configuration page for the Custom order item type, I've specified Custom as the Order type. For both order types, I use the "Inline entity form - Complex" widget for the Order items. I've set the "Allow users to add new order items" option and left the "Allow users to add existing order items" option unselected.

I expect that when I create an order of type Default, I will only be allowed to add Default order items. And when I create an order of type Custom, I will only be allowed to add Custom order items.

However, what I get instead is the option to choose from a select list whether I want to add a Default or Custom order item, regardless of the order type. So it's possible to create orders that have a mix of Default and Custom type order items. I do not understand why this is so. It seems that the "Order type" value for order item types is being ignored.

Is there a way to set up commerce order/order item types so that an order item can only be added to an order if the order type is the one specified in the order item type configuration?


texts:
I have a field field_agent_name. I want to hide this field in my custom module using hook_form_alter.

How to do this.


texts: Undefined index errors only on one subdomain

texts:
On only one of my four registered domain names (foo.com, www.foo.com, foo.fr and www.foo.fr) am I'm getting undefined index errors such as:

Notice: Undefined index: vignettes in custom_page_preprocess_charger_accueil() (line 978 of /homez.119/retronom/www/sites/all/modules/custom/custom_page/custom_page.module).

The www.foo.com subdomain spits out these errors and is set up as a CNAME to foo.com.  I'm really stumped as to how this could affect only one of the subdomains.  What could cause these kinds of errors only on one?

Code setting up $varTemp:

//Vignette
if ($node->field_type['und']['0']['value'] == 1 && $node->language == $GLOBALS['language_url']->language) {
  $varTemp['vignettes'][$j]['image'] = theme('image_style', array (
    'style_name' => 'quick_link',
    'path'       => $node->field_image['und']['0']['filename'],
    'alt'        => $node->field_image['und']['0']['alt'],
    'title'      => $node->field_image['und']['0']['title'],
  ));

  $varTemp['vignettes'][$j]['link'] = $node->field_lien_site['und']['0']['value'];

Code that is failing:

While ($j != count($varTemp['vignettes'])) {  <-- Line 978
  if ($varTemp['vignettes'][$i]) {
    if ($varTemp['vignettes'][$i]['column'] == 'A') {
      $vars['vignettes']['A'][$a]['image'] = $varTemp['vignettes'][$i]['image'];
      $vars['vignettes']['A'][$a]['link'] = $varTemp['vignettes'][$i]['link'];
      $vars['vignettes']['A'][$a]['ombre'] = $varTemp['vignettes'][$i]['ombre'];
      $vars['vignettes']['A'][$a]['title_link'] = $varTemp['vignettes'][$i]['title_link'];
      if (isset($varTemp['vignettes'][$i]['body'])) {
        $vars['vignettes']['A'][$a]['body'] = $varTemp['vignettes'][$i]['body'];
      }
      $a++;
    ...
    snip
    ...
}


texts: all searches comes back w/ epoch time (DEC 31 1969)

texts:
I have my own environment setup w/ Apache Solr Search | Drupal.org.

Whenever I input a standard search inside of a search box, majority (if not all) returned results appears in epoch time (DEC 31 1969), needless to say we don't have this date inside of our content.

our environment is using: php-5.3.3 (RHEL6), apache-solr-1.4.1 and apachesolr-6.x-1.8.

any suggestions?

NOTE: I posted same question on Drupal Groups as well: epoch time (DEC 31 1969) | Drupal Groups


texts: Configure Panels That Uses View With Entity Reference For User Profile

texts:
I am having a hard time setting up my Panels page for the
user profile page   ie:  /user/%user

I am using the "Reference" module, and have my content type "News" reference users.
I created a view for this called "User News Reference" to make sure it is working correctly.  The view has a "page" and a "block".  The "page" display for the view correctly returns the referenced data when you manually put the user's id in the path.

I then went to panels and used the Panel's page for the User Profile Page, ie: /user/%user
I created a variant and my user's profile to the top of the content and then I added the view "User News Reference" to the center content.  I then loaded the user page with a valid user that has referenced "news" content, but the referenced material never shows up.

I created images of every step along the way to help you help me diagnose the problem:

1) First here is my view that I created that returns "news" content that references the user.

2) Here is the view in page display showing the "news" content that references the user with id = 1 (added to show that the references are configured correctly)

3) here is the panel page. In the context section I first have the User Profile, and then the "User News reference" view.  I followed it up with some custom content to show that the panel page is actually loading correctly and the page shown is the User Profile Panel page.

4)After setting all of that up here is the page for user 1.  This is the Panel's version of the user profile.  Note that you can see the profile and the custom content, but not the "news" referenced content from the view.

5)To be sure that the view was loading properly, I went to the view and changed the contextual filter from "display no results if the filter value is not in the url" to "display all results for the specified field" and reloaded the user profile for user 1.  then all of the "news" content is returned on the user profile page for user 1, proving that the "User News Reference" view is loading properly for the user profile panel.

Can someone help me understand what I need to do correctly to get the user:Uid to show up in the url for the view used in the panel?  I believe the view used in the panel is using the "block" display of the "User News Reference" view, but not sure how it is misconfigured.

I thought it might have something to do with the "context" section in for the Panels User Profile.

I thought I had to add another context, and tried under "user", but the only option was the currently logged in user, or a user by name.


texts: We want to clear the multiple sites cache from one site, currently we have multi-site configuration. Is there any module?


texts: How to access a contributed module Information from drupal.org

texts:
Is there any API to access Information about a contributed module
from drupal.org site?
How does Update Manager access information
from drupal.org?

By finding this I think I too could access other data similarly and I also need Hook API documents to be accessed from drupal.org in my site.

Did anyone do this before? If so please guide me.


texts: How to uninstall a custom module which introduces a field type and creates a field of that type on install?

texts:
Ading a new field to a content type by adding field.storage.node.myfield.yml & field.field.node.article.myfield.yml configs to config/install directory of my custom_module module.
This field is of type customfieldtype which is defined in the custom_module module itself.
This adds a new field myfield of type customfieldtype to the article content type.
Now if I try to uninstall this module via the UI, it doesn't allow the module to uninstall because of this dependency:
The MyField field type is used in the following field: node.myfield
Question: Do we require to move the plugin implementation of customfieldtype to be in a separate module? Can we not achieve the uninstall on this custom module?


texts:
In my modules info file, i set a url for the configure page.

This is my info file.

name = Raffle
description = Enables an interface to manage and join Raffles
configure = admin/config/people/raffle

package = custom
version = 0.01
dependencies[] = hybridauth
core = 7.x

However, the configure option for my module leads only to

/admin/config/people

I don't know why it does this or what i'm doing wrong here. I checked other modules info files, and i'm pretty sure its not a mistake in my info file.

Yes i tried clearing the cache

Yes, i've implemented a hook_menu hook. I can browse to the URL and i get the expected result. However, it is the configure part of the info file im having trouble with.

Any help would be appreciated.


texts: WSOD on 7.20 after failed attempt to update web form, media, ctools, context modules

texts:
Attempted to run security updates for those modules. Update failed. Can't login. WSOD.

(Hosted on Bluehost shared server) Error Message from log:

PHP Fatal error:  Call to undefined function page_manager_get_current_page() in ../public_html/sites/all/modules/panels/panels_mini/panels_mini.module on line 146

I've followed various instructions for getting site out of maintenance mode but continue to get WSOD.

Status message Operating in maintenance mode. Go online. (But "go online" doesn't go)

Error message
There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates.
There are security updates available for one or more of your modules or themes. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates.
OK
Web server  Apache
OK
PHP 5.4.26
OK
PHP register globals    Disabled
OK
PHP extensions  Enabled
OK
Database support    Enabled
OK
PHP memory limit    128M
OK
File system Writable (public download method)

Error
Unresolved dependency   context (Missing)
Context layouts requires this module.

Error
Unresolved dependency   page_manager (Missing)
Chaos Tools (CTools) Plugin Example requires this module.

Error
Unresolved dependency   page_manager (Missing)
Custom breadcrumbs for panels requires this module.

Error
Unresolved dependency   context (Missing)
Date Context requires this module.

OK
Unicode library PHP Mbstring Extension


texts: Passing a referenced node's location token to referring node

texts:
I have two content types -- Invoice and Project -- which are related to each other (Basic content types provided by Storm). Project has a Location CCK field, which I want to use in the Invoice's title field (via Automatic Node Titles).

How would I pass the Project's location field value (Specifically street address) to the referring Invoice via Automatic Node Title field?

Thank you!


texts:
I'm using the Webform module's block on a custom content type.

The webform has some text fields and I passed some data from my custom content type fields to webform fields as explained here.

I'm also using the Webform Ajax module for webform submission.

What I want to do is to print some field data from the current node after webform (successful) submission.

I tried to use the webform-confirmation-2.tpl.php to do what I want (2 is the node id of webform):

Method #1

At first, I tried the method explained here:

<?php
  // Print the webform submission to the submitter
  include_once drupal_get_path('module','webform') . '/includes/webform.submissions.inc';
  $submission = webform_get_submission($node->nid, $sid);
  $email = NULL;
  $format = "html";
  print webform_submission_render($node, $submission, $email, $format);
?>

It didn't work.

(Notice: include() (../webform-confirmation-2.tpl.php line: 37) Array to string conversion.)

line 37 is:   print webform_submission_render($node, $submission, $email, $format);

Method #2

And another code in the same page didn't work:

<?php
    //lets see if we can show them their submission
    $sid = $_GET['sid'];
    if(isset($sid)){
        include_once drupal_get_path('module','webform') . '/includes/webform.submissions.inc';
        $submission = webform_get_submission($node->nid, $sid);
        $email = NULL;
        $format = "html";
        print render(webform_submission_render($node, $submission, $email, $format));
    }
?>

It gives this error: Notice: include() (.../webform-confirmation-2.tpl.php line: 34) Undefined index: sid.

line 34 is: $sid = $_GET['sid'];

EDIT: I solved the error, it doesn't give an error now but also doesn't give the wanted result.

Method #3

Then, I tried to use menu_get_object() in webform-confirmation-2.tpl.php:

<?php
if ($node = menu_get_object()) {
        $print ($node->field_custom_field['und'][0]['value']);
    }
?>

This also didn't work. Nothing printed, no error.

Method #4

I tried to print the field as a block inside of the webform-confirmation-2.tpl.php by using the Field as Block module:

<?php
$block = module_invoke('fieldblock', 'block_view', '7f1bb640a56605ca4ea56453ebf4c759');
print render($block['content']);
?>

That code also didn't work. It didn't print anything.

How to print a field data from the current node after webform (block) submitted successfully without refreshing the page (webform ajax)?

Maybe another way to do that is to hide the fields (via CSS, JS etc.) at first and then if the webform submission done show them. Here, I have to know the trigger to use in the JavaScript but don't know.


texts: Customize Apche solr autocomplete module

texts:
I want to display apache solr autocomplete keywords suggestion to be grouped like:-

----Suggestion from taxonomy-----

term1
term2
term3

----Suggestion from products---

product3
product4
product10

----Suggestion from pages---

contentX
contentY
contentZ

Actually I am new in drupal, so could somebody help me how's it possible?


texts:
I'm working on proxy based machine where I've configured my proxy settings at settings.php and its working fine.

When I'm trying to access a URL the data is getting displayed perfectly, for instance, https://maps.googleapis.com/maps/api/geocode/json?address=California but when I'm doing the same thing at my devel/php

$maps_url = 'https://maps.googleapis.com/maps/api/geocode/json?address=California';
$maps_json = drupal_http_request($maps_url);
dsm($maps_json);

it's returning me this:

I've confirmed 2 settings in my php.ini:

allow_url_fopen
allow_url_include

Where else should I look so that this issue will get fixed?


texts: Can't specify a configuration(drush.ini) for Drush

texts:
I put my drush.ini into the ~/.drush/ and Drush can find it.But when I type command 'drush status' it show Drush did't use the drush.ini.But PHP application use it.Below are my drush status.

///////////////////////////////////

[root@AY130703214149Z ~]# export DRUSH_INI='/root/.drush/drush.ini'

[root@AY130703214149Z ~]# drush status

PHP executable : /opt/lamp/php/bin/php

PHP configuration : /opt/lamp/php/etc/php.ini /root/.drush/drush.ini /root/.drush/drush.ini

PHP OS : Linux

Drush version : 6.1.0

Drush configuration :

Drush alias files : /opt/lamp/php/lib/php/drush/includes/../aliases.drushrc.php

//////////////////////////////

Forgive my poor English,but I really need help.Thanks a lot.


texts: Convert D6 user timezone offset to D7 timezone string

texts:
In Drupal 6 user timezones are stored as second offset, such as: -3600. In Drupal 7 it's the timezone string, eg: Europe/Berlin.
I would to migrate users with their timezone setting to D7, but it's not obvious how to convert timezone offsets to strings.

My current solution is to create a full mapping table built from the timezone strings but I'm sure it's not the most elegant:

$d6_offset = -3600; // Input.
$zones = timezone_identifiers_list();
foreach ($zones as $zone) {
  $offset = format_date(time(), 'custom', 'Z', $zone);
  if (!isset($map[$offset])) {
    $map[$offset] = $zone;
  }
}
$d7_timezone = $map[$d6_offset]; // Output.

Do you know a better workflow?


texts:
I'm new to Drupal and I've a 'pager' link that shows the second page of a block. It's href attribute is set to something like this '?page=0%2C1' I want it to be simply '#'.
It worked by setting $attributes['href'] to '#' in pager.inc but I'm not sure if I'm supposed to modify this file or not.


texts: What are my alternatives to disable update notifications but without using module Update Notifications Disable?

texts:
I need to disable the update notification overall Drupal 7, rather than downloading the module Update Notifications Disable because it caused a fatal error, and the site went down.

Is there any other way?


texts: How to use a views contextual filter OR?

texts:
After browsing the net and SE for a while it appears to me there is no good solution to combine 2 contextual filters with OR (rather than the default AND).

This post mentions a PHP hack and this post has some links to an issue stating a recent change in views 7.x-3.1.
It also mentiones using hook_views_query_alter(&$view, &$query) to modify the view.

Does anyone have a working example or a better solution?


texts: Views Module: Related Content by Title Only

texts:
How to make a "Related Content View" but only by titles.

I know how to do it by taxonomy terms and such I don't want that. I only want it to be related by the terms in the titles of the articles.

For example, lets suppose I have an article with the title: "Stackexchange Drupal Help by Awesomeness People"

I want to make related content View with other articles having title with the words "Stackexchange", "Drupal", "Help", "by", "Awesomeness" and "People"...

I just want related content filtered with the words from titles, to show other articles with this same words. If possible excluding words with less than 5 characters.

I'm trying this for days now, I think this is impossible, or at least I can not do it.
Thank you in advance


texts:
Playing around with Drupal 8 and trying to create a custom module with a custom block:

I have a module.info.yaml file:

name: Custom Module
description: Description Here
package: Custom Module
type: module
core: 8.x

dependencies:
  - block

I have a src/Plugin/CustomBlock/CustomBlock.php file:

<?php

/**
 * Provides a 'Custom' Block
 *
 * @Block(
 *   id = "custom_block",
 *   admin_label = @Translation("Custom Block"),
 * )
 */

namespace Drupal\custom_block\Plugin\Block;

use Drupal\Core\Block\BlockBase;

class CustomBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  public function build() {
    return array(
      '#markup' => $this->t('Hello, World!'),
    );
  }
}

The module is in /modules/custom/module. I have installed contrib modules in /modules/contrib with no issue.

If I go to the Extend page, my module is not listed.

Please let me know what I am missing here?


texts:
Is it possible to display a node content (without sidebar etc.) inside colorbox in Drupal 6.
I know there is module for that in drupal 7 - colorbox-node. But I could not find any thread bout same functionality for drupal 6. Can anybody help? Thank you


texts:
Would appreciate it if someone could let me know how to print a block in node.tpl.php. I basically have a block created through a view and I haven't set a region for that block as I would like to do is display this block in a specific position in all my node pages.

This is what I did in my theme's template file:

function mytheme_preprocess_node(&$vars) {
  $vars['my_block'] = mytheme_block_render('views', 'myblock-block_1');
}

function mytheme_block_render($module, $block_id) {
  $block = block_load($module, $block_id);
  $block_content = _block_render_blocks(array($block));
  $build = _block_get_renderable_array($block_content);
  $block_rendered = drupal_render($build);
  return $block_rendered;
}

And in my node.tpl.php file, I just do:

<?php print $my_block; ?>

However, this is giving me a memory limit exhausted error.  I can get it to work perfectly if I render the block in mytheme_preprocess_page function and print it in page.tpl.php, but I need to print this in node.tpl.php.  I tried the following as well:

function mytheme_block_render($module, $block_id) {
  $block = module_invoke('views', 'block_view', 'myblock-block_1');
  return render($block);
}

That is giving me the same memory exhausted error.  Is it too later to render a block in the node preprocess function?  Why can I render it in the page preprocess function but not in node?  Is there some other preprocess function that we can render it in and then have access to it in node.tpl.php?


texts: How do I find the route to extend a form?

texts:
I'm using the Content Moderation module in 8.4 and I want to override the /core/modules/content+moderation/src/Form/EntityModerationForm.php.

I copied EntityModerationForm.php to /modules/MYMODULE/src/Form/MyEntityModerationForm.php.

I now want to override EntityModerationForm with MyEntityModerationForm.

So, following this tutorial, I added a RouteSubscriber to mymodule.services.yml and tried to set the route to alter:

  protected function alterRoutes(RouteCollection $collection) {
     if ($route = $collection->get('??what_goes_here??')) {
  $route->setDefault('_form', '\Drupal\MYMODULE\Form\MyEntityModerationForm');
     }

Examples in the documenation for the routes are user.login or user.logout.  However, as far as I can tell, EntityModerationForm.php does not have a "path"-like route in the same way as user.login.

Instead, this form is displayed on entities via the content moderation's public function entityView() with this getForm() code:

    $component = $display->getComponent('content_moderation_control');
    if ($component) {
      $build['content_moderation_control'] = $this->formBuilder->getForm(EntityModerationForm::class, $entity);
    }
  }

So I don't know how to alter the route in the RouteSubscriber to use MyEntityModerationForm instead of EntityModerationForm.


texts:
The Rules module provides a value field for the "send mail" action. Since I also have the PHP filter module, I have the ability to add PHP code there. I want to add HTML formatting to my email. Is there a more "correct/Drupal way" of sending HTML based emails via rules other than pasting my code there?

The pet module looks like a decent candidate, but has low-ish usage numbers.


texts: How do I post a node that has its created field set to the past in a test class?

texts:
I am creating a test class using the framework of the core Testing module for a module that is supposed to autoexpire nodes some time after they've been created.

Nodes have two timestamp fields: changed and created.  I've tried to use the following code inside my test class (subclass of DrupalWebTestCase) to post an article that is supposed to have been created some time ago:

  // Post an article.
  $edit = array();
  $edit["title"] = $this->randomName(8);
  $edit["body[und][0][value]"] = $this->randomName(16);
  $edit['changed'] = 1397700000; // This is accepted.
  $edit['created'] = 1397700000; // This fails.
  $this->drupalPost('node/add/article', $edit, t('Save'));

The above code snippet produces the following error message when the test is run:

  Failed to set field created to 1397700000

Do anyone know how to explicitly set the created field to some specified Unix timestamp date for a node created inside a test class?


texts: Url adds zero at the end and duplicate contents appearing

texts:
Some of my contents have duplicate contents meaning it creates two path for the same content  and I don't know how it track this and it adds zero(-0) at the end of the url like the below

www.example.com/fully-furnished-one-bed-southridge-area-1061-sqft-0

www.example.com/fully-furnished-one-bed-southridge-area-1061-sqft

now I am manually redirecting the url's using global redirect module for the purpose of SEO. Is this correct way to do this ? or I have to set anything to block those url's in ROBOT.txt  and yes it shows duplicate title in webmaster tool, any idea on how to solve this issue ?


texts: how to create a custom skin in jCarousel

texts: I want to create a custom skin in jCarousel. I have seen this website http://timonweb.com/how-create-custom-skin-jcarousel-drupal-7, but I don't want to create any new module. How to do it in a simple way? I had tried creating a new skin folder inside the skins directory of jCarousel module, but it didn't worked.


texts:
As an Drupal 7 developer I'm currently trying to get into Drupal 8.
I got a problem finding the right plugin.

For example, I simple want to change the text of a node link "read more" into "read more >".

Leaving the templates out, I would google for Drupal 7 something like "drupal hook -what I want- alter" and found the correct hook. How can I find the correct plugin?

Especially for this case, there hook_node_links_alter(). Should I use this, or is it just for legacy and I should prefer a other way?


texts: how can i store an image in my postgresql database?

texts:
I want to save some data in my module's form like an image.

In fact i want to store an image in my Postgresql database.


texts: How can I alter the HTML output of a specific content-type in display mode via a module, without creating the node type in a module?

texts:
I have a specific node-type: resource. The default display of a resource node is not quite what I want, so I need to over ride the themeable output - so far so good. The problem is, I've created my resource node-type through the Drupal 7 GUI. How do I write a module that just over rides the HTML output for this one content-type?

...and, in piggyback to that question - I will have many other node-types that I've created through the GUI, but need custom output for. Is there a way to create just a single module that will handle the custom output for all of these types?

Thanks.


texts:
Under /admin/structure/taxonomy/my_vocabulary/display/entity I've got a view mode "entity". For this view mode, I would like to alter the way the link in the title field is built (the title is replaced by a real field instance due to title module): the link should be rebuilt into an anchor link like this: Title, where term-ID is replaced with the actul term ID of the term. How can I achieve this by a custom module or by a template function? Are render arrays good for this?
Here's a screenhot of the admin page.


texts: Acquia Lightening, BLT, Github and CircleCI - How to deply to Acquia Cloud

texts:
We have a multi-site Drupal install set up on Acquia Cloud and have a local development team building out a site, this development work is version controlled in one of our own Github repos.  This repo is connected to CircleCI, but currently CircleCI only runs the default Behat/PHPUnit tests on Pull request, it does not build a deployment artifact or push to the Acquia cloud git repo.

I am trying to understand what the best workflow is for the develop branch in our Github repo to be deployed to the development environment in Acquia cloud. In this scenario the developers building the site are not the same people pushing the changes to Dev.

I've had a look at a few examples of config.yml files such as https://github.com/fourkitchens/example-acquia-8-composer-circle2/blob/master/.circleci/config.yml but these use Composer.  I'm thinking that we need to modify the yml file to run BLT commands which then in turn drive Composer rather than explicitly run 'composer install' for example.

I can see what looks like useful documentation at https://blt.readthedocs.io/en/latest/deploy/ and https://docs.acquia.com/tutorials/deploy/generating-deployment-artifact/ regarding setup for blt.yml and then generating a deployment artifact, but I'd really appreciate some advice on stitching it all together from the moment a PR is accepted to our Dev branch through to getting it on Acquia development server.


texts:
I'm using the Rules module in my Drupal site to do the following:

when an existing user logs in
check if there are required fields of the user account that have no value yet
redirect to the user page and show a message

This is necessary, because we have added required fields to the user account. My problem is with the second step. I can add a check for every required field, but would like to use a more generic approach.

What I'm looking for is PHP code to check if the current logged in user has required fields that are empty.

I am a developer but in .NET and have no PHP knowledge, though I'm willing to learn and I'm confident I'll pick up quickly.


texts: How can I print user field values in page.html.twig?

texts:
I've created a couple of fields for the user in Drupal 8, example: first name. And i'm trying to print it in the home page (page.html.twig) but to no avail.
I tried the following:

{{ user.field_first_name.0['#context']['value'] }}
{{ user.field_first_name.0.value }}
{{ user.field_first_name }}

I even tried adding preprocess functions on mytheme.theme, and still it didn't work.

noting that the below works

{{ user.displayname }}

Appreciate any help given,

thanks


texts: Print module and missing breadcrumbs of Crumbs modules

texts:
I use crumbs module to maintain custom breadcrumbs. Also, I use print module to maintain printer's friendly pages.

The breadcrumbs works perfectly in the ordinary pages. However, using print module leads to missing section in breadcrumbs.

For example:

mysite.com/sports/the-winner-cups
return breadcrumbs: Home -> sports -> the-winner-cups

but
mysite.com/print/sports/the-winner-cups

returns Home -> the-winner-cups

The following is a screen shot of active rules weigts of Crumbs module:


texts: How can I limit an entity reference selection to a specific field value on the reference

texts:
I have a content type Research which has a an entity reference type of People.
The problem is that I don't want to show ALL people but only people which have a certain value under their field named type.
I was trying to find it here:

Anyone an idea how to only show a content-type for a certain field value of that content type


texts: VBO: "Change owner" Vs "Change the author of content"

texts:
I would like to change the author of a content for a bunch of nodes. So I've chosen Views Bulk Operations (VBO) module to achieve it.

Part of it, created a VBO view, but in the VBO options I see "Change owner" and "Change the author of content" (shown below).

What's the difference?


texts:
How can i import value to Entity Reference using Feeds?

I have this in Feeds (CSV):

http://i.stack.imgur.com/nMEI4.jpg

I tried all of this options but everytime the field is empty.

Importing data is a value like this.

http://i.stack.imgur.com/l6dMJ.png

Also i tried «Tamper: Convert string into entity ID» but there is no field in Entity View that i need.

This is how node field is configured:

http://i.stack.imgur.com/dcGBY.png

And this is Tamper config:

http://i.stack.imgur.com/ta4cE.png


texts: Drupal Installation running without settings.php (multisite)

texts:
What we intended to achieve was setup drupal.abcd.com as main installation of multisite setup, and abcd.com, xyz.com, pqrs.com as sub-sites of the multisite setup.

The main installation (drupal.abcd.com) should contain the default Drupal installation (with the Bartik theme), and abcd.com should have the ABCD theme with content.

drupal.abcd.com is automatically taking the settings.php file from abcd.com. So, when I make change in abcd.com (e.g. setting a different database) the same change is done for drupal.abcd.com.

I also tried deleting drupal.abcd.com/sites/default/settings.php, but I can visit drupal.abcd.com with same settings as abcd.com.

The installation and creation of folders were done by the customer; I don't know what mistake he did.

Could anyone please suggest me where things might have gone wrong, or what can be done to avoid this behavior, and run everything as normal?


texts: Proper way to alter field value from submit handler

texts:
I added extra field "field_password_changed" to user account and I want to store there time of latest password change (simple input field).
Now, I added custom submit handler to catch user account edit action and currently it looks like this:
function user_form_submitted(&$form, FormStateInterface $form_state) {

  $form_state->set('field_password_changed', 'test22');

  $form['field_password_changed']['en'][0]['value']['#value'] = '54321';
  $form['field_password_changed']['widget'][0]['value']['#default_value'] = 'My new value';
  $form['field_password_changed']['widget'][0]['value']['#value'] = 1;

  $form["field_password_changed"]["#default_value"] = 'ffff';

}

Basically I tried every suggestion from this page:
https://www.drupal.org/forum/support/module-development-and-code-questions/2013-08-01/using-hook_form_alter-to-set-a-field
And not even one is working form me.
What is the proper way to change form field value in custom submit handler?


texts: Allow specific HTML tags inside a text field of a custom content type using CKEditor

texts: I would like to add a new content type with a field which supports some HTML tags. So far, I added a text editor format and there I chose CKEditor as the editor and edited the list of allowed tags according to what I want to achieve. Then I added a new content type with a field of type formatted text. If I now add new content, CKEditor shows up where I expect it, but when I edit the source code and enter, for instance, an <h2> tag, it becomes a <p> tag after saving. The specific problem I'm facing is that I can't figure out how to "connect" an editor format to a field and make it selectable for the one who adds a field to a content type (for example inside the drop down menu where one can select the field type). Do you know any good documentation or tutorial which deals with this topic? Thanks in advance for your help!


texts: How to make the Better Exposed Filter work as a link

texts: I installed Better Exposed Filter module in my project. I have some taxonomy term based on which the filtering is working. I have change the background for the Taxonomy term display name by altering the css file. But when I am hovering the cursor on the filtered display name, only the title of the taxonomy term is working  as a link but not the whole  as a link. What the changes I had made in the css it's not working as a link. How can I make the whole  as a link ?


texts: correct way to implement multipule users registration form

texts:
I want to create a site where users get to chose between being an employee or employer.

So when users first go to the registration they need to be asked which role will they be, and on that choice a different registration form will appear.

What would a good implementation method be?
Thanks


texts: Reflection error on my first module development

texts:
I'm using Drupal 8.0.1. Just I'm started to develop a custom module to simply show hello world text in /first path. Here is my code.

FirstController.php [It is in the path sites/all/modules/first_module/src/Controller]

namespace Drupal\first_module\Controller;

use Drupal\Core\Controller\ControllerBase;

class FirstController extends ControllerBase {
  public function content() {
  return array(
      '#type' => 'markup',
      '#markup' => t('Hello world'),
    );
  }
}

first_module.routing.yml [It is in the path sites/all/modules/first_module]

first_module.content:
  path: '/first'
  defaults:
    _controller: 'Drupal\first_module\Controller\FirstController::content'
    _title: 'Hello world'
  requirements:
    _permission: 'access content'
    _permission: 'view first'

first_module.info.yml [It is in the path sites/all/modules/first_module]

name: First Module
description: An experimental module to build our first Drupal 8 module
package: Custom
type: module
version: 1.0
core: 8.x

I can able to see my custom module in http://localhost/admin/modules also I can able to install the module. But when I got to the path http://localhost/first it shows the error

ReflectionException: Class Drupal\\first_module\\Controller\\FirstController does not exist in
/home/aaa/Public/drupal-8.0.1/core/lib/Drupal/Core/Entity/EntityResolverManager.php on line 128, referer: http://d8.localhost/admin/modules

Where I would went wrong?? Any help!!!


texts: How to add jQuery to the user profile page only?

texts:
Me and Javascript/jQuery don't get along well ...

What I want to do is show the first 200 or so characters of a user's "about me" text and then expand it when you click the "more" link.

I added to my template.php

function bartik_preprocess_user_profile(&$variables){
  drupal_add_js('themes/bartik/js/moreless.js');

}

The moreless.js code is:

jQuery(document).ready( function ($) {
    $(".moreLess").hide();

    $(".moreLessSwitch").toggle(function() {
        $(this).html("Less");
        $(this).prevAll(".moreLess").slideDown();
    }, function() {
        $(this).html("More...");
        $(this).prevAll(".moreLess").slideUp();
    });
}(jQuery));

in user-profile.tpl.php I have:

stuff to always show

stuff to hide...

[+] more

This is the working jfiddle sample.

When I load a user profile nothing happens, I had all caches flushed. No js errors. When i copy the jquery code into the console it works.
This has to be something dumb simple ;-)

Also, is this really the correct way to add conditional js to some pages?


texts: View to display all child taxonomy terms

texts:
I have a content type called "Unit Staff" with a term reference field called "Department". I also have a vocabulary called "Person" which is using a paragraph field consisting of a date field and the same "Department" vocabulary as a term reference. Every department has several child terms. I want to create "Unit Staff" pages where I only select the unit name and a block will display all persons using the taxonomy term.
I have already all page views for every department but if something needs to be changed, I have to go through +30 pages and update them manually. I hope this way to be able to use one view for 30 units/departments.
In other words, I need a view for child taxonomy terms whose parent term is defined in a node taxonomy reference field.
Any help is appreciated.


texts: Same file_temporary_path for localhost and production server?

texts:
Each time I move one of my Drupal website from localhost to production server or vice-versa, I have to edit my settings.php to update the path of the temporary file directory:

# $conf['file_temporary_path'] = '/home5/dawnings/public_html/fw2/tempdir';
$conf['file_temporary_path'] = 'c:/Temp/Drupal/tempdir';

Is there a way to specify a unique relative path to this temporary file directory once for all and which would work both for localhost and production server? The objective is to avoid having to update my settings.php anymore.


texts: How can i add a block below the Main Menu?

texts:
I asked for a second horizontal menu here. But i couldn't manage to success so i'm changing my question a bit.

I want to add a block below the "Main Menu". I will put a table into that new block, which will be looked like a horizontal menu.

In my default case "Main Menu block" is disabled. But i can see the Main Menu horizontally. I ccan't understand how it can be seen :) When i enable "Main Menu block" from "admin/structure/block" that block becomes visible where i set its position, but it sorts Main Menu Items vertically. Also horizontal Main Menu still appears. (That case is also occurs for "User Menu". Its block is disabled. When i enable its block it comes with a vertical menu)

What's the position of the "below of the horizontal Main Menu" in Bartik theme? I created new block and put it to highlighted, help, featured regions. Help and highlighted regions doesn't cover all horizontal part. Featured tooks three times more place than the block.

So i couldn't find a way to put my new block just below the Main Menu..
I would be happy if you can help. Thank you.


texts: How to clear already rendered "drupal messages" after successful ajax submit?

texts:
Possible Duplicate:
  Remove tabledrag statuses on Ajax submit and display status message after Ajax submit

I have a custom form which saves "weights" of nodes to a custom table. The form has an Ajax submit handler. The form is rendered in a table using theme('table') and it has draggable handles added using drupal_add_dragtable.

Because the form gets submitted via Ajax, the messages such as "Changes made in this table will not be saved until the form is submitted" and any other messages in the "message region" don't get cleared even if the form is submitted and the values are saved.

How do I clear this message area? Or is there a way to hook into the "success" function of the Ajax? Or is it at all possible to run a custom javascript function after the form is submitted via Ajax? Any one of these possibilities will do for me. Please advise.

I've partially succeeded in solving this by returning an array of ajax commands from my callback function.

In particular I return the following commands:

$commands = array();
$commands[] = ajax_command_html('#page-banners-status', theme('status_messages'));
$commands[] = ajax_command_remove('.tabledrag-changed');
$commands[] = ajax_command_remove('.tabledrag-changed-warning');

but I've run into a new problem where now, even though the "Changes made in this table will not be saved until the form is submitted" message is removed after the save, it doesn't come back if the table is further modified after the save. I've tried to grab the form again and pass it back using an ajax command:

// my form function receives additional parameters
$form = drupal_get_form('my_custom_form', $path, $tid);
$commands[] = ajax_command_html('.table-container', drupal_render($form));

But whenever I call drupal_get_form from the callback function, it seems to break the function.


texts: Prevent Menu Items from being deleted or moved

texts: How can I prevent certain menu links (i.e. Home, About, Contact) in the "Home » Administration » Structure » Menus" section from being deleted from a menu. I want to prevent clients from deleting the Homepage. Eventually, I would like to prevent them from moving or reordering the Homepage as well. I was hoping that there are hooks where I could query that if the node id is a certain value, that I could cancel the deletion (or move).


texts: How to add asc and desc sort symbols in drupal views?

texts:
I have a drupal 7 view, consists of table. I need to add sort symbol (both asc and desc)
in view header by default if no sorting applied.

I tried with altering views-view-table.tpl.php file, and added asc, desc images for each header.

But I need proper solution, Is there any hook there to alter the table headers?

I need table headers like here : http://ng-table.com/#/sorting/demo-sorting-basic


texts: Anybody know how to create the filters to filter the content using views?

texts:
Here my critical question is how to create filters in a menu which is having some child

filters too. Filters are taken from views based on (Year,and in child - dates,and in

sub-child - category's which we provide in taxonomy),so that while selecting the particular

fields in the child filters ,the result of contents should display. the filters should not be

a select list ,dropdown,or auto compete field.It should shown in a menu and filters are in

its child menu one by one.

anyone know how to do this Kindly reply for this shortly .Thanks in advance


texts: How to resolve my Fatal Error after uninstalling Views Chart Tools and Google Chart Tools

texts:
I'm getting the below Fatal Error after I uninstalled the Views Chart Tools and the Google Chart Tools modules.

  Fatal error: views_plugin_display::destroy(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "views_chart_tools_plugin_display_dashboard" of the object you are trying to operate on was loaded before unserialize() gets called or provide a __autoload() function to load the class definition in /home/XXXX/XXXX/sites/all/modules/views/plugins/views_plugin_display.inc on line 272

I was working with them but they did not serve my purpose. After uninstalling them I started getting the above error.

I can't clear cache or even view the block admin page. Can anyone tell me what I can do to resolve this?


texts: How to simulate radio button functionality within a form

texts:
I have a form which has 3 radio buttons, each providing a fieldset.

o Choice 1
  Fieldset of options v
o Choice 2
  Fieldset of options v
o Choice 3
  Fieldset of options v

In order to achieve this, the three radios are each individual radio buttons, and the fieldset for each is enabled when the radio is checked.

The problem, of course, is that once checked, checking one of the other radios doesn't uncheck the original, because they are different fields. I could use #states to simulate radio behavior, clearing one when another is selected, but I don't believe that will work. If I set Option2 to clear if Option1 is checked:
  Checking Option2, then checking Option1 will clear Option2, great
  Trying to check Option2 again will leave it unchecked, because the test of whether Option1 is checked will be true

I tried this setting for two of them:

  '#states' => array(
    'unchecked' => array(
      ':input[name="*theOtherOption*"]' => array('checked' => TRUE),
    ),

What happens is the behavior works for the first click of each radio button, clicking 1 turns off 2, clicking 2 turns off 1, and then it stops working and I end up with both clicked.


texts:
I have a view which shows the users subscribed to the website. Some users have multiple roles, therefore, on the results, there are some duplicates.

What I want to do is to remove these duplicates, so I've tried to enable the Aggregation in the view settings. This action reduced the repeated results, but it haven't erased them.
By looking at the query the GROUP BY is done for every field, but I want to enable for just one field, more specifically like this: GROUP BY users_name.

I've tried to achieve it by making a simple module with this function:

function alter_users_query_views_query_alter(&$view, &$query) {
    if ($view->name == 'all_users') {
        $query->add_groupby('users_name');
    }
}

Which adds the additional field in the GROUP BY, but it doesn't remove the others.
How can I achieve it? More specifically, how can I unset the other fields and group by just one?


texts: In Drupal 7 i have added a new taxonomy vocabulary, then added a new field (image field) into this vocabulary and terms with image (logo). In the content type i've added a new field (term reference). But in the node i can see only title of the taxonomy term. How i can insert imagefield into the node from taxonomy terms?


texts: Using Views to List a Member's Organic Groups (7.x-2.3)

texts:
I am migrating a site from using OG 7.x-1.4 to OG 7.x-2.3. The migration seemed to go fine, but it broke the view that shows the current users group (i.e. groups the user is a member of). In the original view for 1.4, it had a contextual filter:

(OG membership from OG group) We pass to the "Entity ID" the User ID.

And the following relationships:

OG group: OG group from Node
(node being the OG group) OG group: OG membership from OG group

However, the new Organic Groups 7.x-2.3 now uses the OGMembership data model and I cannot figure out how to recreate this view using OGMembership, as I am not clear exactly how it works and I cannot seem to find any in-depth documentation for this kind of thing.


texts: How can I programmatically get a list of orders purchased by a specific user?

texts:
how can i get list of commerce order purchased by specific user programatically?

i want to create function for it so that other developers can use it in further development by simply calling that function.
i want to get name of orders purchased by user based on uid.

i have used drupal commerce module for it,i am not getting any table column in database where i can get relevant data.


texts: Append filter info to URL when using AJAX in 'View' module

texts:
I am using the Views module and have created a view for a content type. I have added an exposed filter so that the user can filter the list of content based on a custom taxonomy.

I want to use AJAX for filtering the content.  Before I select 'yes' under 'use AJAX' in the 'advanced' tab, the filter appends the filter selection to the URL such as /content-type-view?category='selected-category'.  But once I select AJAX, I lose the update to the URL.

I want to combine the two, use AJAX but also have unique URL's so that I can direct users to pre-filtered instances of the view.

What am I doing wrong?


texts:
On drupal.org, what are exactly meta issues? Meta issues meaning issues that contain the word [meta] at the beginning of the issue queue on drupal.org.

Issues that contain other smaller issues?


texts: I have a Drupal 7 database that stores articles since 2013. The database is too big and I want to drop all the old articles to keep only the ones created on 2019, just for development purpose. I read Delete a node after X weeks it was created, which describes what to do on Drupal 8. Is there a similar method for Drupal 7?


texts: How to make view mode available only to selected bundle?

texts:
I have three taxonomy vocabularies which means that I have three bundles of the vocabulary entity type. I have a few view modes for them and one of them has to be available only to one of those vocabularies.

The method responsible for getting available view modes is \Drupal\Core\Entity\EntityManager::getAllDisplayModesByEntityType() but it does not distinct between bundles, only entity types.

Is there a way I can make that view mode restricted for that one particular vocabulary or this is just not possible?


texts:
I have a query that contains a UNION operator. If I ran my query it runs perfectly straight on the database but I am getting an empty result in Drupal.

Here is a simplified version of the query:

$result = db_query("
    SELECT *
    FROM (
    SELECT
    agent_number
    FROM table1
    WHERE agent_number IN (':agent_numbers')
    UNION
    SELECT
    agent_number
    FROM table2
    WHERE agent_number IN (':agent_numbers')) t", array(
      ':agent_numbers' => $agent_ids,
    )
  )->fetchAll();

Is it that db_query() doesn't support UNION?


texts: Sample Images not showing (Omega Kickstart theme)

texts:
Sorry for this beginners question:
I made a fresh installation of Drupal 7 and then installed "Omega Kickstart" theme by copying the zip-isntallation-link under http://drupal.org/project/omega_kickstart

However, the file is only about 300 Kbit and indeed there is no sample images showing - in fact only one logo changed on my startpage and a slightly different formated text.

Is it possible to install the theme with all the sample-images and modules?


texts: How to remove target id from selected term reference field

texts:
While selecting taxonomy from autocomplete term reference field, its target id also get displayed. How to remove target id from display?

In picture displayed, I want only 23456789 not bracket part i.e. (19) from display.


texts:
Is there a hook or something similar that triggers when a PHP session ends?

When a user signs in, I'm writing a few things to the cache, and I need to delete them from the cache when the user exists the site. If the user manually logs out, that's no problem, but I still need to clear that data when users close the browser.


texts:
I use Drupal 7.9 and Boost 7.x-1.x-dev

Last month i disabled Boost. I used only core caching with the all options are enabled.
And min cache 6 hours, max cache 1 day.

Then without chancing core cache settings i enabled Boost module.
I didn't change any setting.
- Cache specific pages: All pages
- Cache HTML output, usually a webpage of type text/html: Enabled, 6 hours, 1 day
- Root cache directory: cache
- Normal cache directory: normal

But the "html" files aren't saved to my public html folder.
I have this folder:
"/public_html/cache/normal/www.example.com"

But this folder only has a ".htaccess" file.

I get 25 hits in one hour, but there is no html file inside these folders.

What would be the problem.
Thank you for help.


texts: Every time we update Drupal core our custom themes, all previously enabled and one set to default, are no longer enabled. Has anyone else experienced this or know why this would happen?


texts:
I'm creating a Webform in Drupal 8. On the form, I have two number fields; when a user populates them with values, a third field will display the value of the two field multiplied together.

How can I create that computed field?

P.S. If the user changes the values in either the fields, I need the value in the computed field to update on the fly.


texts: How to speed up Drupal 7 compiling PHP to C++?

texts:
I would like to improve Drupal 7 performance with HipHop or any other similar solution transforming the code from PHP to C++ or C.

What steps are needed to properly do the scenario below ?

I would like to :

maintain @development environment as not-compiled php, adding and
testing contrib and custom modules.
after testing @development, I do rsync @development to @staging
...
... and compile @staging
test @staging
rsync @staging to @life

I think it is a bit oversimplification but should bring an overview.

If it is not possible, are there any other options ?


texts: boost only for front page with cache enabled for other pages?

texts:
I know that Boost module works only when drupal cache is disabled.

But is there any way to turn on Boost module for front page only, with cache enabled for other pages.


texts: How to render a DS fieldgroup programmatically in a node template?

texts:
I am overriding a Display Suite view mode of a node using the template suggestion myLayout-node-myNode-full.tpl.php.

I am getting the $node->content using the node_build_content function. Then I have access and I am rendering all the node display fields using:

drupal_render($node->content['field_myField'])

But I cannot render fieldgroups using the drupal_render function, as it requires array parameter, but my fieldgroups are stdClass objects that can be accessed as:

$node->content['#groups']['group_myGroup']

Printing the $node variable, I do not get any other reference to fieldgroups, eg. $node->content['group_myGroup'] does not exist.

Any suggestions on how I could render fieldgroups in my template file in Drupal 7?


texts: How can I automate the "Clear Cache" everyday?

texts:
Currently we have to clear it manually everyday logging in to admin console and browsing to Home->Administration->Configuration->Development->Performance

Is there way we can automate this job in Drupal 8. We tried with "cron", but that didn't help.


texts: How can I use the MySQL FIELD() function within a SelectQuery object in Views?

texts:
I want to use the MySQL FIELD() function to alter a query so that it orders a particular field on a particular order of keys.

The keys for this 'select' field are: active, under_contract, sold

I want to sort the View so that all of my results are sorted first by node.created DESC (this is simple, of course) and then push all sold nodes to the very bottom of the result.

I tried doing this first in hook_views_post_execute():

function mymodule_views_post_execute(&$view) {
  if ($view->name == 'my_view') {
    usort($view->result, function($a, $b) {
      return ($a->field_field_status[0]['raw']['value'] == 'sold') ? 1 : -1;
    });
  }
}

but quickly discovered that, since my view only shows 25 results per page, this only pushes sold nodes to the bottom of each page.

Next, I tried to use hook_views_query_alter() to add the awesome MySQL FIELD() function that I just discovered – which works to achieve my goal perfectly in MySQL - but can't be added (at least as I'm discovering) to a SelectQuery object, which Views uses to run the query:

function mymodule_views_query_alter(&$view, &$query) {
  if ($view->name == 'my_view') {
    $query->orderby[0] = array(
      'field' => " FIELD(field_data_field_status.field_status_value, 'sold') ",
      'direction' => 'DESC',
  );
  }
}

How can I add a FIELD() orderby function to this query? Is there another method to push a particular filter value to the bottom of the result queue?


texts: How to configure the Answers module to organize questions by product subpages?

texts:
I want to use a question and answer system for different subpages. I have many products and on each product page should be a question and answer system. The "Answers" module is good, but I can only configure it for general use. Users can see all questions and answers there.

I want to configure it so that they can only see questions and answers to the specific product (subpage), like these relative paths:

/category/product1/question1
/category/product1/question2
/category/product2/question1

How can I configure the Answers module to get this result?


texts: How to use the admin theme for webform email

texts:
I would like my html e-mails that are sent after a webform is submitted to use my admin theme. I tried using htmlmail module but that did not work.

Thanks for any assistance.


texts: Automated login with LDAP always returns error

texts:
I have successfully setup LDAP module to authenticate users (and create new users). This is done through manual login form. Now I'm trying to enable automated single sign-on, but with no luck.

I have enabled LDAP SSO, and selected Turn on automated single sign-on.

On IIS, I've enabled Windows Authentication (Anonymous is still enabled).

I do not get automatically logged in, it returns error msg "You were not authenticated by the server. You may log in with your credentials below".

What else needs to be configured in a Windows environment to enable SSO?

Does anyone have any insight on what the reference info is talking about, when the say "This requires that you have operational NTLM or Kerberos authentication turned on for at least the path /user/login/sso, or for the whole domain" ? Other than looking at Windows Authentication on IIS, enabled providers = NTLM, what else needs configuring?


texts: Strange problem with enabling/disabling modules

texts:
I just moved my Drupal 7 site over from one host to another. At first, everything seemed to be working just fine, but I keep getting this strange problem when dealing with modules.

The installation appears to go without a hitch, and it shows up in the modules list. It also shows up under the correct path in /sites/all/modules/$modulename. However, the problem I get is two-fold:

Attempting to go to the configuration page for the module does virtually nothing. It just takes me to the related menu for whatever admin category that particular module falls into. (For example, Disqus would take you to Web Services rather than a Disqus configuration panel).
Disabling the module doesn't remove it from the configuration menus, either. I've tried running cron, flushing my caches, and even using the registry_rebuild scripts.

This also affects my themes now. I can't seem to get any of my new themes to appear in the directory when I upload them into my /sites/all/themes/ directory. I can remove themes manually, and they disappear at least. But, as you can imagine this is all a very frustrating problem. I think it may possibly be a permissions error, but frankly I really have no idea.


texts:
I have installed the Poll module in Drupal 8. I need to add a field to it, such as a text area for the poll description.

How can I add a field to a content entity like Poll, which is not a content type?


texts: How to debug a variable in a controller class (var_dump)

texts:
I am trying to do a var dump from a Drupal 8 Controller class. This is not working because controllers need to send a response. I just need to see the contents of a variable and I have not idea how to do this since I've tried all response combinations and can't seem to get it working.

This is my variable.

$storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $storage->load($rep_id);

I am trying to var_dump($node) to see what's in it. Can anyone help?


texts: Programmatically render a custom form in a view template while passing view argument to form

texts:
I have built a custom form (in its own module using FORM API) and have exposed this form also as a block using Plugin API.

I can add this form fine to page and get it to render using Block Layout but it doesnt appear in the correct place.

I am trying to get it to appear in the main page content of a Page View which has a Header and Footer. The form seems to appear after the footer content, even after shifting the block around in the block layout.

So now I have been trying to use the various view template hooks by loading the form via the snippet:

$block = \Drupal\block\Entity\Block::load('auctioncataloguerequestform');
$block_content = \Drupal::entityTypeManager()
    ->getViewBuilder('block')
    ->view($block);
$variables['form_auction_cat_request'] = $block_content;

auctioncataloguerequestform is the machine name of the "form block" added to Block Layouts (Its in the content section, but disabled)

But in XDebug I cannot find the form_auction_cat_request variable and {{ form_auction_cat_request }} renders nothing.

Hooks I tried using where: template_preprocess_views_view, template_preprocess_views_view_field and template_preprocess_views_view_unformatted

At the moment I am simply trying to get the form to render but once this is done I then need to pass a string variable which is a field of the view in question to be passed to the form.

Am I on the right track or completely missing the mark?

View screenshot


texts: How to validate a value against an existing field

texts:
I'm doing some custom stuff with programmatically saving fields with EMW:

$wrapper->my_field->set('my_value');

Problem is, this doesn't validate before trying to save the field. How can I validate the value against the field before trying to save it?


texts: How to fire an Event on node publish on Drupal 8

texts:
I am trying to figure out how to fire an event when a node type gets published so I can set up a listener to listen to that event.

Can someone explain what is the best practice and how to fire an event when a Node gets published?
Do I need to listen to EntityTypeEvents::UPDATE and check it there?


texts: How to escape single quote from a token to use it in SQL query?

texts:
Working on Drupal 7.54

I am using a custom PHP/SQL Rules to synchronize Drupal field values with an external database.

I am trying to export a text field value but sometimes I have single quotes in these values.

Consequently, when I try to use a field token in my SQL query, it fails because of this single quote that is not escaped.

I have read a few things about replacing strings and escaping quotes but I did not manage to get my query working (replace? str_replace? addslashes? htmlspecialchars? decode_entities?...).

Here is an example :

Let's say I have a Drupal field called "Text-Drupal" in a content type A.

Each time a content of type A is updated, I need to export the Text-Drupal value in an external database in the column text_database

The little code :

db_set_active('database_local');
db_query("UPDATE table
SET text_database=NULLIF('[node:field-text-drupal]','')
WHERE title=[node:title]");
db_set_active();

This code works fine with any text without special characters but each time I have a single quote, it fails (and I guess it would be the same with double quotes).

I am quite sure this is something really simple for experienced users so I hope someone could point me to the right direction. Thanks.


texts:
I have an external file being loaded via template.php using the following code:

function digital_dots_preprocess_views_view(&$vars) {
  $view = $vars['view'];
  if($view->name == 'work') {
    drupal_add_js(drupal_get_path('theme', 'digital_dots') . '/assets/scripts/fx.js');
  }
}

The JS file is being loaded with the following code:

(function ($) {
    $(".image-overlay").hide();
    //alert('It works!');
})( jQuery );

Un-commenting the alert will trigger the alert however the hide effect doesn't?

Very confused!


texts: Adding AJAX to drupal commerce checkout pane

texts:
I need to add dependable fields to Drupal Commerce checkout. I wrote my own module to do this but AJAX seems to not work.
Here is the code of my module:

function moje_panele_pane_checkout_form($form, &$form_state) {
  //parent item
  $form['sposob_dostawy'] = array(
    '#type' => 'select',
    '#title' => t('Wybierz sposób dostawy'),
    '#options' => array(
      0 => t('Kurier'),
      1 => t('Odbiór osobisty'),
    ),
    '#ajax' => array(
    'callback' => 'my_checkout_ajax_callback',
    'wrapper' => 'dane-do-odbioru',
      'method' => 'replace',
      'effect' => 'fade',
    ),
  );
  //child markup
  $form['dane_do_odbioru'] = array(
    '#title' => t("Dane do odbioru"),
    '#prefix' => '
',
    '#suffix' => '
',
    '#type' => 'markup',
  );
  //dependent field
  if ($form_state['values']['moje_panele_pane']['sposob_dostawy'] == 1) {
    $form['dane_do_odbioru'] = array(
      '#title' => t("Dane do odbioru"),
      '#prefix' => '
',
      '#suffix' => '
',
      '#type' => 'fieldset',
    );
    $form['dane_do_odbioru']['imie'] = array(
      '#type' => 'textfield',
      '#title' => t('Imię'),
      '#size' => 60,
      '#maxlength' => 128,
      '#required' => TRUE,
    );
  return $form;
}

//my AJAX callback
function my_checkout_ajax_callback($form, $form_state) {
  return $form['dane_do_odbioru'];
}

The above code works fine on normal Drupal page, but I cannot make it work on checkout page as a pane.

What am I doing wrong?