texts:
I'm moving some existing functionality into a new Drupal site.

Files are uploaded via posted form
Their file names are prefixes with UID
They are then moved to temp holding directory
A cron job on another server SCPs the files in batches
The files are verified copied, then deleted via batch ssh command

I'm looking for a clean way to handle (save) an uploaded file coming from a submitted form with an element of type 'file' without "managing" it. I've browsed over file_save_upload() and like the validation/error handling it offers.

However, I'd rather not have the files exist in the managed file tables. I would need to modify my pulling server's cron job to trigger a managed deletes via web request.

Just as there is a file_save_data() and analogous file_unmanaged_save_data() I'm looking for file_unmanaged_save_upload(). I basically want the first half of file_save_upload() before it touch the database. It seems like something similar or a workaround should already exist but I haven't found one. I trying to avoid reinventing the wheel.


texts:
I want to connect to external database:

$old_database = array (
        'default' =>    array (
                'database' => 'grantexpert_registration',
                'username' => 'grantexpert_usr',
                'password' => 'xxxxxx',
                'host' => '62.168.127.59',
                'port' => '5432',
                'driver' => 'pgsql',
                'prefix' => '',
        ),
);

Database::addConnectionInfo('olddatabase', 'default', $old_database);
db_set_active('olddatabase');

But Im getting an error:

  Driver not specified for this database connection: olddatabase in Database::openConnection()

All the examples show exactly this structure of array, but it's not working. Is smoething wrong here?


texts: Views will not use pathauto URL Alias when listing programatically saved nodes

texts:
I am programatically saving nodes, and everything is working fine. Pathauto is working correctly as well and generating aliases based on my url alias configurations.

However, when Views creates a list of the new nodes, it uses node/xx instead of the existing url alias.  Anyone know why this could be happening? All caches have been cleared, cron ran, etc. Here is the code

$node = new stdClass();
    //set other defaults
    node_object_prepare($node);

    $node->type = $page_data['content_type'];
    $node->body[LANGUAGE_NONE][0]['value'] = $page_data['description'];
    $node->body[LANGUAGE_NONE][0]['summary'] = text_summary($page_data['description']);
    $node->body[LANGUAGE_NONE][0]['format']  = 'filtered_html';
    $node->title = $page_data['title'];
    $node->field_product_price[LANGUAGE_NONE][0]['value'] = $page_data['price'];
    $node->field_item_location[LANGUAGE_NONE][0]['postal_code'] = $page_data['zipcode'];
    $node->uid = "1";
    $node->status = 1;
    $node->active = 1;
    $node->pathauto_perform_alias = TRUE;

$node->field_product_images[LANGUAGE_NONE] = $images;
unset($images);

$node->field_baby_clothes_category[LANGUAGE_NONE][0]['tid'] = $page_data['category'];

if($node = node_submit($node)) { // Prepare node for saving
    node_save($node);
}

note - when I add the same information through the content type form everthing works fine. It's almost as if my code is missing something that helps connect it to views.


texts: is it possible to edit default output of services module?

texts:
Is it possible to edit/customize the default output we get using Services Module ?

For example I want to edit output which I get from this URL : http://example.com/api/node/39

And I want to edit output of this URL : http://example.com/api/user/39

OR is there any way to create a View for single user profile ?


texts: How can I have a URL like www.example.com/about?language=ja to set Japanese for the page?

texts:
I've enabled the Locale and Content Translation module but am having trouble understanding how to do something that it seems should be working.

Basically I have a page, we'll say '/about' and it's in English.

I click translate, I have a few languages enabled, so I click to add translation for Japanese. It brings up the interface for making a new page. I change some stuff to Japanese, and set the URL alias to be /about ('about') like the english page.

I've setup my language options to use the "Session" detection method.

The result I'm wanting to achieve, but not getting is to have:

www.example.com/about -- to go to english (this works)
www.example.com/about?language=ja -- to go to the Japanese translation, this does not work, it just loads up the English page.

It seems like this would be the normal functionality so I feel like I'm missing something here.


texts: Dynamic text on My Account link to include user's name

texts:
I'm using a Commerce Kickstart 2 profile and I'd like the "My Account" link at the top to include the name or email of the user who is currently logged in. Right now it says My account but I'd like it to be something like My Account (bob@gmail.com).

Similar to the way the admin menu shows my name in the top right "Hello Kenny Wyland", is there a way to do that with the My account link?

I know that menus are static and cached, so I can't use them directly, but what is a standard way of providing that kind of personalized account menu link?


texts: How is the file data in the database table file_usage created and managed?

texts:
I am deleting orphaned image files in Drupal 7, but I have to first cross reference them to other tables that might be using the images. Given that I don't upload any images via the IMCE editor interface and mainly do uploads via the image module, would it be safe to say i can cross reference the table file_managed and image_dimensions to file_usage and delete what's not there?

Right now I'm just wondering how file_usage is populated. Is it populated every time I upload any file type?


texts:
I'm using Drupal, and I'm having this weird issue with it. Multiple times in a day certain settings reset themselves temporarily. When I clear the cache, the issue is fixed for a while, but then I'll get an email from a confused client as to why the Meta tags are all of a sudden back to what they were before we updated them. This specific situation has happened about 4 times now on the same site.

Relatedly, Superfish's Supposition plugin was causing issues so I kept disabling it, only for supposition to automatically re-enable itself after a little while.

The strange thing is that I've used Drupal for other stuff, and I've never had that sort of problem.

I am using Memcached (1.4.4) with the Memcache Module for Drupal (7.x-1.0). Libmemcached version is 0.31 and the PECL extension version is 1.0.0, if that makes any difference. It's the only site which uses this.

Has anyone ever encountered this before? Any amount of help or advice would be greatly appreciated.


texts: How to programmatically set the user timezone

texts:
I am programmatically creating a user and wanted to assign a timezone for the user

I am able to successfully create a user by the following code

$user = \Drupal\user\Entity\User::create();
$user->setPassword('1233455');
$user->enforceIsNew();
$user->setEmail($item['Home - Email']);
$user->setUsername($item['First Name']);

How do I assign the timezone?


texts: See all nodes where user profile entity reference matches the same entity reference on the node

texts:
I have the Profile 2 module where a user selects a zip code (which is an entity reference to the content type ZipCode)

The ZipCode content type has an entity reference to a Region content type.

Finally, there is a content type called Schools which has an entity reference to the ZipCode content type.

I would like to display all schools that match the region of the logged in user. Logically this means finding the user's region, and then all schools with the same region, through the zip code...

I can't for the life of me figure out how to do this. Any help would be appreciated.


texts: Rules - After updating / saving user not working

texts:
I'm using Rules module to execute a python script after a user has been created / updated. This python script retrieves information of users from the database and feeds a datapushing / realtime data engine.

Everything works perfect, BUT, the script is executing before saving.

Update regarding 'script is executing before saving'

When I get the information from the DB with the python script is the one I have before saving, the only workaround is saving twice. One to make changes, to second one to 'really' update. I've noticed this because I need to save twice to get real information.

I found this issue: http://drupal.org/node/430274

I thought on running the script in Drupal's User Core but good practices kind of don't let me do it ( for now :) )

Update

I created a Module with this Info

<?php
// $Id: infographic.module

/**
* @file
* Custom functions for this site.
*/
function infographic_user_insert(&$edit, $account, $category) {
    exec('python GenerateInfographic.py');
}

function infographic_user_update(&$edit, $account, $category) {
    exec('python GenerateInfographic.py');
}

Any Suggestion!?

Thanks!


texts:
Is there any solution on how theme the taxonomy term page per depth? Though this is doable with Views + TVI, we don't usually allow admin to manage TVI, but they're able to add new term and they're allowed to rearrange the terms. I would like that each depth has a different layout, but automatically changing based from its depth. This can done through hooks or how to achieve this in views?

For instance:

if ($depth == 0) {
  print $views_0;
}
elseif ($depth == 1) {
  print $views_1;
}
elseif ($depth == 2) {
  print $views_2;
}
else {
  print $views_default;
}

and so on...


texts: How can I set default value (prepopulate) for field in views exposed filter?

texts:
I've tried to use solution from Can I prepopulate an exposed filter text field? but failed. Cache clearing does not help.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == "views_exposed_form" && $form['#id'] == "views-exposed-form-test-populate-page" ) {
    $form['title']['#default_value'] = 'test title';
    dpm($form);
  }
}


texts: Can I set a cron for deleting and re-indexing Search API daily?

texts:
Using Commerce Kickstart 2.

When we add new products, the facet search index does not re-index automatically as it says it does (Maybe because we are using some Aggregated Fields?) -Whatever-, we have to re-build the index manually to get certain search fields to work.

I read a bit and it -seems- as though the standard cron tasks -should- add to the index, but that ain't happening.

So: Is there a way to create an 'Re-build Index' to a list of nightly Cron jobs?


texts: Creating Views rows with specific classes?

texts:
I have created a view and it gives me lots of default css classes for the rows of my unformatted list. I have added the token [type] in the style options for the page under 'Row class'. So now my list items are wrapped in the following div:

You can see the class 'article' is added according to the node's content type. But, I need to give specific rows, like the third occurence of class 'article' row, their own 'static' unique css classes, like:

views-row-[number] will not do because it changes depending on how many rows there are in the view (not always the same in this view) i.e. the third from last row will sometimes be views-row-10, sometimes it will be views-row-13. How do I find out what other tokens are available to me (I'm looking for ones that will create unique classes), or is there another way that I can create a unique, unchanging, class?

I have tried using pseudo css classes to target the desired rows, like :nth-of-type(N).

Solution

To make classes unique, append an incrementing number to the required classes with jQuery. CSS pseudo class selectors are helpful too, as are tokens. There does not seem to be one solution that will fit every situation: a mix of approaches is required.

Add to template.php in your theme's root folder (or how ever you want to implement your jQuery):

/**
 * Implements template_preprocess_views_view().
 */
function YOURTHEME_preprocess_views_view(&$vars) {
    $view = $vars['view'];
    if ($view->name == 'VIEWNAME') {
        drupal_add_js('
            (function($) {
                $(function() {
                    $("div.article").removeClass("article").addClass(function(index) {
                        return "article-" + index;
                    });
                });
            })(jQuery);
        ', 'inline');
    }
}


texts: Prevent output of control code characters in Views Data Export

texts:
I've recently experienced a problem where by users have entered control code characters into Long text fields. Specifically the ASCII codes \001, \007, \008, \021 (codes for Start Of Heading, Bell, Backspace, Device control 1) which are causing havoc in my XML exports since they are not allowed by the XML standard and prevent the XML file from being parsed.

Therefore I would like to cleanse the output as it goes through Views Data Export to prevent bad characters from outputting. As commented below, this sounds like a bug in VDE, however I'm wondering whether I can tackle this issue easily with my own views hooks rather than wait for a new version/patch?


texts: Prepopulate a field using bookmarklet in Drupal 7

texts:
I am trying to autofill a field using prepopulate module and custom bookmarklet. The field's name is "field_source" and I want to populate it with the page's url. The existing code found in help.txt is

javascript:u=document.location.href;t=document.title;s=window.getSelection() void(window.open(%22http://example.com/node/add/article?edit[title]=%22+escape(t)+'&edit[body][und][0][value]='+escape(s)+'&edit[field_url][0][value]='+escape(u),'_blank','width=1024,height=500,status=yes,resizable=yes,scrollbars=yes'));

I don't know javascript so I have no idea where to modify.


texts: Home page only page accessible, no login with clean urls

texts:
I'm trying to copy a live site to my windows development machine for some module testing and updates. I have a copy of the complete live site's codebase (entire drupal root from live server) and the the sql dump file for the live site.

I'm using Acquia's Dev Desktop, and I use the import local site option, point the installer to the correct files and sql dump. The issue is that the installation seems to fail, in that navigating to the site triggers the installation script, and my database name and settings are imported but the database itself is empty. I then imported the correct database manually and ran the update.php script, but then only my home page shows up. Any page that isn't the home page gives me a 404 error, and I can't use clean urls to login, ?q=user/login also gets me a 404.

I've checked the .htaccess file and it exists.

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

I don't think it would have to with my Apache settings because, that should all be taken care of by Acquia installer.

Where on the computer should the codebase folder be placed?

Is there anything special to how I should be copying the files?


texts: Panels Pane Content Added - Stacked, need Inline

texts: Hi I'm developing an Intranet in Open Atrium - Drupal 7. The distribution is heavy on Panels, so I am developing the Portal with them. However I have a Pane for one of the Panels and I want to upload 4/5 separate blocks into it. However the default behaviour is everything is stacked in the pane, and I would like to be able to control it so I can lay things out side by side, is there a way to do this within the Drupal System. At present I am using Negative Relative Positioning to move things where I want them. Then specifying a height for the body to get rid of the negative space it leaves - not ideal. I can't use Negative Margins because the company where the Intranet is uses a lot of IE7 and IE7 doesn't recognise negative margins.


texts: "managed_file" form field type returns null value in my form submission

texts:
I am have been struggling with this for the past day or so. I am simply trying to create a custom entity and populate/or update the image field with the fid. Whats weird is that every other form field I am passing I can get the value for but this managed_file field for uploading an image always returns NULL when I call dpm().

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\file\Entity\File;

Within my form_build function, I use the following code.

// Manage file.
$form['theimage'] = array(
  '#type' => 'managed_file',
  '#title' => 'Managed file',
  '#description' => $this->t('Manage file, #type = managed_file'),
  //'#default_value' => $form_state->getValue('theimage'),
  '#upload_location' => 'public://images/',
  '#required' => FALSE,
);

In the submission handler, I use the following code.

// Get the fid value, upload it and save it to the managed file table.
$fid = $form_state->getValue(['theimage', 0]);
dpm($fid);
if (!empty($fid)) {
  $file = File::load($fid);
  $file->setPermanent();
  $file->save();
}

Any thoughts, solutions, or recommendations would be greatly appreciated.


texts: Rule: Auto Menu link for child via entity reference

texts:
I have child nodes which are assigned to the entity reference of the parents. I want to create a rule which assigns the child node menu items to the parent node menu link. I have many parent nodes, so the rule should be dynamic for every category (parent).

I created a rule with the following settings.

Event: After saving new content of type
Conditions: Nothing
Action: Create a menu item for node

In the 'Action' I do not know which "Data selector" to choose from. I think that I must choose my entity reference field "node:field-reference:menu-link:mlid", but it does not work. I do not know what the Data selector should be. It is stated that the data type should be text, but "node:field-reference:menu-link:title" or "node:field-reference:menu-link:url" do not work either.
Apart from that I am using the default settings of the action.

For testing purpose: The rule works when I manually set a menu parent item via drop down, but that is not dynamic for every category.

How can I create the rule to get a menu link for the child nodes via entity reference?


texts: Should I use different content types or tags?

texts:
I am working on my first Drupal site and I am worried about building things that will cause me trouble down the road.

The site is a move from a custom CMS to something more manageable. I didn't build the old CMS either.

I have several items under labels like news, press release, announcements, etc. As I'm building out the content types I realize they could all be the same thing except they are considered something different by end users.

Would something like this be a candidate for separate content types or one content type and I could tag each piece of content as "news" or "press release" etc. ?

I'm hoping I can learn from someone else's mistake and get some hindsight on the topic.


texts: Preprocessing function for specific view by name

texts:
I'm using drupal 7.29 . I'm trying to write the preprocess function for a specific view named front-page. I have written the following functions in my template.php file:

function bartik_sub_preprocess_views_view__front_page(&$variables) {

  kpr($variables);
}

The function for preprocessing view works normally (without the __front_page at the end), but the above function isn't being called. I did create the corresponding .tpl.php (views-view--front-page.tpl.php) file which is used  but the function still isn't being called. I watched a couple of tutorials where the preprocessing function for a specific view was written like this and it worked,  any ideas why this isn't working?


texts: Tiered HTML lists using Views and Taxonomy?

texts:
I would like Views to output an HTML unordered list of a certain vocabulary (Taxonomy Term). This is not a problem... the problem is that the list is rendered flat, instead of showing the parent>children relationships contained in the vocabulary.

How to I get Views to render this:

  Parent

  Child
  Child

  Parent

Instead of:

  Parent
  Child
  Child
  Parent


texts: 8 - How to Get Values From $variables hook_preprocess_commerce_order_receipt?

texts:
So thankful for all the help on here, but still so baffled as to how Im not able to just quickly determine how to pull these values out of certain arrays and objects.

Trying to get the order id (and other values) from the frickin $variables array in hook_preprocess_hook

Code
afc.theme

function afc_preprocess_commerce_order_receipt(&$variables) {
  dpm($variables['order_entity']);
  \Drupal::logger('afc_theme')->notice('running');
}

Some of the Output

stdClass Object
(
    [__CLASS__] => Drupal\commerce_order\Entity\Order
    [values:protected] => Array
        (
            [order_id] => Array
                (
                    [x-default] => 182
                )

            [type] => Array
                (
                    [x-default] => default
                )

            [uuid] => Array
                (
                    [x-default] => c8b1c210-0e6e-4efb-a59d-84b28d4dadfe
                )

            [order_number] => Array
                (
                    [x-default] =>
                )

            [store_id] => Array
                (
                    [x-default] => 1
                )

            [uid] => Array
                (
                    [x-default] => Array
                        (
                            [0] => Array
                                (
                                    [target_id] => 1
                                )

                        )

                )

Ive tried various wrong things like:

$variables['order_entity'] = $order;
dpm($order->get("order_id")->getValue());
dpm($variables->get("order_id")->getValue());
dpm($variables['order_entity']['order_id'];

1. How do I get the order_id from this $variables object?

2. How/where did you find this information telling you how to get this value out?


texts: sf Smallscreen menu button reverts to full desktop menu when scrolling down

texts:
To prevent my Superfish Main Menu from stacking as screen size decreases  - and thus obscuring the content below it, I set sf-Smallscreen to change the Superfish Main Menu to an accordion when the screen size scales down to 990px. This accommodates tablets in portrait orientation, for example.

Problem: When you scroll down on a tablet, the accordion "Button" reverts to the Desktop rendering of the Main Menu, "stacking up" because it's too wide for the narrow screen.

Scroll back up and the Desktop Main Menu is replaced by the accordion.

Question: How can make the accordion button persist when scrolling down on a tablet-sized screen?


texts: Views Slideshow Cycle doesn't re-initialize properly after an AJAX content update

texts:
I have a Views Slideshow on my site that works perfectly until I try to reload only part of the page (containing the slideshow among other stuff) via AJAX (using Ajax links API module). The content itself is reloaded properly but:

If the new content contains different blocks than the old content, I'm getting the following error:

Uncaught TypeError: Cannot set property 'targetId' of undefined

It's the following lines that cause the error:

var fullId = '#' + $(this).attr('id');
var settings = drupalSettings.viewsSlideshowCycle[fullId];
settings.targetId = '#' + $(fullId + " :first").attr('id');

An inspection of drupalSettings.viewsSlideshowCycle in Chrome DevTools shows that it doesn't contain the current block id ($(this).attr('id')) but contains the old block id, already gone, so drupalSettings.viewsSlideshowCycle[fullId] returns null. In other words, the AJAX-driven content update doesn't seem to update drupalSettings - is it supposed to? I checked the AJAX response and it contains correct settings but for some reason the script doesn't see them and uses the original settings that came with the initial page load.

If the new content has the same structure as the old one (same block name for the Views Slideshow) then I don't get the error and the slideshow sort of works but the slide counter shows funny numbers in funny sequence (like 6 of 2, then 2 of 2) and at funny times (not when the slides change but when they stand still too). It looks like there are two scripts running simultaneously interfering with each other.

I would expect the behaviors mechanism to somehow kill the old scripts and settings and replace them with new ones upon processing an AJAX response but it doesn't seem to happen and I can't find any documentation on this particular aspect.

Sorry for a possibly fuzzy description (must admit I don't know the inner workings of AJAX all too well) - will be happy to provide more info if needed!


texts:
I've added a comment field to my content type. Now I'd like to add infinite scroll to the comments messages, so it shows by default some number of comments and when I click on the load more button, it shows more.

The problem is that the list of comments is coming from the comment module, not a view, so I can't add infinite scroll plugin to the pager. If I create a custom view that shows the comments, it gets complicated because some comments have nested comments and so on. Is there any solution?


texts: Website encountered unexpected error - how to avoid?

texts:
I'm having that typical problem of Website encountered unexpected error popping up sometimes and then after repairing watchdog MySQL table it all works find again.

My question is if there is a module that would do this automatically? Or any script that I could run from cron or from drupal?

I installed db maintenance module and thought it does that, but apparently no.

Thank you!


texts: Programmatically validate required fields of node object

texts:
I want to know if a node object could pass the form submit.
With the UI, if required fields are missing, you can't save the node.

I would like to load the node object programmaticly, and check if all required fields are set. Is there a easy way to check that ?


texts: Allowed range for date input - down to the day level rather than the year level?

texts:
I am trying to set up a content review process for a client's site.

The desired process is this:

When users are adding content, they specify a "review date"

This date must be between today and today +365 days
A week before that date, send an email to users of a role letting them know

When I am setting up the date field, I've set "Starting year" and "Ending year" (in Field Settings -> More settings and values -> Date entry), however this doesn't behave as expected. It will let you set a date within calendar years, but not within a year of today. So I can make it work for any date in 2012, but not a specific day.

I'm fine with the rules + email bit, just the date field is holding me up.

I'm thinking it will be some custom JS, but am open to any approaches :-)


texts:
I am using Apache Solr on my website and the search form block is configured to use Apache Solr. I also use the Apache Solr panels module to panelize my page.

I create a panel on search/my-search/!query, when I use it manually all works fine but when I search via the form search block, I am redirected on the default Apache Solr result page (search/site/!query).

How can I change this behavior ?

EDIT :
Okay, I found the solution by searching a little bit more !

I just disabled the default search block form and put the "Search form (Apache Solr Panels)" in the section I wanted. I only have to restyling my input.

I will put it in a separate answer tomorrow (because of my reputation, I can't answer in the next 8hrs after posting my question)


texts:
I am trying to print each row with custom HTML. I need to display the image field wrapped inside the image link. I have this in the tow style output template:

        <a href="<?php print $fields['field_news_link']->content; ?>" target="_blank"><img src="<?php print $fields['field_news_image']->content; ?>" />

    <a href="<?php print $fields['field_news_link']->content; ?>"><?php print $fields['field_news_source']->content; ?> />

The link part is working, but the image does not display. In the HTML I get:

<img src="

On the front end, I see the broken image square and '/> directly after. What am I doing wrong?


texts: Limit total quantity of products across user's entire order history

texts:
I am trying to limit a user's total quantity of products across their entire order/purchase history based on a field on that product. For example, if Can of Peanuts has a limit of 3 per user, then the user should not be able to buy 3 then place another order for 3.

Does anyone have any recommendations for ways to accomplish this?


texts: Drupal Facets Block Show everywhere (in non search page)

texts:
I use facets search and work well but i want to show block everywhere in website please for your help.

I try to create new views with my search index and add facets block in views but i get wrong url ?f[0]=field_places%3A72


texts: How to enable plain text format for body in specific content type

texts:
I have one content type, where I want to restrict the body field to plain text only. In Drupal 7, there was an option to set the plain text format explicitly in field configuration; however in Drupal 8, there is no "plain text" option in the select box. I cannot change user permissions to text formats, because I want to have plain text for the administrator as well.

In Drupal 7:

In Drupal 8:

So please, how to force the plain text in body field? Do I have to create a new text format? If so, why such a nonsense (my desired text format already exists, but cannot be used)?

Thanks!


texts: How to add autocomplete to a textarea on a form?

texts:
I would like to add autocomplete functionality to a textarea form element in Drupal 8. I have a fully functioning custom textfield which has autocomplete working on the same form. I have confirmed that the Textarea element has the processAutocomplete function. Therefore, I'm uncertain as to why this wouldn't work.

I realize that adding an autocomplete to a textarea is a bit unorthodox, but that's not the question. I have seen this done in Drupal 8, so I know it's possible. I just don't know if they used a form to accomplish it.

I have added the appropriate code in the routing file:

my_module.autocomplete_name:
   path: '/my-module/test-autocomplete'
   defaults:
     _controller:'\Drupal\my_module\Controller\Controller::functionName'
     _format: json
   requirements:
     _access: 'TRUE'

I have also added the field appropriately on the form:

$form['text_area'] = [
  '#type' => 'textarea',
  '#title' => t('Test text area'),
  '#default_value' => $authentication_configuration->get('text_area'),
  '#autocomplete_route_name' => 'my_module.autocomplete_name',
];

Finally, I have the appropriate logic in the referenced controller:

public function testAutocomplete(request $request) {
  // Set up the array to be returned and get the user input
  $matches = array();
  $input = $request->query->get('q');
  // If there is user input
  if ($input) {
    $words = explode(' ', $input);
    foreach ($words as $word) {
      /*
       * Logic for generating an autocomplete list of matches
       */
    }
  }
  return new JsonResponse($matches);
}


texts:
I have a view (commerce line item) with HTML (or unformated) list with several fields.

On each field i unchecked "place a colon after the label" but it does not obey that rule.
So i added custom CSS to fields and its working.
Each label has "strong" html elemement and that is working fine too.

When the order is complete commerce sends email and results are:

Label:
field
Label:
field

instead of

Label: field

Label: field

html strong tag displays fine.

I have tried with HTMLmail and MimeMail with emogrifier installed.


texts: How to alter/hide the label of the input element in form (create/edit)?

texts:
We can theme the label of any field in tpl or even simply by changing the manage display option but wondering how to do the same in form (while creating or editing a content) ?

I'm looking for the proper way to alter/hide the label especially with field collection fields when the content is created or edited.


texts: How to allow users to edit the profile of users in the same department?

texts:
Department is a term reference or a list (text) field of the user entity. I want to let managers edit the profiles of users in the same department as the manager.

I know I should define a custom permission, but in which hook should I check this custom permission?


texts: Strange AJAX HTTP error, 302 redirect error after update and migration

texts:
I have a Drupal 7 site (ver 7.67) running on CloudWays, PHP 7.1, MySQL 5.5.

I get the AJAX error "An AJAX HTTP error occurred. HTTP Result Code: 302"
The debugging information is limited:

"Path: /admin/structure/views/some_view/preview/block/ajax"

This happens on editing any View (Views 7.x-3.23) or when creating content with any autocomplete field.

Seems like it should be something simple, that something wasn't migrated correctly and pointing not right.

I have looked through the server logs and the php logs and can't find anything to do with a redirect error other than the AJAX error.

Where do I look to fix this?

Thank you in advance.


texts: What is causing Unknown field error in EntityFieldQuery API?

texts:
I am attempting to use the entity-field-query API to see if any node of referee content type has custom field that equals x. I've looked at dozens of code examples and references. (Included below)

If it is relevant I am executing this code as a custom PHP action in Drupal rules.

My problem is when the code is executed I get the below error:

EntityFieldQueryException: Unknown field: field_referee_id in EntityFieldQuery->addFieldCon
dition() (line 817 of /home/scienceorg/public_html/includes/entity.inc).

(The field does exist on the referee content type.)

My code:

<?php
error_reporting(E_ALL);

$query = new EntityFieldQuery();
    $query
    ->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'referee')
    ->fieldCondition('field_referee_id', 'value', '1', '=');
    $result = $query->execute();
?>

Further information: If I remove the field condition line from the above code it works perfectly. So the problems seems to be around finding the field_referee_id.

Code references and examples

EntityFieldQuery condition

https://www.drupal.org/node/1343708

Alternative answer:
If you don't know what is causing the above problem I will accept alternative methods of achieving the same outcome as the correct answer.


texts:
I have a File field attached to my content type. Using Drupal, when we are creating new node, we use node form to set all field values for particular node. But is it possible to create more forms for editing one node? In particular, I need to setting File field values in separate page separated from node form.

For now, I do it with Form API, and hook_form_alter. For file field I can use form type "managed_file".
 But is it possible with some existing module, using GUI?
Could  I create separate form, where I can set just one (or few) fields of node (or entity, in general)?

EDIT: to explain it shortly. I would like to split node form to more forms. I would be able to set, which node fields would be set in which form.


texts: How to integrate ckeditor plugin with WYSIWYG module

texts:
I want to use http://ckeditor.com/demo#table-resizer addon for my drupal site which uses WYSIWYG drupal module and "CKEditor" as its editor.

I have tried using hook_wysiwyg_plugin() hook but I am not able to get it working.
Following is my code for the plugin hook.

function mymodule_wysiwyg_plugin($editor, $version) {
  switch ($editor) {
    case 'ckeditor':
      return array(
        'tableresize' => array(
          'path' => drupal_get_path('module', 'mymodule') . '/plugins/tableresize',
          'filename' => 'plugin.js',
          'load' => TRUE,
        ),
      );
      break;
    }
}

In the code above, plugin.js is the javascript addon file from CKEditor.

Any help will be appreciated.


texts: How to add 1 product attached to another product based on variation?

texts: Hi I'm currently managing an online store that sells cellphones and plans, however I'm not sure how to get the product of security deposit to attach to the plan selected from the phone product.


texts: How to alter inline entity form fields on node edit drupal

texts:
I want to hide some fields of product reference on node edit. My purpose is to unset or set access to false for colors or price field of line item included in node as inline entity from in a content type. I am using hook as

$form_state){
dsm($entity_form);
unset($entity_form['field_product_colors']); // remove "colors" field from inline entity form
 }

but hook is not called at this screen when user edit a product on node edit i have shared a node edit screen where product is edited by click on edit link and then update some thing but dont want colors and price to be shown there


texts: Count nodes that referenced current node in VIews

texts: How do I count how many nodes have referenced the current node In Views?


texts: "Add another" for many fields together, but collapsible

texts: I need to collect information about multiple people - an unlimited number. So this means I need an "Add another" capability. [Think Field Collection or Paragraphs.] The only element I see that has the ability is the "Custom Composite." That works for collecting the data, but I really don't want to see a page worth of data on the first nine people as I am entering the tenth. Is there any way to make this custom composite also collapsible like "Details" is?


texts: How do I override/theme Views REST Export display field?

texts:
I have a REST Export view display setup in Drupal 8, delivering node fields.

The challenge: I want to theme/tweak/alter the output of JSON or HAL_JSON for and image field. Currently, it's rendering this in JSON:

"field_feature_image":"  \n\n<\/a>\n"

I would prefer it to look like this (taking out all the HTML):

"field_feature_image":"http:\/\/mysite.com\/app\/sites\/default\/files\/images\/feature\/huygens.jpg"

Where's the best place to start? I don't see any views theme options when specifying a REST Export display. Should I create a module of some sort? Is there a theme option?


texts:
EDIT: I need to alter the settings of an entity reference field for administrators only. I need to change from the settings in the first image, to the settings in the second image.

The reasoning is that normally when creating content, I want users to select from the options available in the view. The options in the view are the "Bands" (a content type) that each individual user has created. However, if an admin needs to moderate the content, they are not allowed to save it after editing because the content of the field is not an option available to the admin (i.e. the band entered by the original user, and currently saved to the entity reference field, is not a band created by the admin and is therefore not an option in the admin's array). On save by an admin, it fails to save and throws an error of "The referenced entity (node: XXX) is invalid", staying on the edit page.

I tried changing $form_state through hook_form_alter, but apparently $form_state settings aren't saved on submission. So, I tried adding the alters to a validation function, which also didn't work for me. Then, I found the settings within $context of hook_field_widget_properties_alter, but it seems that $context can only be referenced and not altered. I also came across this post, which seems to state that there isn't really a hook for altering field settings.

Unfortunately, I have realized that I really need this feature in order to moderate my site. As always, any help is incredibly appreciated, as this issue seems to be beyond my abilities.

Here's some screenshots as requested by Minty:

Casual user's options, populated by the view, include only their own bands

What I want in the admin's options, which should be all the bands authored by all users. (note that it currently shows all bands, because I figured out how to do contextual filter in the view based on the current user, not because I was able to alter the field settings as asked by the issue):

Without the above fix, only the admin's bands appear in the list when editing a node. Therefore, as stated in the issue, it throws an error that the previously saved band is not a valid option for the field, and the node cannot be saved.


texts: hook_pathauto_alias_alter() on bulk update

texts:
EDIT: I've found out that this question doesn't make sense.
The problem isn't that the hook is not called during the bulk_update.
The problem is that the code generates unexpected aliases because of the "variable_set" request, which led me to think that the hook wasn't called.
See my answer for the correct code to programmatically set alias patterns.

I have created a function to alter the alias for a particular content type when certain conditions are met, using the following code:

function HOOK_pathauto_alias_alter(&$alias, array &$context) {

   if(isset($context['data']['node']->field_myfield['und']))
       variable_set('pathauto_node_contentype_pattern', 'something/[node:title]');
}

The problem is, when I create a node and save it, it works, but when i try to bulk update the aliases, it doesn't, and the default pattern set from the GUI is used instead.


texts: Override Access Permissions from View in Drupal 6

texts:
I have a ticket node that can only be accessed by the creator, or an administrator. I would like to display select fields from the ticket to other users in a view.

The problem is that, since the other users do not have access to the ticket node, the entries do not appear in the view.

How can I restrict access to the full ticket, but display selected fields from that ticket in a new view?


texts: global $language not working in custom module

texts:
I have a custom module which I want to check the language code of the current interface language, So I added a helper function to the mymodule.module file.

It didn't work in mymodule when I call it, It returned nothing. But If I added this function to my template.php in the mytheme directory it works like a charm and return the language code for the current interface.

I am guesting that its related to the current weight of the module in the system table, What do you think?

function language_code(){
  global $language;
  return $language->language;
}

For additional debugging I used dpm($language); after defining global $language; in mymodule it didn't return the language array.


texts:
I know this question was asked so many times but I read all the answers and I didn't find any solution working for me, so I'm looking for help. I have done the following to try resolve it:

Checked if the site address is set up properly
Downloaded the SMTP module

Configured the module to my Gmail account
I was getting the unable to send email error here unless I checked the "Send mail by queue box (I am not sure what this does, but the error message disappeared.)
When I send a test email to my Gmail address I'm not getting it (I checked spam and it's not there)

I have then moved on and downloaded the phpmailer library and extracted it into my sites/all/libraries folder (I even tried putting it in the smtp folder as I read about that somewhere) but still not working

I configured the phpmailer with my smtp module and when I tried to send a test email from phpmailer I'm not receiving that either.

I checked emails are sent when a user registers or forgets the password, and emails aren't sent in those cases either. Drupal is not sending out emails.
I then moved on to check my logs and all the attempts are in red:

I am new to Drupal; I am not sure what they mean.

Is there anything else I can try?

This is just a test site so I have it on my localhost.

When I click on the error this is the information that is showing:


texts: Customize what fields show on Views Exposed Filters Block

texts:
I have configured an exposed form block, filtering by taxonomy list. What I need to do is simply display a field image before the taxonomy name. The actual display is  <Taxonomy Term Name> and what I need is <Taxonomy Term Logo> <Taxonomy Term Image>. I have looked on some places, but I couldn't get anything to work.

How can I achieve this?


texts: Table names without using curly brackets

texts:
I'm working in a project in Drupal6 and we are removing all the curly brackets from the table names in the queries because we don't need table prefixes and supposedly this will improve performance.

Is this reasoning correct or curly brackets should be used even if we don't need table prefixing?


texts:
I have defined a paragraph type that has a text field and an image field. At the moment the twig template is something like this

{{ content.field_text }}

{{ content.field_image }}

The problem is I want to alternate the positions of the text & image containers for each paragraph. For example the first one would have text then the image, the next would have the image then the text and so on.

How do I get the paragraph template to be aware of its order in the list? If I use a preprocess function how do I get the order than pass the value as a variable to Twig?


texts: Block View - Most Time Consuming - Optimise

texts:
I have a block view showing the title and thumbnail of an amazon store item (from the Amazon Store module).  According to New Relic tool it shows that this block view is the most time consuming (1050sec).  As you can see from the settings I've put on caching, but it doesnt improve the performance.  Any advise?

Here is the sql:

SELECT amazon_item_image.url AS amazon_item_image_url, amazon_item_image.height AS amazon_item_image_height, amazon_item_image.width AS amazon_item_image_width, amazon_item.detailpageurl AS amazon_item_detailpageurl, amazon_item_image.asin AS amazon_item_image_asin, amazon_item.title AS amazon_item_title, amazon_item.asin AS asin
FROM
{amazon_item} amazon_item
LEFT JOIN {amazon_item_image} amazon_item_image ON amazon_item.asin = amazon_item_image.asin AND amazon_item_image.size = 'mediumimage'
WHERE (( (amazon_item.asin LIKE '1846680972' ESCAPE '\\') ))
LIMIT 1 OFFSET 0

Here are my settings:


texts: How to debug what module/process is requesting a file?

texts: I moved my drupal 6 site to server with php 5.5 and the site started to throw not found error -  sites/all/libraries/jquery.ui/themes/base/jquery-ui.css on every page. I have not installed any new module and the file was never on that location. How would be possible to debug this? Thank you.


texts: Is there any way of removing (or unflagging) all of a user's flags?

texts: I have a situation where a privileged user (role that is purchased) can flag content and receive email notifications to comments posted. When the role is expired, I need for them to stop receiving these emails. Is there any way (possibly using rules) to unflag all of the content they have flagged? Or is there another approach I should be taking?


texts: Programmatically check the checkbox of an exposed filter

texts:
I need to check a checkbox on an exposed filter for a view based on the url. I can't seem to figure out how to do that. If x is detected in the url, I want to set one of the fields of an exposed filter to have the status checked="checked." It seems like that would be pretty easy, but I can't seem to figure it out.

I have tried various ways through:

hook_views_pre_view()
hook_views_pre_build()
hook_form_views_exposed_form_alter() (I feel like this should be the best way.)

I've found that I can effectively alter the results through hook_views_pre_view(), but I can't figure out how to check that freaking checkbox on the exposed filter.

Varioush failed attempts via hook_form_alter():

$form["field_intended_use_target_id"]["#default_value"] = ['357'];
$form_state->input["field_intended_use_target_id"][356] = '356';
$form['field_intended_use_target_id']['widget'][0]['value']['#default_value'] = ['357'];

Can anyone please help?


texts: Can I add CSS to a YAML generated page ?

texts:
(Sorry if that's Drupal 101, but I'm still at the very bottom of the learning curve ..)

I have a custom module, with a routing file that redirects to a path that I have chosen arbitrarily :

grefsearch:
  path: 'solr-search/content'
  defaults:
    _controller: '\Drupal\gref\Controller\GrefSearchController::search'
  requirements:
    _permission: 'use gref search'

I have another YAML config which describes the View that must be rendered when accessing to solr-search/content :

langcode: en
status: true
dependencies:
...
page_1:
    display_plugin: page
    id: page_1
    display_title: Page
    position: 1
    display_options:
      display_extenders: {  }
      path: solr-search/content
      cache:
        type: none
      defaults:
        cache: false
    cache_metadata:
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - url.query_args
      cacheable: false
      max-age: -1
      tags:
        - 'config:field.storage.node.body'

Since the page is completely YAML-based, I do not have a Twig template that is linked to it, and because of that, I cannot use hooks like template_preprocess_page because I cannot name the function properly.

I'm a bit lost. Should I change the structure I have, and render the page in a Twig template anyway ?
Thanks !


texts: How to see if there is a hidden admin role with an account that has no admin access?

texts:
I'm completely new to Drupal. A friend has asked me to help out with his Drupal 7 site. He created an account for me - but I'm thinking that the role given to my user account isn't really an admin account. When logging in, I don't see any way to administer modules, user permissions, etc.

I'm thinking that the admin role is hidden. For a person who is just now learning Drupal, what would be the easiest way to see if there is a hidden admin role?


texts: How do I substitute a field file input type in node create/edit?

texts: I have a field image called "getFromFlickr". Via hook_field_widget_info(), I create a piece of form that (when in edit/create node), build a modal, call flickR, get one image, save the file in the database with system_retrieve_file(), and finally I have a standard file stdClass object. How can I get its FID and put it in the original image field  "getFromFlickr"?


texts:
I am using the published date module.

The posted date, and published date are the same for the nodes. Does anyone know any reason why that is so?


texts: Optimize CSS & JS breaks IE & FireFox (All Themes)

texts:
Problem
Theme is not showing properly on my production server for individuals using Internet Explorer & Firefox after setting the CSS & JS Optimization options to enabled.  I initially thought the theme was broken for IE, however upon further review I realize the reason IE didn't work while CSS/JS optimization was disabled is because of Internet Explorer not handling more than 31 CSS files.

  To Help with troubleshooting I used the Site Documentation module to get all the info on the site, modules, etc. Here is the link to it.

Drupal Core: 6.22
Theme: 0 Point, Zen, Tao, PixtureReloaded

It is not a multi-site installation
It is on the same web hosting account as 3 other drupal
installations, the 3 other drupal installs do not exhibit the same
issue.

I used the Backup & Migrate module to copy the MySQL DB and used FileZilla to download the site/default/files/* folder(s) & files, site/all/modules, libraries, & themes files.  I restored the DB & sites/default/files folder to a test server.  Setting "Optimize CSS & JS" to enabled fixes the 31 css files problem for Internet Explorer and both FireFox and Internet Explorer are able to view the website theme as normal.

The absolute strange quandry here, is when I enable CSS/JS Optimization on the production server it breaks the theme for both IE and FireFox.  Chrome and mobile devices (android & iPhone) are unaffected.  I have not checked any other web browsers for issues.

I have listed the themes that I have specifically checked.  Where do I continue troubleshooting this from here?  I thought maybe changing the theme would fix it, however it has not.

Troubleshooting
Enabled the Optimize CSS/JS Files options by

Making setting the File System >> Public option.
Setting the Performance >> Optimize CSS/JS options to enabled.
Clearing the Cache and Rebuilding the Theme Registry.

Switched the Theme to PixtureReloaded (an adaptive theme) and repeated the steps above.

Switched to Zen and repeated the steps above.

Checked the file system permissions for sites/default/files to make sure there was read/write access and there is for owner/group/other

It seems that regardless of the theme I switch it to it does not fix the IE issue, and when I optimize the css/js files it breaks the website for FireFox users as well.

-- Edit 11/1/2011 1:30AM UTC --
As per suggested I re-encoded all the files in the theme from ANSI to UTF-8 without BOM.
Backed up the original theme folder, after taking the site offline
Uploaded via ftp the re-encoded theme
Ran update.php, cleared the caches, rebuilt the theme registry
Issue persists.

-- Edit 11/1/2011 4:57 PM UTC --
I also tried using the Garland, Mannilli, and Bluemarine themes with the same results (I tested this last night when I took the site offline).

-- Edit 11/1/2011 6:53 PM UTC --
I took the site offline, changed the settings to "Optimize CSS: Enabled"
Viewed Source for Chrome, FireFox, & IE9
I am able to click on the links for the CSS files and browse them, each css file is the same, and I did a DIFF/Compare of the  tag content and except for a session ID that ubercart uses for the shopping cart each head section is the same.


texts: 3 vocabulary and taxonomies in this vocabularies

texts:
I want to use vocabulary and stored in separate taxonomy vocabularies to create urls, and breadcumbs; is it possible?

Drupal 7

I want to get the schema:
a vocabulary 1
   a taxonomy 1
   a taxonomy 2
b vocabulary 1
   b taxonomy 1
   b taxonomy 2
c vocabulary 1
   c taxonomy 1
   c taxonomy 2
effect to get :

User type in 1 node
a vocabulary 1
   a taxonomy 1
b vocabulary 1
   b taxonomy 2
c vocabulary 1
   c taxonomy 1

breadcrumbs (diff vocabularies )
a taxonomy 1 >> b taxonomy 1 >> c taxonomy 1

url path for taxonomy:

a taxonomy 1 / b taxonomy 1 / c taxonomy 1 /


texts: What query string is used to display products in commerce kickstart?

texts:
I am creating a php script to display all the products from commerce kickstart database

But the image is in a table called file_managed and the products are in commerce_products and i cant seem to figure it out. what query is used to display the products in commerce kicker or how do i select all the product and images from the database using sql?


texts:
The following code:

var_dump(check_markup('This is a test', 'plain_text'));

outputs:

string(22) "
This is a test
"

Why does it do this?


texts:
I am trying to migrate users and a few other entities from a Drupal 7 site to Drupal 8 with the built-in migration modules and Migrate Plus.  I have added a database array in settings.php but something is missing to get the migrations to "see" the right database. I am getting this error.

[Mon May 11 22:22:56.025896 2020] [php7:error] [pid 6389:tid 140003403929344] [client 62419] PHP Fatal error:  Method Drupal\user\Plugin\migrate\source\d7\Role::__toString() must not throw an exception, caught Drupal\migrate\Exception\RequirementsException: No database connection configured for source plugin d7_user_role in /var/www//web/core/lib/Drupal/Component/Utility/Unicode.php on line 595, referer:

I have tried adding

shared_configuration:
 source:
   key: database_key

But it did not work.

Any help is greatly appreciated.

Thanks,
Josh


texts: I have users registering on my prod environment, but I also have accounts created internally on my staging environment. Is there a drush command similar to  sql-sync or Drupal module that will simply merge the user table without overwriting all users and credentials?


texts:
On my project, I have a custom table for some custom permissions for users. I want all permissions for a user loaded on each page like $user. I created a custom module and set the global variable $cperms in hook_init() which contains all custom permissions for current logged in user.

These values are available on site pages but I am not sure it is good to use hook_init() to set global data. Is there any proper method?


texts: Composerise Drupal command syntax and starting location

texts:
I have 2 sites a dev site and the production site.  Need to convert them from drupal/drupal composer sites to the newer format allowing continued support for composer.
The syntax is unclear to me as detailed below. From https://github.com/grasmash/composerize-drupal

The 'composer-root' is supposed to be where .git is.  Composer is at /home dir, their is a Git directory a .composer (dir) .gitconfig (file) (I have always ran composer from terminal /opt/lampp/htdocs/d8/web directory)

So is composer-root=./home ??

The Drupal dev site is located in /opt/lampp/htdocs/d8/web where in the web dir the index.php, composer.json, composer.lock, update.php files are.  This is where I ran composer from previously.

So is --drupal-root=./opt/lampp/htdocs/d8/web ??

And I run the command from /opt/lampp/htdocs/d8/web as I have done previously?

If correct: composer composerize-drupal --composer-root=./home --drupal-root=./opt/lampp/htdocs/d8/web --no-update

Many thanks for any suggestions!


texts: Is it safe to truncate a field revision table?

texts:
I noticed D7 creates a field_revision table for every field, and duplicates the content from its field table counterpart even if one has revisions turned off.

I have a big text table and it is taking up a lot of space (several GBs).

Would it be safe to truncate the revision table?

PS: Meanwhile, I have also reported this as a bug.


texts: Adding checkboxes to submission rows via hook_preprocess_HOOK

texts:
I am working with drupal 7 webform submission results. I would like to integrate 2 features to webform submission results rows. One of them is adding a checkbox on individual rows for selecting multiple submissions and printing all these selected submissions on paper  at the same time, second feature is adding another checkbox to archive multiple submissions. (I try to use webform2pdf and webform_archive but they didn't work for solution)

I kind of know that I need to use hook_preprocess_hook, but I would like to listen some approaches or recommendations. Something like this(stolen from webform2pdf module):

function webformpdf2_preprocess_webform_results_submissions(&$vars) {
  $rows =& $vars['table']['#rows'];
  $i = 0;
  $table_row_keys = array_keys($vars['table']['#rows']);
  foreach ($vars['submissions'] as $sid => $submission) {
    if (webform2pdf_enabled_pdf_access($vars['node'], 'webform_submission_access', $vars['node'], $submission, 'view')) {
    $rows[$table_row_keys[$i]][] = l(t('Download PDF'), 'node/' . $submission->nid . '/submission/' . $submission->sid . '/downloadpdf');
   }
   else {
   $rows[$table_row_keys[$i]][] = '';
   }
   $i++;
}

 $header_keys = array_keys($vars['table']['#header']);
 $last_header_key = array_pop($header_keys);
 $vars['table']['#operation_total'] += 1;
 $vars['table']['#header'][$last_header_key]['colspan'] =$vars['table']['#header'][$last_header_key]['colspan']+ 1;
}

I played around with this block code i just couldn't create the checkboxes.
Thanks for your help and attention.


texts: How do I show a view item as grid and view item as list, dynamically?

texts:
I have created a view to display list of user with their details, and
I want to display a widget on views display page which shows item as view item as grid and  view item as list dynamically.

How do I achieve this?


texts: User relationship requests in a view block with accept and decline links

texts: I have a node in which i want to show a user all the relationship requests the current user has received and a status link below that so that the user can accept or decline the request then and there itself without needing to go to the boring Drupal default user relationship page. I am obviously using the user relationship module for this purpose. Anyways, i set out to create a view but after tinkering enough i was unable to do so. What i was able to do was to get a list of all relation requests (also made by the logged in user) I want only the received request.  How can i do this? If it helps, here's my view


texts: I need a .schema.yml file when I create a new custom field?

texts:
I just read Create a custom field type and I can't find a lot of information about the .schema.yml file. So, I just create a custom field without the .schema.yml file and I see that if I add my custom field in a content type and I export my config the field is exported with all the configuration.

So we really need the schema.yml file when I create a new custom field?


texts: Does Ubercart have an external API that a 3rd party site could query? Specifically from a fulfillment point of view? We need to be able to query the system for items to ship, then update the order's status and set a tracking number after the item shipped. All this is done on a completely different server/company, so needs to be done via a publicly exposed API (like a REST or SOAP service). Does Ubercart do something like this?


texts: How to access webform field labels in a twig template?

texts:
The YAML below represents a webform. Theming is simple using the twig template also found below, but the label for email is inline with the input field by default. How can the labels in the webform be accessed through twig for further theming?

Webform YAML

name:
  '#title': Name
  '#type': textfield
  '#required': true
  '#default_value': '[current-user:display-name]'
email:
  '#title': Email
  '#type': email
  '#required': true
  '#default_value': '[current-user:mail]'
subject:
  '#title': Subject
  '#type': textfield
  '#required': true
  '#test': 'Testing contact webform from [site:name]'
message:
  '#title': Message
  '#type': textarea
  '#required': true
  '#test': 'Please ignore this email.'
actions:
  '#type': webform_actions
  '#title': 'Submit button(s)'
  '#submit__label': 'Send message'

webform--contact.html.twig

    <form{{ attributes }}>

            {{ element.elements.name }}
            {{ element.elements.email }}
            {{ element.elements.subject }}

            {{ element.elements.message }}
            {{ element.form_token }}
            {{ element.form_build_id }}
            {{ element.form_id }}
            {{ element.elements.actions }}

    </form>


texts: Organic Groups admin has can't edit roles and permissions in groups

texts:
I have a user who is an "administrator member" of a group called "Fancy group".

"Administrator members" of this group have permission to administer roles and permissions within the group.

but my user, an administrator of Fancy group, can only view the roles and permissions, not administer them:

Is this a bug in OG or am I doing something wrong?


texts: How can I completely disable cron so that it won't run even if the cron URL is hit or cron is ran manually?

texts: When working on a dev site I'd like to put in a safeguard to make sure cron cannot run, even if triggered manually. Is there a way to do this in Drupal 7?


texts: How to optimise views with multiple field collection?

texts:
I created a views reports page with multiple field collections (10), I added the field collection in relationships in advanced option to get the fields inside the field collection. this works great I get all the data that I need.
but here's the problem. If the page have the data on it, it takes time to load the page.

Example: If I have thousands of data in views reports page, it takes time to load the page, almost 1 minute(some times it keeps on loading). though I only display 10 items on each row using pagination/views lightpager but stills the page loading is slow,

My question: is how can I optimise my views reports page with multiple field collection relationships in my current setup, any suggestions will be appreciated.

Note: The data should always up to date. that's why I don't cache the views.

Thank you!


texts: How can I get the order ID from Commerce (using Rules)?

texts:
I need to call a function upon successful completion of an order, and that function needs to know the OrderID that called it.

I have setup a rule

Event:
"Completing the checkout process"

Conditions:
None

Actions:
[custom function]

I am aware of two possible ways pass the order_id.

Using a data selector (though I'm not exactly sure what this should be), and passing it through a 'value' argument -or-
Calling the function commerce_cart_order_id($uid) from within my function.

commerce_cart_order_id($uid) did not seem to return anything.

global $user;
$uid = $user->uid;
$order_id = commerce_cart_order_id($uid);
drupal_set_message(t('OrderID:  ' . $order_id), 'status');

Has anyone got any suggestions on what I might be doing wrong? Many thanks.


texts: how to make product with attribute which select admin and only this attributes be visible for user

texts:
So i for example:
i have a commerce_product, in this product there is attributes (select list or check-boxes)

attribute: [color white]

attribute: [color red]

attribute: [color pink]

attribute: [color black]

attribute: [color green]

attribute: [color orange]

when admin select only pink, green and red, these attributes must showing for user, without [black], [orange] and [white] attributes, in select list...

How it's can make? (without multiply commerce product)
price not change if user selects black or other attributes

Thanks for any help!


texts:
function theme_test($form) {

  $output = '';

  foreach($form['field'] as $key => $val){

    $output .= '
';
    $output .= drupal_render($val['uid'. $key]);
    $output .= '
';
    unset($key,$val);
  }

  return $output;

}

When I run this code, I get the following warning message:

  Warning: Cannot use a scalar value as an array in theme_test()

How do I resolve this, and what is the reason behind this warning?


texts: How can I produce a non-blocking process to modify newly created nodes of custom content type?

texts:
I have a custom content type called a Scan where the only required field is ISBN. Nodes of this type are created when a user POSTs to my REST API endpoint with an ISBN number. That's all working fine, nice and quick (which it needs to be).

Now I want some additional process that -- in it's own time without blocking the API request -- goes over these newly created scans, querying an API (Google Books/ISBNdb/OpenLibrary) to fill out the other fields. I can confidently write the plain PHP to do this but I'm trying to learn how I would do this in the Drupal spirit?

I have learned custom modules so I've got an idea my code is going to sit in the controller (Yes?).
I have looked at Rules & Actions but these aren't working in Drupal 8 yet (Right?).
Cron seems to only run every few hours which would be too slow as I want my code to run within minutes of node creation.
I found hook_ENTITY_TYPE_create but not sure exactly how to create one? In my custom module?

Please help :-)

Disclaimer: I am new to Drupal and am self-teaching Drupal version 8. I am a senior PHP developer with a good understanding of good-old OO PHP but have just never done Drupal. Be gentle with me.


texts: Ubercart 3: Skip review, single page checkout

texts:
I am using Drupal 7.12 and Ubercart 3.0. I created a custom module in order to enable a single page checkout by skipping the checkout review page.

The Code

/**
 * Implementation of hook_form_submit().
 *
 * Change Ubercart review pages to instant order submissions.
 */
function uc_onepagecheckout_form_submit($form, &$form_state) {
    // check for order submit
    if(isset($form_state['storage']['order'])) {
        $order_id = $form_state['storage']['order']->order_id;
        $reviewRequested = $_SESSION['uc_checkout'][$order_id]['do_review'];
    }

    // If the normal submit handler set do_review then call the review
    // form submit function.
    if ($reviewRequested && $form_state['redirect'] == 'cart/checkout/review') {
        // Clear the previous redirect because we're going to override it anyway.
        unset($form_state['redirect']);

        // Cause the review form to be loaded because some modules may
        // do some of their processing here.
        uc_cart_checkout_review();

        $order = uc_order_load($_SESSION['cart_order']);
        if ($order->payment_method == 'paypal_wps') {
            $wps_form = uc_paypal_wps_form($form, $form_state, $order);
            $wps_url = $wps_form['#action'] . '?';
            foreach (element_children($wps_form) as $key) {
                $wps_url .= urlencode($key) . '=' . urlencode($wps_form[$key]['#value']) . '&';
            }
            $wps_url = trim($wps_url, '&');
            drupal_goto($wps_url);
        }
        else {
            // Now submit the form.  Obviously the $form_state isn't actually
            // correct... hopefully nothing will care.
            uc_cart_checkout_review_form_submit($form, $form_state);

            // And check for an error.
            if ($form_state['redirect'] == 'cart/checkout/review') {
                // There's an error, so pretend the user clicked back.
                uc_cart_checkout_review_form_back($form, $form_state);
            }
        }

        // Ultimately the $form_state changes made by functions above are used.
    }
    elseif ($form_state['redirect'] != 'cart/checkout') {
        // Log any unexpected URLs in 'redirect'.
        watchdog('uc_cart', 'Checkout returned unexpected destination url: %url',
            array('%url' => $form_state['redirect']), WATCHDOG_DEBUG);
    }
}

/**
 * Implementation of hook_form_alter().
 *
 * Changes text on review order button to submit order and adds our custom submit function.
 * Adds a "Skip checkout review" option to checkout settings form.
 */
function uc_onepagecheckout_form_alter(&$form, $form_state, $form_id) {
    switch ($form_id) {
        case 'uc_cart_checkout_form':
            // Change the submit button label.
            $form['actions']['continue']['#value'] = variable_get('uc_checkout_submit_button', t('Submit order'));

            // Add our submit handler.
            $form['#submit'][] = 'uc_onepagecheckout_form_submit';
            // And add our JavaScript file to handle this submit button.
            drupal_add_js(drupal_get_path('module', 'uc_optional_checkout_review') .'/uc_onepagecheckout_checkout_form.js');
            // Add the uc_cart css, since it contains the throbber styles that we are using in the JavaScript.
            drupal_add_css(drupal_get_path('module', 'uc_cart') .'/uc_cart.css');

            break;
    }
}

This code is based on this module: Ubercart Optional Checkout Review

The Problem

Submitted orders are getting stuck in the "in_checkout" state instead of having the "pending" state. Also, no emails are sent to the customers. Probably, the invocation of uc_cart_checkout_review_form_submit($form, $form_state) does not work properly.

Can you help me to solve this issue?


texts:
I have been trying to alter the markup generated by my webform. .

Example changes which I would like to do:

Add the class "form-horizontal" to the classes under <form class=""/>.
Add the class "input-xxlarge" to each input field.
Remove any markup generated by the webform module (e.g. form-item, webform-component, webform-component-textarea).

I've been trying to override these values with the help of Devel. Using webform-form-[nid].tpl.php, I have the following line before I make any print statements:

$form['#attributes']['class']['0'] = 'form-horizontal';

The issue is that I can not alter the form classes. Any insight that can be shared would be highly appreciated!


texts: Output Paragraph values instead of the Paragraph IDs in a View REST export?

texts:
I have a View with a REST export display (image attached) that has some indexed field values from Search API.

The highlighted portion, authors, is a Paragraph field. Instead of the entity ID pointing to the Paragraph, how can I output a JSON object per delta with the field value?

Note, I am not using JSON:API (and cannot). Also, this is a Search API DB (and eventually Solr) based index, so 'Entity' mode cannot be used (and thus, no custom Normalizer).

What can I hook into, or what class can I create, to change how the Paragraph is being included in the result output? I thought about using a custom field formatter, but that seems like a lot of work just to output JSON data (classes, theme hooks, twig etc).


texts: How to load translated entity values in Twig for SEO purpose?

texts:
How can I get access for the english values of my entity in the french version of my twig template. This is for a tracking task.

Let say I want to print the node title en english on the french version.

I was hoping I could do something like this : {{ node.languages.en.label }} but this doesn't work.

I'd rather avoid using preprocess if possible (I know how to do it with preprocess).


texts: How do I redirect users to a predetermined url after login?

texts:
I have a view in Drupal 7 that lists PDF files. I want to keep track of the users that open that file; so I want that, if they are not logged in when they click, they are sent to the login/sign up page. I have already accomplished this using two views with different permissions, but the problem is that, after they sign up, they are redirected to the user profile page, as opposed to the PDF file.

How can I accomplish this?


texts: Use print_pdf in the background on node save?

texts:
As the Print module's creation of a PDF can be quite slow (and use a lot of memory/CPU), is it possible to save a PDF into the public:// files area each time a node is saved?

Has anyone done this? Presumably you could call a save-PDF function on hook_node_presave but I'm not sure what the next step is. Call a print-PDF function with a file path? Where is that print-PDF function and how would you call it?


texts: Method of initiating a text trim at a matching string?

texts: Using Drupal 7, I'm creating nodes by email using Feeds and Mailhandler. The body of the email is mapped to the body of the node. I'd like to trim the text to eliminate boilerplate language from the email so that it's not in the body of the node. I can't initiate the trim on a character or word count, because that will vary with each email. Is there a module, or a method in either Rules or Feed Tamper, by which I can initiate a trim when encountering a particular text string? If not, is there another method (like rewriting the string) that would achieve this? Thanks!


texts: Menu Wildcard Argument Displays in Breadcrumb

texts:
So, I have a menu setup in my module like the following. I have omitted most of the definition parameters to be brief:

$menu = array(
    'admin/config/people/MY_MODULE' => array(
      'type' => MENU_NORMAL_ITEM,
      'title' => 'MY MODULE',
    ),
    'admin/config/people/MY_MODULE/list' => array(
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'title' => 'View Lists'
    ),
    'admin/config/people/MY_MODULE/add' => array(
      'type' => MENU_LOCAL_TASK,
      'title' => 'Add a list'
    ),
    'admin/config/people/MY_MODULE/%ARG_LOAD/edit' => array(
      'type' => MENU_CALLBACK,
      'title' => 'Edit a List'
    )
);

My problem is primarily for the breadcrumbs. For the first 3 menu items, the breadcrumbs are generated correctly.

So for example, for the first item, admin/config/people/MY_MODULE, the breadcrumb is Home » Administration » Configuration » People.

For the third item, admin/config/people/MY_MODULE/add, the breadcrumb is Home » Administration » Configuration » People » MY MODULE.

Take the fourth item though, which contains a wildcard argument. Say I load a path like this: admin/config/people/MY_MODULE/acme/edit.

I still expect the breadcrumb to be Home » Administration » Configuration » People » MY MODULE.

However it is actually Home » Administration » Configuration » People » MY MODULE >> MY MODULE with the trailing MY MODULE entry linking to admin/config/people/MY_MODULE/acme/.

As you can see, it generated a link to the path ending in the wildcard. So my questions are:

Why is it doing that?
How do I stop it from doing it?

What's bothering me is that the Taxonomy module, in Core, defines a similar structure and the breadcrumbs for it are generated correctly. So I know its not a problem with the admin theme in use.

Any thoughts?


texts: What is the best way to export a content type and its fields?

texts: How can we export a content type, including its fields, and import it into staging or production?


texts:
I can't get my head around the following. I'm using the Geolocation module to show a map on my website and I want the InfoWindow to be open by default.
I found that this should be possible by using the following code:
infoWindow.open(map,marker);
Or as the geolocation module does: infoWindow.open(that.googleMap);
But because I don't create the markers and infoWindows I don't know what there name is. I tried figuring it out by looking at the code of the Geolocation module by can't seem to find it out. How do I loop passed all markers en infoWindows to open them when the map is fully loaded?


texts: Localhost configuration and problem with file permissions

texts:
Whenever I work on my local machine I am almost always experiencing problems related to file permissions settings, and since I guess they may be related with my local machine configuration I would like to explain how did I configure it in order to get advice on how to configure it properly (Since my knowledge on server configuration is quite limted and I am far from being a sysadmin).

My local machine is using ubuntu as OS and I installed php5, php5-mysql, mysql-server, apache2 and phpmyadmin separately using ubuntu's packages. The only custom configuration I made is that I don't place the websites in etc/apache2/www folder as default but on a specific folder at my home partition ~/www . In order to make this settings work I have to do follow this steps:

I edit /etc/apache2/sites-enabled/000-default as to point to that folder by replacing /var/www with the path to ~/www
Restart apache (sudo /etc/init.d/apache2 restart)
Create a symlink inside ~/www which points to /usr/share/phpmyadmin (#  ln -s /usr/share/phpmyadmin /home/carlos/www/phpmyadmin )

This configuration has the following benefits which are quite important to me:

I can keep my code safe whenever I install a new ubuntu release (this is, every six months) yet at the same time I can format / partition without losing any data.
I don't need extra permissions (sudo) every time I want to edit any file (which is often, since it's my development environment), update modules and so on.

However, it also has some drawbacks like the ones I mentioned with file permissions, and I think they are related to the fact that the owner of the files and folders is not www-data user but my own user.

Is there any way to prevent problems with file permissions but also preventing having to place the files in etc/apache2/www folder?


texts:
Is there a way to refer to a node in a forum post?

Like I want to put a hyperlink to the node with the node title as the display name. Is there any short handed variable that allows me to do that?

Thanks


texts: I have recently started working with D7. I made a test page and installed drupal gap to run it with mobile-application. I wants to assigned more nodes to the drop down menu under contents, taxonomy and users but I don't know how get this. I have added a screen shot to make it more clear.


texts: How can I pass argument when click term link to a view page?

texts:
I have 2 vocabularies "brand" and color".  The contents can have multiple terms from "Color" which is hierarchical taxonomy and just one term from "Brand"
For example,

 <Color>
    -Dark
      -Blak
      -Grey
      -Brown
    -Vivid
      -Bule
      -Yellow

 <Brand>
    -GM
    -BMW
    -Honda

I would like to override the links on the node viewtaxonomy/term/tid to my costom view page cars/%/%/view. the first argument is "Color" and the second argument is "Brand"
Then I would like to link them like this for example:

When the node is tagged with Dark,Black,Grey,Brown and GM
On the node view if users click "Dark" it will take them to cars/tid(Dark)/tid(GM)/view,
if users click "Black" it will take them to cars/tid(Black)/tid(GM)/view

After reading this article I made a new term view which display the terms tagged with the node being viewed and then put it in node template file. I also delete the default <?php print $terms ?> from the template file.I set two "excluded from display" views fields for the new term view:

`taxonomy:term ID` with relationship `taxonomy:Terms on node (Color)`

`taxonomy:term ID` with relationship `taxonomy:Terms on node (Brand)`

And then set "Output this field as a link" for the term field of "Color" with tokens like this:

cars/[tid]/[tid_1]/view

So the tokens are meaning: [tid]=tid of "Color"  and    [tid_1]=tid of "Brand"

OK, finally when we click one of the terms of "Color" on node view, tid of "Color" of the output links are not correct.  For example:
On a node tagged with Dark,Black,Grey,Brown and GM
when click "Black"  takes to

 cars/[tid of some other color]/[tid of GM]/view

but what I expect is

cars/[tid of Black]/[tid of GM]/view

How can I achieve this?
Thank you for reading this long example.


texts: EntityFieldQuery and how to use aggregate functions SUM, ARG and MAX

texts:
I have entity type payment and need count all payments (calculate based on field_total), if its hard to undersand, I show it on example:

Payment A - $10
Payment B - $20
Payment C - $30

And I need query that SUM all values. In my example it will be $60.

$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node', '=')
                    ->entityCondition('bundle', 'payment')
                    ->execute();

What is best method to solve this problem? I could select all nids and load it. But this is not very good if I have thousands nodes, or Iam wrong?

Thank you for advice.


texts:
I've got two content types: "job" and "job description".

Both of these types are categorized by using ONE taxonomy vocabulary "category".

I've enabled the default "taxonomy term view" for views.

No when I navigate to the site /category/entertainment (for example) all jobs and job descriptions which are tagged with the category "Entertainment" will be displayed.
But I want to extend this view like:

/category/entertainment/job => show all nodes of type "job" with the category Entertainment
/category/entertainment/job_description => show all nodes of type "job_description" with the category Entertainment


texts: User select the filter criteria current_salary_range is 20000. I will show the results also salary range below 20000

texts:
I have created the content type named candidate_profile, included fields like Current_Salary_Range.

I have created a view and also I am using better exposed filter for current_salary_range field.

My  question is: When the user selects the filter criteria current_salary_range of 20000, I want to show the results who is having current_salary_range 20000 and also who is having current salary range below 20000.

how to proceed with this...?


texts:
I want to disable a form in Drupal 8.

In D7 you could've done it in an alter hook like this.

$form['form'] = ['#value' => 'the form you are looking for is gone!']

What can I do in Drupal 8?

What I tried so far:

function hook_form_FORM_ID_alter () {
  $form[] = []; // $form[] or $form both will not work.
  $form['dunnoWhatToWriteHere'] = [
    '#type' => 'markup',
    '#markup' => t('The form is gone),
  ];
}

What I suggested is that I would overwrite the $form array with an blank one but as I run my xdebug drupal seems to just ignore it because the $form array in its native status exists although I tried to overwrite it with a blank one.

Do I also have to call a Formbuilder?

 $form = [];
 $form['error'] = [
   '#type' => 'html_tag',
   '#tag' => 'p',
   '#value' => t('The form is gone'),
 ];

That one worked for me :)


texts:
I have created several custom fields for my Drupal 7 users, which I imported from an external users table.

I am now trying to automate the population of these custom fields using a custom module, however my code is not working. The following code is what I have been working with:

<?php

function get_sage_fields($username) {

  // Get the extra fields for Sage users
  $sage_fields = db_query('SELECT OFFICE_ID, TRADE_STATUS, DESIGNATION,
    FIRST_NAME, LAST_NAME, PHONE_NUMBER, MAILING_ADDRESS, ACCOUNT_PREFIX,
    ALLOW_TO_TRADE FROM USER WHERE USER_ID = $username');
  return $sage_fields;
}

function sage_fields_user() {

  // Grab all usernames from the users table
  $usernames = db_query('SELECT name FROM users')->fetchCol();

  // Load the users
  $users = user_load_multiple($usernames);

  // Loop through and edit each user
  foreach($users as $user) {

    // Load the extra data
    $extra_data = get_sage_fields($user->name);

    // Update user fields
    $user->field_office_id[$user->language][0]['value'] = $extra_data['office_id'];
    $user->field_trade_status[$user->language][0]['value'] = $extra_data['trade_status'];
    $user->field_designation[$user->language][0]['value'] = $extra_data['designation'];
    $user->field_first_name[$user->language][0]['value'] = $extra_data['first_name'];
    $user->field_last_name[$user->language][0]['value'] = $extra_data['last_name'];
    $user->field_phone_number[$user->language][0]['value'] = $extra_data['phone_number'];
    $user->field_mailing_address[$user->language][0]['value'] = $extra_data['mailing_address'];
    $user->field_allow_to_trade[$user->language][0]['value'] = $extra_data['allow_to_trade'];

    // Save the user object
    user_save($user);
  }
}

I enabled my custom module under admin/modules and included it in my .info file with:

files[] = sage_fields.module

However, if I go to field_revision_[FIELD_NAME] in my D7 database, I do not see these fields populated.

Could someone please point out where I have gone wrong?


texts: How work BigPipe cache around block views?

texts:
I have 2 blocks with swiper.js around.

This 2 blocks are from the views module.

I need to print them in the theme like i want so, i load them into the preprocess_page.

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

And the second :

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

They have exactly the same configuration in views and block config.

But for block 1 swipper work, not for the block2 every time i load the page.

If i look at the source i got this for the second block :

For the block 1 i got the HTML render.

I don't know why the second block is cached by big-pipe and not the first block.

But my js on the ready state work every time on the first block, and depend if i clear the cache but it's not everytime, work on the second block the first time i load the page.

The callback (in the bigpipe attributes) call something at the bottom of the page after the js include.

That why my second block doesn't work ? it's not clear.

What's happen ?


texts:
I have a number of content types with many long text fields and WYSIWYG editors. These are quite long pages that have many areas of text. Most of these long text fields have instructions in as the default value. I use this so that markup styles are consistent, headers are already inserted with a H3 tag, subheaders have a H4 tag, and text is in a p tag.

My problem is that if the user doesn't want these text areas to show, then they delete the default text from the box. But this doesn't always work, sometimes it displays the default text on the published content.

I can't believe no one else finds this a problem, but I can't find solutions already online... unless it only happens on my Drupal install?

for example if this is the value during node_save i.e. empty
["field_testimonials"]=> array() { ["und"]=> array() }

then on viewing the node, the field is populated with the default value. This is happening during testing and I have observed this behaviour every time I have saved a node since I have been looking at this issue (for several hours).

This only happens on creating nodes - this behaviour doesn't happen when I update nodes.

--- update ---

so the only solution i have got so far is to force the value to be null if it is empty, this overrides the behaviour. I have to do an extra test whether the value is null before print the value in the template file. But I don't think this is a good solution...

function hook_node_presave ($node) {

        // iterate attributes and all fields on them
        foreach ($node as $attr => &$value) {
                if(strpos($attr,'field_') === 0) {
                        //for long text fields
                        $info = field_info_field($attr);
                        if (is_array($info) && $info['type'] == 'text_long') {
                                if (!is_array($value[LANGUAGE_NONE]['0'])) {
                                        //if no value is there, set the value to NULL
                                        $value[LANGUAGE_NONE]['0']['value'] = NULL;
                                }
                        }
                }
        }
}


texts: How to get the actual value of a field in Views?

texts:
I'm using the Views module and Drupal 7 and want to add a class to all rows of my table that have a certain value for a certain field.

The field is a bit field and is included in my query. I have added a PHP field (a separate Views module that is installed) with the following code:

if ($row->field_kampioen || $row->field_spirit) {
    return 'views-table-highlight';
} else {
    return '';
}

This should allow me to set the row class to [php]. This works, but all rows get the css class. When I output this for debugging:

return $row->field_champion . ' ' . $row->field_spirit . ' ';

I see that the classes are all different numbers, and field_champion is equal to field_spirit. This makes me think I'm seeing the ID.

How can I get a TRUE of FALSE? So, how can I get the actual bit value of this field?

It would be nice if I could do this via the Views module only, but I've seen pages where hooks are used. Maybe I'll have to use that.


texts: Why does Views PHP give me NULL for $row->path?

texts:
I have a views block to display only the titles of some few nodes. Titles linked to the single node. I want to have a CSS class .active added to the title's links when the linked path matches the actual called path. As mentioned in the comments below, I didn't got that class by default.

So I added a Global: PHP field right after I added and excluded a Content: Path field to access $row->path in the Global: PHP's output code field. But $row->path seems to be empty. dpm($row) gives me a path: NULL. Content: Path displayed gives me the right paths. But where's the path gone in the PHP field??? When was the moment it got nulled?

I still managed to do what I want with the nid. Though without the beautiful alias paths I'ld like to have.


texts: Hierarchical Select Doesn't allow multiple vocabularies in drupal7

texts:
Hierarchical Select I have taxonomy vocabularies:

For example

Products, systems and Support

Each vocabulary has 2 terms:

Products -> product1, product2

systems -> systems 1, systems 2

Support -> support1, support2

I am using Hierarchical Select as a field to select this vocabularies.

But with Hierarchical Select ,it is defaulting to only one vocabulary.

Please let me know how to select terms from multiple vocabularies while creating nodes and alternate to Hierarchical Select.


texts: How to pass argument from one view to another view?

texts:
I have filter  in separate view and want to pass the value to another view and get the filter result in Drupal.

Scenario: I have two views, one for filter and another for filter result.

I want to filter based the content: title. In another view I have to fetch the result and display based on title filter.

My question: How can I argument from one view to another view?


texts: Download file after fill in email address

texts: When anonymous users wants to download e.g a PDF file, they must first fill in their email address. What is best way to set this up?


texts: How to create responsive list items using bootstrap theme

texts:
I am using bootstrap theme. I am trying to create responsive list items. When viewing the page in tablet, laptop, desktop, I would like to see items in two columns.  When viewing the page in mobile, list should display in a single column. I entered the below code in body field but it is not working for me. I googled for some bootstrap classes but I could not find anything specific. Can you please advise how I can write the code to create responsive list items?

Probate Problems

Title Issues

Foreclosure

Liens

Judgements

Code Violations

Job Transfer

Mold

Divorce

Tenants Issues

Behind on Taxes

Fire Damage

Foundation Problems

Run-down Properties


texts: Gmap Module open info window(bubble) from external link

texts:
Not even sure where to start.

Would like to have a menu in the sidebar that when clicking on a link will open an info window (bubble) in the Google map.

Any ideas on a jumping off point?


texts: How do I make a taxonomy menu on a multisite with different links on different sites?

texts: I have made genres using taxonomy that I want to appear in a menu in a multisite using the Domain Access module. The different sites will use different genres and is being used in a content type called Book. I want the menu to only show the genres that is being used by the books that are available on the site. What is the best way to make that happen?


texts: Autocomplete field consisting of multiple fields

texts:
I am trying something that have been probably discussed already, but I can't seem to find it.  I have a node reference field that I would like to use the "Autocomplete field" function with. However, I would like to show an extra (custom) field, not only the Title of the node. Preferably in a comma separated list, like:

TITLE Node 1, custom field
TITLE Node 2, custom field

etc.

I'm sure this can be done. But I can't seem to find how (and yes.. I'm a beginner I'm affraid).

Thanks a million!


texts: Download a backup of the files directory

texts:
I've researched this a little bit, but I'm wondering if anyone else has an idea on how to do this. The request is to be able to create a weekly archive of the files uploaded through a document content type, basically downloading all files. The client is a team of non-technical, financial advisors - so the simpler, the better.

Obviously Backup & Migrate doesn't fit the bill since that's database only. The only thing I can really think of is writing a bash script to gzip their document folder, and then have a continually updating URL based on a date that links to that zipped folder.


texts: User group / user access to files Drupal 7

texts:
Is there an easy way (as in with some module) to restrict file downloads to certain user groups or users in Drupal 7? Tried to search and found only questions with no proper working answers.

I know about private files however that seems to restrict files only with logged in users not with certain user groups or individual users. I also know about content access module, but that does not restrict file downloads at all if user knows the direct url to the file.


texts: Views AJAX pager is not working for custom theme

texts:
I am using a custom theme for my Drupal site. Here I have created views with page displays, Kept AJAX pager 'on'. When I click on next the pager keeps on loading.

In firebug I found the following error

"$(scrollTarget).scrollTop is not a function
[Break On This Error]
...he page to get source for: http://mysite.co... "

Totally no AJAX view pager is working in my theme, where in garland working fine.

How can I solve this?


texts: How to reuse object between Drupal Behaviors?

texts:
We have a JS file (basic-page.js) that has the following Drupal Behavior. In this, we created what we believe is considered a Drupal object (need help with correct term) that contains a function that can be called. In the latest request, we need the ability to reuse the same code from the Drupal Behavior in another Drupal Behavior.

How could we reuse the code? Currently the article.js is not able to use the code from basic-page.js, no errors or warnings are given.

basic-page.js (where Drupal object resides)

(function($) {
  'use strict';
  Drupal.customObj = {
    'function1': function(element) {
      /* perform some logic here */
    },
    'function2': function(var) {
      /* perform some other logic here */
    }
  };

  Drupal.behaviors.customName = {
    attach: function(context, setting).once('customName').each(function() {
      /* behavior runs here */
      var func1 = Drupal.customObj;
      var results = func1.function1($('body'));
      //process results
    });
  };
})(jQuery);

article.js (where we want to reuse Drupal.customObj.function1)

(function($) {
  'use strict';

  Drupal.behaviors.articleResults = {
    attach: function(context, setting).once('articleResults').each(function() {
      /* behavior runs here */
      var customObj = Drupal.customObj;
      var results = customObj.function1($('body'));
      //process results
    });
  };
})(jQuery);


texts:
I want to insert a token from the Google Ad Manager module in a view.

But how do you insert a token like the ad_slot token in this module in a views template?