texts: Adding a library to a module using composer

texts:
I'm working on a module which will require a library that is already in composer.

I added a line to my module's composer.json file:

"require": {
   "markrogoyski/math-php" : "dev-master"
}

I ran the command:

composer update .

and a "vendor" directory was created in my module's directory and the files were downloaded.  However, If I add a use statement to the file my_module/src/Controller/Test.php I get an error:

----Test.php----

<?php
namespace Drupal\lims\Controller;

use Drupal\Core\Controller\ControllerBase;
use Math\Functions\Map\Single;

class Sample extends ControllerBase {
    public function content() {
        print_r(Single::square([1,2,3,4,5]));
    }
}

I see the error:

PHP Fatal error:  Class 'Math\\Functions\\Map\\Single' not found in [module path]/src/Controller/Test.php on line 9

Is there another step that I need to do to get the library autoloaded in the correct namespace?


texts: Provide variable to page.tpl.php to mark page as Access Denied or 404?

texts:
Ideally I'd like to provide new classes to the body tag such a access-404 or access-denied, but unfortunately I'm not really aware of how to capture these.

I don't mind to identify these pages from the Page Title itself from template_preprocess_page, however it seems that $vars['title'] does not exist in D7? How can I access the page title from within a template_preprocess function?

SOLUTION: Thanks to DeeZone:

In my template.php:

function template_preprocess_html(&$vars){
  $status = drupal_get_http_header("status");
  switch($status){
  case "403 Forbidden":
  case "404 Not Found";
    $vars['classes_array'][] = 'drupal-page-error';
    dsm($vars);
    break;
  }
}


texts: Add more button does not worked any more

texts:
I added date field with unlimited values,it was working perfectly but suddenly it's stop adding new values.
when click on in just the first time the blue circle appear for second and nothing happen after that, then the button does not work.
sory for my english :)


texts: How to set an openlayers preset to full screen?

texts: I am working on one of those sites that need a fullscreen dynamic map to show up as a background. This means the preset should be set to 100% height, but I can't get this to work. Is there a module for that? A jQuery snippet?


texts: How to programmatically create new user with custom fields?

texts:
I want to create user with some custom fields. I have created extra fields through config > people > site information > manage fields and fields like first name, last name, city etc. I want to create user with this custom fields.

How can I create user programmatically?


texts: How to load third party php library in drupal 7 module?

texts: Suppose i want to load facebook-php-sdk for facebook connect in my drupal website, how can i load that class file in my module, i tried with libraries module, with different function provided with that api, but everytimes i fail.


texts: How to specify a background image in a view so that it doesn't get removed?

texts:
I want to output an image as a background-image of a "section"-tag but it doesn't work.

First I added the Image URL Formatter module, so I do not output the image but the url of the file.

In my view I add the image which generated with the contextual filter of the url. In that field I rewrite the output:

When I check the site I only get this:

I tried several times and it seems to me that Drupal will not accept the "style="..."" tag, Drupal will always remove it! And I don't know why?

If I change the style to class, I get the normal output, as in this example:

Does anybody have an idea?


texts: How to access fields from node template without render

texts:
within node template, i am trying to print a content type field value. usually I see the render function used to print the field value in the template e.g. render($content['field_name']). how do i just print the field value?

$content['field_name'][$lang][0]['value'] doesnt work


texts: Boolean field: hide (in display) if unchecked

texts:
I have a content type with a boolean field (checkbox). Basically, what I'm trying to achieve is this:

If this field is checked, only show the label (when viewing the page)
If this field is unchecked, don't show the field at all (no label and no value)

Is there a simple way of doing this? (Without resorting to Views or custom code)

I've noticed that if I use "Check boxes/radio buttons" as widget type for this field, it comes close to what I want, since it offers three values to choose from (yes, no, and N/A), and if N/A is selected, the field isn't rendered on the display page.

However:

I don't want 3 values to choose, but 2. (3 might be confusing for users, and having to explain "Don't use the 'no' value" really isn't a good solution.)
I don't want the value to be displayed when "Yes" is selected (only the label).


texts:
I have yet to find a snippet or a solution to enforce a minimum comment length.

Most validation modules deal with fields.


texts: simulating the “add another item” ajax call in drupal 7 using jquery

texts:
I am trying to get jQuery to send a mousedown event to the Drupal 7 "add another item" button for a multi-value field, then wait until the ajax call has completed before filling in that new blank row with data from an element in a jQuery object (that has several elements). I need to use a loop to cycle through the elements (ingredients) in this jQuery object, but no matter what I try my page dies...

Currently, I have something like the following:

i = 0;
ingredients = newHtml.find('.recipe_ingredients > li');
ingredientsLength = ingredients.length;

$('#edit-field-ingredients-und-add-more').mousedown();

while(i < ingredientsLength) {
    if ( document.readyState !== 'complete' ) {
        // code to fill in the new blank row with data from 'ingredients'
        $('#edit-field-ingredients-und-add-more').mousedown();
        i++;
    }
}

Because I don't yet know how to issue the ajax call myself using jQuery (or using Drupal) I've been trying to just check whether the call has completed by using .readyState and other hack-like methods. I'm just not sure what to try next!

Am I going about this the completely wrong way? Is there a straightforward way to make the "add another item" multi-value field ajax call using jQuery? Any help would be greatly appreciated...


texts:
myjavascript.js:

    function initialize() {

        var waStyle = [
            {
                featureType: "all",
                stylers: [
                    { saturation: -100 }
                ]
            }
        ];

        var mysiteMap = new google.maps.StyledMapType(waStyle,{name: "Nuance"});

        var img = new google.maps.MarkerImage("/themes/nuance/img/pin.png");

        var myLatlng = new google.maps.LatLng(41.061833,28.997948);

        var mapOptions = {
            zoom: 16,
            center: myLatlng,
            disableDefaultUI: true,
            mapTypeControlOptions: {
                mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'mysite_map'],
            }
        };

        var map = new google.maps.Map(document.getElementById('mainmap'), mapOptions);

        var point = new google.maps.LatLng(41.061833,28.997948);
        var marker = new google.maps.Marker({
            position: point,
            map: map,
            animation: google.maps.Animation.DROP,
            icon: img
        })

        map.mapTypes.set('mysite_map', mysiteMap);
        map.setMapTypeId('mysite_map');
    }

    function loadScript() {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
        document.body.appendChild(script);
    }

    window.onload = loadScript;

And include in my node via field. (text format: php code)

<?php include('themes/mytheme/scripts/maps/myjavascript.js'); ?>

But get error.

On site:

 function initialize() { var waStyle = [ { featureType: "all", stylers: [ { saturation: -100 } ]
    ...

What's my problem and how can i fix it?


texts:
I am using Views to display submitted contents as table and I need to merge two columns ("Uploaded covering letter" and "Uploaded e-book") into one.

How can I achieve this?


texts: Using PrivateTempStore for anonymous users with Internal Dynamic Page Cache & Internal Page Cache modules

texts:
I'm developing a Drupal 8 project which interacts with an external API. This API handles user authentication, completely bypassing the Drupal user system. This means that logged in API users are treated as anonymous Drupal users.

I have created a module that utilises the PrivateTempStore to store user sessions. This works as expected. However, what I am unclear about, is the best practice as far as utilising the Internal Dynamic Page Cache and Internal Page Cache modules.

At the moment, any user session sensitive blocks or pages that my module outputs are set to have a maximum cache lifetime of zero - to ensure that, for example, the user's account page is not served from the cache.

Is this the correct approach, or would I be best at least disabling the Internal Page Cache module - which specifically targets anonymous users?

The site will be hosted on the Acquia platform, so Varnish will likely be utilised.
For that same reason, is it better to disable one or both of the Drupal caching modules?


texts: Multi step registration - save on last step

texts:
I'm using the module Multi-Step Registration module. The problem is that the user is saved after clicking the continue button on the first step. So when a user quits after 3 steps the user is saved already ... (but the registration process isn't completed).

Does anyone have an idea how I could the save the user on the last step or a workaround to fix this?


texts: can i change the value of comment settings in Drupal 6?

texts: I have a default value of comment settings as 'read-write' but i want to set it to disable. I change this in administer >> content >> content types. But when i wanna create a node, the bloc of comment setting does not appear!! I want to have disable as default value and appear the box such that the user can choose the value that he likes. Can anyone help me please? Thanks


texts: Use Views field output as a class? Tokens?

texts:
I have a field in my view which displays the taxonomy vocabulary that each result/node is linked to. However, I need a way to get that taxonomy vocabulary result and use it as a class for the view row - not just the field.

Has anyone had any success with something like this before? Options I can think of might be Tokens, direct template theming, or Display Suite, but I don't know how I would go about fetching that vocabulary field output and using it as the row's class.

Any help would be received gratefully :)


texts: Pressflow online users stats does not show correctly

texts:
I can not say enough of performance gain that my site gained through migrating to Pressflow + Varnish. However I have a rather annoying problem with Pressflow. After migrating to Pressflow 6, the statistics of online users does not show correctly. For example the forum shows 70 online users while there are actually over 1000 users online.

I am wondering whether it can be fixed or it is just a "collateral damage" that one should afflict to gain the performance. If it can be fixed, appreciate your hints to do so, and if not, how else can I show the correct stats.

Thanks


texts: Filter a view based on an attribute of a user?

texts:
I'm building a Drupal 7 site with a content type for events, and a view that displays a calendar of upcoming events. Events can be at one of two locations, and each user is also associated with one of the two locations. I'd like to set the calendar up so that the user only sees events for their location.

I tried doing this by creating a custom field on user profiles for location. However, I can't figure out how to use that field to filter the events on the calendar. It doesn't show up as an available value for contextual filters. Is there a way to do this?

Another option would be to make user location into a role, and then use role permissions to show the user one of two location-specific calendars. But this doesn't seem like what roles were really intended for.

Could I get some advice on an efficient way to do this? Events and user accounts are created by an administrator, and users don't need to be able to edit their location.


texts: Views exposed Filter does not appear to work

texts:
I have a view set for a content type 'Organization' containing a field 'specno'.  The field contains a five character ID number for classifying the 'Organization' content. The exposed filter is set to "is equal to" and I enter a value of '033000' in the exposed filter box.  The query generated for the view is

SELECT node.title AS node_title, node.nid AS nid
FROM
{node} node
LEFT JOIN {field_data_field_specno} field_data_field_specno ON node.nid = field_data_field_specno.entity_id AND (field_data_field_specno.entity_type = 'node' AND field_data_field_specno.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN  ('organization')) AND (field_data_field_specno.field_specno_value LIKE '033000' ESCAPE '\\') ))
ORDER BY node_title DESC
LIMIT 20 OFFSET 0

however, the display result does not contain the appropriate content. I have tried changing the filter to "Contains" and 'Starts with", but without success for nothing is displayed in the preview.

I am using D7 & V3.  Does anyone have any insight as to why this is not working?


texts: commerce pricing attributes but disigned with commerce standard?

texts:
Is there an solution or plan to get the pricing flexibility from "Commerce Pricing Attributes" and option but designed with commerce standard?

Wrong prices are shown in the cart see her Commerce Attribute price is not updating in cart and https://www.drupal.org/node/2420303

joshmiller explained that the commerce pricing attributes module is not designed in commerce standard an therefore the pricing bug arises.

commerce pricing attributes are verry flexible if you need to have many of product variations/attributes. What could be a way to manage many product attributes similar to creation pricing options without the commerce need of creating 100 products, each for each option.

What can i do if a want to manage 30 products with 100 options each if i dont want to use the commerce pricing attributes with bugs?


texts: How do I post JSON data on a remote resource?

texts:
I'm working to integrate a Drupal 8 site's content into a 3rd-party search tool. To get our data, the 3rd party requires us to post JSON to their API.  Having never done this before, what is conceptually needed to accomplish this in Drupal 8?  The site in question is around 5-6k nodes.
My initial thoughts are a custom module with a route that calls a controller function that creates an http client. The client gets its data from a json View. So when I visit the route, it pushes the data to the endpoint?  That is my rough guess and any insight is much appreciated.
Thanks!


texts:
I have a block with a google_maps map and it was all working fine until I try to use a sprite as icon. I know how to use sprites as I already used them in others pages of my site.

I think the problem here is that the block can't access the sprite image and I don't know where are my blocks or where is the default location of the Drupal 8 blocks folder.

By the way, I don't know if it helps but here is part of the code:

<meta name="viewport" content="initial-scale=1.0, user-scalable=no"><meta charset="utf-8">
<title></title>

&nbsp;

Already used the

src="/images/spt.png"

and

src="/home/rui/public_html/themes/custom/drupal_zymphonies_theme/images"`

but none of them worked


texts: How to check if a node has a photo/video to use as an exposed filter in views?

texts:
I am interested in creating an exposed filter with the following values:

Has photo
Has video
Has both photo and video

So this filter will check nodes and show only those with photos, if this filter is selected etc.

How can i do this? Should I create a new field on the content type and populate this according to having image/video?

Any ideas?

thanks


texts: Include a third party library using namespaces, dependencies

texts:
I made a library to access to the Taleo data ( https://github.com/Polzme/Taleo ).
I tried to follow the best practice to do it.
It's using composer ( http://getcomposer.org/ ) to resolve dependencies to Monolog and Guzzle.

Now, the big question is, how to use my library 'Taleo' in a Drupal module ?

I tried with xautoload ( http://drupal.org/project/xautoload ) and composer_autoload ( http://drupal.org/project/composer_autoload ) without success.

I also tried to include the file 'vendor/autoload.php', but it doesn't works (and it works well in the demo.php file: https://github.com/Polzme/Taleo/blob/master/demo.php)

Before including each file manually, I would like to know if there is a working solution available for Drupal 7.

Thanks!


texts: What is the php code to display a field of a referenced node in the node form of the node that references the node?

texts:
So I have a node (content type A) with some text fields and a reference field referencing another node (content type B).

When a user wants to update one of the text fields an existing node (content type A) , they need to see the text field of the referenced node (content type B).

Question: what is the php code that I can use to output that textfield from the referenced node (content type B) on the node form of the referencing node (content type A).

I'd like to add this to a code field in Display Suite and I also like to learn how to retrieve the variables from a loaded node and how to display them.

Cheers!


texts: How can I upload an image for a specific image style?

texts:
I'm trying to support retina on my site, so I set up a 2x image style and a 2x responsive image style. Now the generated HTML for images looks something like:

<img
    srcset="/sites/default/files/styles/2x/public/2019-01/foobar.jpg?itok=H_4_Z44r 1926w"
    sizes="2x"
    src="/sites/default/files/2019-01/foobar.jpg"
    typeof="foaf:Image" />

This image was already uploaded to my site when I made the change to support 2x images, and I noticed that it actually copied the original image over from /sites/default/files/2019-01/ to /sites/default/files/styles/2x/public/2019-01/.

My problem now is that I'd like to update the 2x version from the authoring interface, but I can't find anywhere where I can upload my 2x version. Is this possible?


texts: Notification email on Content creation - admin approval?

texts:
I made a custom content type to replace comments, as the current comment options are not satisfactory for me. Anonymous users can create this content type (comment).

I need to send an email to the administrator users each time a new comment is written, to allow them to publish the new comments.

I searched for notification email, but it is not what I expected; it only allows to send emails on regular basis. Maybe I could not make it work.

How can I send automatic emails to administrators to notify them a new comment has been created, and it is waiting for approval?


texts:
I've replaced an image on my home page with another image. I've verified that the new image is there (with the same name as the old image). And it's the only copy. I've run cron and cleared caches multiple times but the old image is still showing!

I'm using the following modules:
Advagg
Global Redirect
Cache Expiration (File update set under File Actions)
Elysia Cron
Boost
Boost Crawler
HTTPRL
Metatag
Metatag: Views
XML Sitemap

Anyone know what might be causing the problem?


texts: Calculate webform total from select list fields

texts:
Like e.g. there are two select options type components that has various amounts of $ to select from. So if user selects in one field $100 and $200 then the next field below it would generate the total which would be $300 in this example.

I did research, and the module Webform Calculation Components does the exact thing I want, but it does that only with numeric fields where user has to type amounts manually. So it's a no-go. In my case user has to select from drop-down list already given amounts.

Cheers


texts: Undefined variable: _SESSION in template.php

texts:
I use this code (not mine, I do not know how to code) to disable Maintenance mode message on front-page while developing a site, it's really annoying when it's flashing all the time in the middle of the page.

function theme_preprocess_page(&$vars) {
    if (variable_get('maintenance_mode', 0)) { //no maintenance mode message on front-end
      $message_count = count($_SESSION['messages']['status']);
      if($message_count > 1) {
        array_shift($_SESSION['messages']['status']);
      }
      else {
        unset($_SESSION['messages']['status']);
      }
}

So it works great while logged in and in maintenance mode, but when going to user/login page as anonymous, it gives this notice in red:

Notice: Undefined variable: _SESSION in theme_preprocess_page()
(line 141 of /sites/all/themes/mytheme/template.php).

So what is this? Is the code missing something?


texts: How do you remove the default Drupal 7 administration menu?

texts:
I have disabled the "Toolbar" module, and cleared the cache; yet, it persists.

How do I remove it?


texts: What is causing the "username_link not found" error in the LDAP integration module?

texts:
After integration and configuration of the LDAP integration module, my site is unable to access the LDAP Server. During testing it throws below error:

  Notice: Undefined variable: username_link in theme_ldap_authorization_test_results() (line 91 of /var/www/drupal/sites/all/modules/ldap/ldap_authorization/ldap_authorization.theme.inc).

I am using Drupal - v7.44, and LDAP v 7.x-2.0-beta8 and the same LDAP server is working on other sites.

Is this a configuration issue or a bug?


texts: How do I create a menu based on 2 different vocabularies?

texts:
I'm new to Drupal 7 and I'm trying to create something simple but I can't work out how to do it.

In short, I'd like to create a dropdown list within the main menu that shows all my venues categorised by regions.

To do so, I've created a vocabulary "Regions" that lists my regions. I've created another vocabulary "Venues" with an extra region term-field to associate it to a region.
I'd like to have my main menu looking like below:

Home
Venues (dropdown)
  > region 1
     - venue 1
     - venue 2
  > region 2
    >> sub-region 2.1
      - venue 3
      - venue 4
    >> sub-region 2.1
      - venue 5
      - venue 6
  > region 3
     - venue 7
     - venue 8

I've tried using the taxonomy menu module to achieve that and I can get the first part working, i.e. displaying the regions and sub-regions in the main menu. But then, I have no idea how to populate the regions with their venues based on the extra region field added in that vocabulary.

Any help would be much appreciated.

Thanks.


texts: How do I select which node fields to display while typing in an entity reference field?

texts:
I created an entity reference field to select News items to display on a page. News is a content type.
How do I display not only a title, but other stylized fields of a node as I type in the entity reference field?


texts: How to create a view for logged in user?

texts:
In user account (/admin/config/people/accounts/fields) I have a field that references to an entity: company.

I have a node-type, dossier, with a field that references the same entity as in user account: company.

How can I make a view where the logged in user only sees the user's own dossiers?

I tried a lot of things but nothing works. Sometimes the view is empty, sometimes the logged in user sees all the dossiers of the website.


texts: How can I create a node in a PHPUnit Test without having to create the node type in PHPUnit

texts:
I have a node type already created on my site.  I want to create a node with this node type in my PHP Unit test since I am using my database but I am getting errors.  It seems like I may have to recreate the node type in the PHP Unit test first and then create it.

Is it possible to create a node without creating the node type in PHP Unit?

Here is the command I am running to run a PHP Unit test:

php ./core/scripts/run-tests.sh --verbose --php /usr/local/bin/php —-dburl mysql://drupal:drupal@mariadb/drupal --url http://nginx --class "Drupal\my_module\Tests\ExpenseTest"

This is the error:

    Status    Group      Filename          Line Function
    --------------------------------------------------------------------------------
    Fail      Completion ExpenseTest.php     64 Drupal\my_module\Tests\ExpenseTes
        The test did not complete due to a fatal error.
    Pass      Other      ExpenseTest.php     55 Drupal\my_module\Tests\ExpenseTes
        Enabled modules: node, paragraphs
    Fail      run-tests. Unknown              0 Unknown
        FATAL Drupal\my_module\Tests\ExpenseTest: test runner returned a non-zero
        error code (255).
    Fail      Fatal erro Unknown              0 Unknown
        [17-Feb-2018 17:36:34 Australia/Sydney] PHP Fatal error:  Uncaught Error:
        Call to a member function referencedEntities() on null in
        /var/www/html/web/modules/custom/my_module/src/Expense.php:116
    Fail      Fatal erro Unknown              0 Unknown
        Stack trace:
    Fail      Fatal erro Unknown              0 Unknown
        #0
        /var/www/html/web/modules/custom/my_module/src/Tests/ExpenseTest.php(65):
        Drupal\my_module\Expense->__construct(Object(Drupal\node\Entity\Node))
    Fail      Fatal erro Unknown              0 Unknown
        #1 /var/www/html/web/core/modules/simpletest/src/TestBase.php(963):
        Drupal\my_module\Tests\ExpenseTest->testValidation()
    Fail      Fatal erro Unknown              0 Unknown
        #2 /var/www/html/web/core/scripts/run-tests.sh(804):
        Drupal\simpletest\TestBase->run(Array)
    Fail      Fatal erro Unknown              0 Unknown
        #3 /var/www/html/web/core/scripts/run-tests.sh(67):
        simpletest_script_run_one_test('44', 'Drupal\\reo_expe...')
    Fail      Fatal erro Unknown              0 Unknown
        #4 {main}
    Fail      Fatal erro Unknown              0 Unknown
        thrown in /var/www/html/web/modules/custom/my_module/src/Expense.php on
        line 116
    /var/www/html/web $

This is my code:

<?php

namespace Drupal\my_module\Tests;

use Drupal\simpletest\WebTestBase;
use Drupal\node\Entity\Node;
use Drupal\paragraphs\Entity\Paragraph;
use Drupal\my_module\Expense;

/**
 * Tests views contextual links on nodes.
 *
 * @group reo_expense
 */
class ExpenseTest extends WebTestBase {

  /**
   * Node object
   *
   * @var /Drupal\node\Entity\Node
   */
  protected $node;

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = ['node', 'paragraphs'];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->node = $this->createMyNode();
  }

  /**
   * Tests contextual links.
   */
  public function testValidation() {
    $expense = new Expense($this->node);
    $this->assertEqual($expense->getRegionId(), 4);
  }

  /**
   * Create Expense node.
   */
  public function createMyNode() {
    // Populate defaults array.
    $settings = [
      'title' => 'asdfasdf',
      'type' => 'expense',
      'uid' => \Drupal::currentUser()->id(),
    ];
    $node = Node::create($settings);
    return $node;
  }
}


texts:
I am using Panels Bootstrap Layouts. I insert bootstrap_twocol_stacked into the $content region.

I'd like to be able to access regions of that Bootstrap layout (Top, Left, Right, Bottom) in my page.tpl.php template to restructure the HTML code, but I only seem to have an access to the content. $page['content']['system_main']['content']['#markup'] variable when run e.g.

function theme_preprocess_page(&$variables) {
  dpm($variables);
}

only contains rendered HTML code and does not give me option to access Bootstrap data as array, like $page['content']['***']['top'].

I tried to look for a preprocess hook (probably one of the panels module function), but could not figure out which one.

Any hints?

What I am trying to do is to move the bootstrap region to the same hierarchy level in the page.tpl.php as other page regions, see the image below.


texts: Feeds Soap - importing items but can only add 1 item at a time?

texts:
I'm having problems with using this API to get my details from:

http://api.tradera.com/v3/PublicService.asmx?op=GetSellerItems

It imports almost all fields and create nodes as it should however the "LongDescription" is not beign imported or displayed in their reponse it is only displayed as  without any content

For testing I tried to use this public service to see where is the problem:

http://api.tradera.com/v3/PublicService.asmx?op=GetItem

Using this allows me to import all single item details but it uses the parametr as the Item ID (Auction Number) and allows only 1 item at a time to be imported

But it imports the Long description as it should

So I was trying to:

1) Import all items I want with "GetSellerItems"
2) Map ItemID into Import ID
3) Use Item ID as parametr that would be passed to "GetItem" feed parametr <-- but this part I dont know how to make

If anyone have some suggestion why the "LongDescription" may not be beign displayed in response that would be great

If not then I would need to find a way to use GetItem to import descriptions of 500 items on schedular basis


texts: How to handle multiple stores and multiple store admin users

texts:
Is it possible to create a restaurant(multi-store) online delivery system using Drupal commerce and OG? It has multiple stores(restaurants) in different locations which can be manageable by individual restaurant admins. The super-admin also have full control over all restaurants- can create products for each restaurants.

We have up to 40 restaurants and each restaurants have different products(food items). Each restaurant admin need to add/update  own products and own store addresses, delevery time, etc

I have checked with Commerce Marketplace and seems difficult to implement.

Please share your valuable thoughts.


texts: D8 Prepopulate webform full_address value field from url?

texts:
I am able to prepopulate the name, date, body etc they are single value elements.  The full_address.value field wont accept the address city state value in the url.
from views rewrite link I have tried full_address.value (changes to full_address_value in url), full_address by itself and full_address-value.
None of those work. I see the value in the url however, it doesn't prepopulate the full_address.value element.  Ideas? Syntax issue in rewrite?


texts: Editing contents of custom block referenced in paragraph type, doesn't reflect changes in node where displayed

texts:
So, I have a Custom Block type, let's call it Sidebar Links Block. In an Article, we have a Sidebar paragraph type that allows quite a few different entities, one of which is the Article Sidebar Links paragraph type.

The Article Sidebar Links ¶ type (which is one of the fields of our Article type) contains a single entity reference to a Custom Block type, the aforementioned Sidebar Links Block.

If I change, say, the Title of the Sidebar Links Block, that change is not reflected in the paragraph type's output. In other words, when viewing an Article where we changed the contents of one of the referenced Custom Block types, it still shows the old contents, before the change.

Even clearing the Drupal caches in the usual way, does nothing. What I have to do, instead, is:

Edit the Article
Move any ¶ type up or down, then move it back (this triggers the form's JS that detects changes, allowing you to re-save with essentially no real changes)
Re-save the Article

This finally causes the Title to update in the Article Sidebar Links ¶ type where the Sidebar Links Block is referenced and displayed.

Is there any way around this? Currently, whenever we update a Custom Block, we have to apply this manual fix to every single Article where it's referenced. I have a hunch that it has something to do with cache tags, but I don't know enough to be able to investigate. Does anybody have any ideas as to how this can be fixed?


texts:
I would like to add a select box dropdown (User A, User B) on the user account creation page that would redisplay the page with different fields based on the  selection.

User A

Username
E-mail Address
Account Number

User B

Username
E-mail address
Dealer Number

User A will have the User A role; user B will have the User B role.

I'm not a coder and it seems really hard to accomplish this.

Any suggestions would be appreciate.


texts: How to pull twitter feed in content type?

texts:
I need to create content type(twitter content ) where i can pull twitter feeds so that i can use that content type for entity reference and print the twitter feeds.

Can any one please help or assist me how pull twitter feeds in custom content type?


texts:
I need to display nodes in a view, based on a combination of multiple taxonomy terms, in multiple vocabularies. For example, for car sales, one vocabulary lets the visitor select one model, and another selects the color.

My custom path looks like this:

/sales/cars/models/%            // taxonomy view
/sales/cars/colors/%            // taxonomy view

/sales/cars/model/%/color/%     // taxonomy filter

URL:

mydomain.tld/sales/cars/model/land-rover/color/red

I assume I can do this by exposing filters but how?


texts: Adding node into search api solr programatically

texts:
We are importing large number of data into our drupal website with custom script and we are using Search api and Search api solr module into our website to index and search large number of data.

When we import data using custom script, Search api solr is not fetching this data and new nodes are not indexing into Solr,

If we update the node, its indexing successfully into solr.

I am trying to adding node programatically into solr but its did not work for us.

search_api_track_item_change($type, array($id));

Can anyone suggest me?


texts: A line feed gets added in the "Let's Encrypt Challenge"

texts:
I am using the Let's Encrypt module for Drupal 7, trying to follow the instructions outlined here by Redfin Solutions, to install free SSL on Acquia's servers, but I've run into a curious problem:

Each time I generate the challenge using the certbot manual mode (using sudo certbot certonly --manual -d example.com), It tells me the key authorization file from the server does not match the challenge.

  Failed authorization procedure. example.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: The key authorization file from the server did not match this challenge
  [TBgi6LPQfn7SJOTMcA67Crjrb_wGI9WKL4XAE-a17io.x6url1PIuenF6WDlPejYYJM2E4fg3wOFn8t4ghXDAGI] != [
  TBgi6LPQfn7SJOTMcA67Crjrb_wGI9WKL4XAE-a17io.x6url1PIuenF6WDlPejYYJM2E4fg3wOFn8t4ghXDAGI]

  IMPORTANT NOTES:

  The following errors were reported by the server:
  Domain: example.com
  Type: unauthorized
  Detail: The key authorization file from the server did not match    this challenge [TBgi6LPQfn7SJOTMcA67Crjrb_wGI9WKL4XAE-a17io.x6url1PIuenF6WDlPejYYJM2E4fg3wOFn8t4ghXDAGI] != [TBgi6LPQfn7SJOTMcA67Crjrb_wGI9WKL4XAE-a17io.x6url1PIuenF6WDlPejYYJM2E4fg3wOFn8t4ghXDAGI]

  To fix these errors, please make sure that your domain name was entered correctly and the DNS A record(s) for that domain contain(s) the right IP address.

As you can see, the second one (which is the one in the server), shows with a linefeed at the start. I am baffled by this, I went into the module and it just displays the value saved in a system variable, which I verified in the database. Other than that they seem to be identical, I have not been able to go further. Has anybody experienced anything similar? Any suggestions on how to fix this?


texts: Render views using admin's preview layout

texts:
I want to render a view exactly as you see them using Preview button but on the frontend.

How can I achieve that?


texts: Multiple date picker for date popup widget

texts:
I've been searching for a while, but didn't find any contribute module to store multiple date values picking them from only one date popup calendar widget, just a 2009 feature request for D6.

In D7 I have some kind of "available days calendar" content type for appointments, where I save multiple date values per node via the date popup widget.
When I add a new node,  I have to choose "add another item" to add multiple days and select them one by one via the JQuery date popup calendar or fill them one by one in textfield: a very frustrating procedure for the end user, especially if you have to select many days per month (like said in this post, without answers).

How could I hook my node form in order to have just one date popup calendar where I can pick multiple days? Probably it's just a JQuery-matter to improve usability. I've found some JQuery libraries like MultiDatesPicker for jQuery UI. Could I integrate it (or another) easily in Drupal? Do you know a good tutorial/post to do that?

Any suggestion appreciated! :-)

Thanks in advance


texts: Alphabetically ordering vocabulary terms in a translated

texts:
I have 5 English-Italian terms in a views exposed filter:
Academic | Accademico
American Studies | Studi americani
Medieval Studies | Studi medievali
Music | Musica
Reviews | Recensioni
The English language appear in alphabetical order and, as you can probably guess, the rendering order for the Italian translation is:
Accademico
Studi americani
Studi medievali
Musica
Recensioni
The desired order is:
Accademico
Musica
Recensioni
Studi americani
Studi medievali
I sort of halfway understand what is happening here. My question is whether this is something that is best remedied by hook_form_alter() or whether there is some obvious translation configuration I am missing in Views?


texts: I have a website which is built by code-igniter and drupal. i used drupal for community part. I would like to use only one login page instead of two(Drupal login & usual login). How can i modify the drupal login page. Once a user logged in never asked again when they go to drupal part(community). Is there any way to customize drupal login.


texts: Get all databases name present in Postgres Server in Drupal 7 Form API

texts: I was currently developing a module and I want to display the names of all the databases present in my Postgres server through a query. I want also to query and list the names of schemas, tables, field and field type of each databases. How can I do that? I want to do this because I was making an interface about database connections and configuration. Is that possible?


texts: How can i theme cart page from TABLE to DIV format

texts:
I am using drupal 7 with ubercart 3.
I am not able to change the theme of CART page.
By default it is picking theming of items from tapir table.
I want to have a cart page with DIV elements and not tapir.
How to go about it ?


texts: My question is ,I have a views named for sale and it is exposed with some fields . I have created other 2 instances of this view using override this feature of views now I want to alter all three views seperately , for this i have used form alter but I am not getting the seperate ids for delta nor the #id for those .how can i alter those delta .


texts:
I'm trying to configure redirects on a Drupal site using Apache web server. I'm trying to implement what described in Remove /web part from a Composer based Drupal site, but I cannot get it to work. I have several Drupal sites running in /var/www/html/drupal. The configuration in the httpd.conf file is created with the following.
- name: create drupal httpd conf
    copy:
      content: |
               <VirtualHost *:80>
                 ServerName qsd
                 DocumentRoot /var/www/html/drupal
                 <Directory />
                    Options FollowSymlinks
                    AllowOverride All
                 </Directory>
               </VirtualHost>
      dest: /etc/httpd/conf.d/drupal.conf

- name: allow override /var/www/html
    copy:
      content: |
                <Directory "/var/www/html">
                  Options Indexes FollowSymLinks
                  AllowOverride All
                  Require all granted
                </Directory>
      dest: /etc/httpd/conf.d/app.conf

I've added the following lines to the settings.php file.
if ( isset($GLOBALS['request']) && '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME') ) {
    $GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}

Now I'm trying to get the .htaccess file correct for the Drupal site which is in /var/www/html/drupal/app. In /var/www/html/drupal/app/.htaccess, I have the following lines.
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Redirect to the sub-directory because that's where Drupal is installed.
  RewriteBase /app
  RewriteRule (.*) web/$1 [L]
</IfModule>

In var/www/html/drupal/app/web/.htaccess I have the following lines.
RewriteBase /web

When I visit https://example.com/app, I get redirected to my OIDC provider but redirect_uri is missing the /app part. When I visit https://example.com/app/user/login I get a 404, but before adding the .htaccess file, https://example.com/app/web/user/login was working.
Any help would be much appreciated.


texts: Pagination for image field in one node page

texts:
I made a custom node type with following fields:

Title
Body
Image (Unlimited)

I need to have a few pages from this content type and on each page I need to print the title field, the body and all images, but I need a pagination for the image field - lets say 9 images per page. (pagination only for one field in current node).

Is that possible without using Views, and using theming? For example, making a custom "field--field-images.tpl.php" template file, but instead of using the following code, printing the field with Pagination.

foreach ($items as $delta => $item):
  print render($item);
endforeach;


texts: How to act on paramters being passed to the homepage?

texts:
We have external sites direct users to our homepage. These external sites add information to the url which add additional information. This is an internal academic site so these parameters look like, for example, http://www.example.edu/?dept=classics
How can I get our homepage to detect and act on these parameters?


texts:
I am trying to create an alert when a date is selected that falls within 30 days of today using the following script:

(function ($) {
  $('#edit-select-date').datepicker({

    onSelect: function () {
      var date = $(this).datepicker('getDate');
      var today = new Date();

      if ((new Date(today.getFullYear(), today.getMonth(), today.getDate() + 30)) > date) {
        // Do something here.
        alert(123);
      }
    }
  });
}(jQuery));

Unfortunately this is not working and am getting a $(...).datepicker is not a function in dev console. If datepicker.js is not being used is there a way I can have an alert trigger when the date select is +30 days from today?


texts: Get an image with style url from an URI in twig

texts:
So thanks to 4k4 I finally managed to get my original image URI in a field template via

item.content['#item'].entity.uri.value

and with

{{ file_url(item.content['#item'].entity.uri.value) }}

I would get the url of the original file.

I have the image style information via

item.content['#item']['#image-style']

that 'medium' is requested

A PHP solution is already available here, but how do I do this in TWIG?

There are some attempts on creating a filter for 8.1 here - but that doesn't help me currently.


texts: Re-creating complex CSS footer layout in Drupal

texts:
I've been given some HTML & CSS files by our university web designer and need to replicate essentially the same layout into the library website I'm creating in Drupal. The footer (pleased see attached link) has been the biggest hurdle so far. With this type of column-based inline layout consisting of menus (which I haven't created as menus yet), should I be creating new regions in my .info file to handle each menu? Also with the university address info. and icons, should this be another region or should I add custom variables and HTML so it is just part of the main footer region? Or is there a way using Blocks, Panels or another module to create this layout more efficiently?

One last thing-as you can see the columns have three headings (Who Are You?, Quicklinks, and Admissions) so I plan to create a menu with each name as title. What's the best strategy to deal with the overflow of menu items over more than one column without having to create six separate inline regions for layout purposes?

Thanks for any assistance, guidance, or suggestions. This site has been an invaluable resource in learning Drupal over the past few months and I've learned a lot from all your posts, responses & comments to each other.

The footer design:
footer http://dl.dropbox.com/u/664958/footer.png


texts: Change allowed file types based on certain criteria

texts: An admin comes onto the website and creates an assignment which is a content type.  Students come onto the website and create submissions that point to the certain assignment.  There is a file upload field where students can upload their submission.  I want to make it so when the admin creates the assignment, he/she can choose which file types are allowed.  Is there a field that will automatically process what file types the admin chose so that a student can only upload that specific file type?


texts:
What is difference in functionality between drupal_render() and drupal_render_children() ?
When I used drupal_render for $form derived as follows from hook_theme

function hook_form_alter($form,&$form_state,$form_id) {
if ($form_id == 'content_type_a') {
  $form['#theme'][] = 'custom_content_type_a_node_form';
}

}

function hook_theme() {
  return array(
    'custom_content_type_a_node_form' => array(
       'render element' => 'form',
    );

}

Then inside a THEMENAME_custom_content_type_a_node_form

function THEMENAME_custom_content_type_a_node_form(&$variables) {
$output = '';
$form = $variables['form'];

$output =
Some HTML code
;

$output .= drupal_render($form);

return $output;
}

While using drupal_render in the above function the page was going into loop and function was being called by endlessly
But when I replaced that with drupal_render_children($form) it did not go into an endless loop
What is the reason for such a behavior?


texts: logged in users only for /user in user menu

texts:
In my user menu I have a link for /user which produces a my account link which works as expected.  In the menu admin (logged in users only) appears next to it.

Now, when I translate the item to produce a link to /user I have found that 'logged in users only' does not appear next to it and that it is shown whether the user is logged in or not.

Is this a known bug?  Anyone know how i might solve it?

Thanks,


texts: IMCE: Prevent deletion if file is in use

texts: Does any one know of a way to prevent a file from being deleted through IMCE if the file is in use?  I saw this feature requested http://drupal.org/node/628246 and there is a comment to state that this feature is already in dev but I'm not finding that this is the case.


texts: How do i verify users passwords from the hash in the database without drupal core logic

texts:
I oversee a proprietary CMS with a headless Drupal back-end. We use Drupal to authenticate users, manage permissions and roles, and store HTML for almost 13, 000 pages. As our needs have grown, our custom code base has expanded, and Drupal's role in the project has diminished. Most of the app logic is now handled by a Node.js Express server. The Express app has access to the Drupal database and is already performing some read operations on Drupal tables.

I'd like to start migrating some features off of Drupal and onto the custom app. The one I'm most concerned about is authentication.

Authorization is currently setup as follows. User visits a non-Drupal app landing page. Submits username and password to the Express app, the app uses Drupal's rest login to check for a successful logon. If successful, the app uses standard Express practices to create a session and hand out a cookie.

I'm hoping that the express app can start checking passwords in the database directly, instead of using the Drupal API. I'd prefer that my users not have to reset their passwords and I'd prefer not to disrupt some relationships i have built with the Drupal user tables.  In summary, my questions are these:

How can i check that the hashed password in the DB matches the password submit by the user?
Is the salt value in the settings.php file the one used encrypt passwords in the database or is that salt value somewhere else?

2a. NEW QUESTION: According to the Drupal Docs an unique salt is generated for every user and store in the database, possibly concatenated with the hashed password. Where are these unique salts stored and if they are concatenated with the hashed password, how can I separate them from the salted password?  Are the salts concatenated on the end of the hashed password or the beginning.  Are they always the same length?  What is that length?

What algorithm or module does Drupal use in combination with the salt value to created hashed passwords?
If find the algorithm and salt values is it likely that this system is portable to node.js or are there php or Drupal idiosyncrasies that would prevent a migration.

Thank you in advance for you consideration. I realize it's a little tacky to ask questions about moving off of Drupal, but I'm still a big fan of the platform and the community. It's been very good for our operation.

Tony


texts: Showing a View of a Paragraphs block in a node with contexual/relationship filters

texts:
I have a slightly complicated question. So i'm experimenting with nested paragraphs where the parent paragraph is a container for another paragraph. In this case, i'm making an Agenda/Event program where the parent container is the 'agenda' paragraph type and the children are basically just rows created by an 'agenda-row' paragraph type. The Agenda paragraph type has a field reference that references the child paragraph.

All of the above is working fine and as expected, however, now I've created an 'Events' content type. The event content type has another entity reference field where you can only choose the 'Agenda' paragraph type and then you fill in the agenda information using it's child paragraphs. From here what I would like to do is create a View block of the 'agenda' and have the block contextually filtered by the event node it's attached to. I have not for the life of me been able to get this working and i'm hoping someone has some experience with this!

What I've tried:

Current model: Changed the display of the 'Agenda' paragraph type to display the View block instead of the content field.

Various Changes:

Set the View contextual filter to ID and "Provide default value" of content ID
Set relationship of the view to be "Relate each Content with a field_event_agenda_program set to the paragraph."
Set the View contexual filter to default
Changed the display of the 'Agenda' reference field in 'Events' to hidden and manually added the View block to the Events content type.
Tried various ways of filtering the View block with "Target ID" of the paragraph


texts:
i am using simplenews module in drupal7 . i mentioned simplenews block on home page.
 when i enter email id it shows message "You will receive a confirmation e-mail shortly containing further instructions on how to complete your subscription." on home page . now i need to show this message on  new page(not on home page).
also i want to change the text of that message

Any idea ?

Thanks in advance


texts: How to setup a csv-file to import image-paths into an image-field via Feeds-module?

texts:
I import a csv-file via Feeds-module and got stuck with the images for a node. All the other fields are importet as wanted, except the path for the image-field.
The images are already uploaded to the directory below...

An example for a row value of a path:
sites/all/default/files/images/name.JPG

After the import, the image field is just empty:

Any help would be highly appreciated!
Thanks in advance...


texts: Which Drupal log file is available to proof when exactly some content was deleted and by whom?

texts:
Somebody claimed that content has disappeared from their site. Of course like magically. No one has deleted it, they said.

How can I find out if content was deleted and by whom? Do I have to set up rules to notify me? Or is there a log that I'm overlooking? I already looked into admin/reports/dblog without success.


texts: How a module can override theme suggestion?

texts:
Basically it was How to tell Drupal to look for templates in module directory? but I'll reword it, as I don't want to define a new theme (reason was already given).

What I want to do: in my module I have a file node--attach.tpl.php which is a modifed version of node.tpl.php. Now I want that, if view_mode = 'attach' then this file is used. Also, theme should be allowed to override it with its own node--attach.tpl.php in theme folder.


texts: Time localisation - "@count hour" (ago) instead of "1 hour"?

texts:
Short story:

When Drupal 6 display time in format "x ago" (for example "3 hours ago"), there are two strings - for singular and plural. Singular string for hours is "1 hour", plural string is "@count hours". My question is - is this a bug? Shouldn't be there "@count hour"?

Long story:

Today, something strange happened to me. I went back to my site where I posted a comment yesterday around this time. However, in recent comments block, there was my comment marked as "1 hour 15 minutes ago" (in my language, not English - that's important!).

After I checked that time zone, server time and comment time are correct, I started debugging the Drupal. Finally, I found the culprit; it's the method format_interval(). At start of the method, there are strings definitions. For hour it's '1 hour|@count hours' - 1 hour for singular, @count hours for plural.

I found out that my comment was posted 21 hours ago and that locale_get_plural() function returned 0 - which is interpreted as singular.

And that's the problem - in my language we read "21 hour", NOT "21 hourS"! However, the count variable is not used, so for each numeric value read as singular (1, 21, 31, 41, ..., 91, 101, 121, 131, ...) (note: yeah, 11 is not singular in my language), the displayed value will be always 1!

I'm writing about hours, but this is same for all other values - years, weeks, minutes and seconds. Experimentally, I changed translation of "1 hour" to "@count hour" (in my language, not English) and the displayed time become correct. However, this is not clean solution, so my question is: is this a bug? If not, how should I solve this correctly?

Notes

I use Drupal 6
Happening on my machine (Xubuntu 14.04) and server (some Gentoo)
My language is Czech


texts:
I am using Rules with Rules Once Per a Day. Although Once Per a Day is not part of the default Rules, the general core of my question applies to default Rules.

I want Rules per Once a day to activate either on Monday or Thursday. To do this I am using an OR condition:

But it did not work. Is my OR statement set up correctly?

I’ve looked at several Drupal Rules tutorials about creating OR conditions, but they all seem to give different advice. Some say you need a separate OR grouping for each condition, others say all the conditions need to be in one OR group.

NB: My rule exists on the main rules screen and NOT under the components tab.


texts: ajax form, send data from js modal to form

texts:
I have the following form:

When I click the "Add Filter" button, I need to open a modal with a select input element. Then I need to send the user's choice back to the Drupal Form instance and extend the original form, based on the user's input.

I'm not sure of the best way to do this. 2 options I've thought of are:

Is it possible to have the "Add Filter" ajax callback send an "OpenModalDialogCommand" with a new form, then have the new form "submitForm" method send the data to the original form?
Another possibility would be to collect the data clientside and send it to the original form.

However I'm not sure how to get the user data into the original form in either of the options above.


texts: taxonomy-term--vocabulary.tpl.php still shows tagged content

texts:
I'm trying to show on my taxonomy term page only what's in taxonomy-term--myvocabulary.tpl.php, but :

If I enable the taxonomy/term/% view, what's in my template is not displayed
If I enable the term panel page, what's in my template is not displayed
If I disable that view and that panel, what's in my template is displayed, but content tagged with that term is also displayed.

EDIT: My template outputs several lists of content, uses APIs and webservices, I can't really explain here what it's made of, it's 350 lines of code :) Anyway, I'm sure the content of it is not related to solving that problem.

Q: What do I have to do to avoid processing and displaying of that tagged content ?


texts:
I'm working with Page Manager and Panels. I'm adding content (panels) to each custom page layout, and every panel has a title by default. Is there any way to add additional information, common to every panel, like a subtitle?

In other words, is there a way to add fields to the Panel entity?

Thanks!


texts: weird error - failed to open stream - .module file in theme path?

texts:
I am just editing empty template, creating regions and so on. After I first time cleared cache weird error started to appear at every cache clearing:

  Warning: include_once(C:\xampp\htdocs\hkmzvolen/sites/all/themes/activit/activit.module):
  failed to open stream: No such file or directory v
  _theme_process_registry() (riadok 565 z C:\xampp\htdocs\hkmzvolen\includes\theme.inc).

  Warning: include_once(): Failed opening
  'C:\xampp\htdocs\hkmzvolen/sites/all/themes/activit/activit.module'
  for inclusion (include_path='.;C:\xampp\php\PEAR') v
  _theme_process_registry() (riadok 565 z C:\xampp\htdocs\hkmzvolen\includes\theme.inc).

It is trying to include activit.module from theme folder and not from module folder. There are a custom module and custom theme with the same name - activit. But there is no any activit.module file in theme directory nor I am including the file anywhere in my code.

Why is drupal trying to include this nonexisting file from my theme path?


texts: How to use FormBase with form_alter hook?

texts:
I am trying to edit the node creation form in order to add multiple 'tableselect' fields in it. My module adds options in a select field and add an ajax callback triggered by the 'change' event of that select. I want the ajax callback to return a new 'tableselect' field.

I have created a custom module and I do everything (hook + ajax callback) inside a mymodule.module file.

 <?php
use \Drupal\Core\Form\FormStateInterface;

/*
** Implement hook_form_alter
*/

function pages_module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
 if ($form_id == 'node_page_form') {
    $connection = \Drupal::database();

    $query = $connection->select('templates', 't');
    $query->fields('t', ['name', 'tid', 'components']);
    $result = $query->execute()->fetchAll();
    $form['select_template'] = array(
        '#type' => 'select',
        '#title' => t("Select a page template"),
        '#required' => true,
        '#field_suffix' => '

',
        '#ajax' => [
            'callback' => 'pages_module_mySelectChange',
            'event' => 'change',
            'wrapper' => 'dynamic-fields',
          ],
    );
    foreach ($result as $template) {
        $form['select_template']['#options'][$template->tid] = $template->name;
    }
  }
}
function pages_module_mySelectChange(array $form, FormStateInterface $form_state)
{
$header = [
'first_name' => t('First Name'),
'last_name' => t('Last Name'),
];
$options = [
1 => [
'first_name' => 'Indy',
'last_name' => 'Jones',
],
2 => [
'first_name' => 'Darth',
'last_name' => 'Vader',
],
3 => [
'first_name' => 'Super',
'last_name' => 'Man',
],
];
$form['table1'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
);

return $form['table1'];
}

My problem is that in order to create tableselect fields you have to be in a class that extends 'FormBase' and hooks can't be used in classes I believe. I'm a bit clueless about how to process in this case.

Maybe hooks can be used within classes ?

Maybe I don't need FormBase to create a tableselect field ?

Maybe I should separate my code in two parts, like calling a custom class method from my hook ?

Any help?


texts: How do I use $form_state['storage']['my_key']?

texts:
The question is clear from the title itself .

I looked in the api specified in :  https://www.drupal.org/node/2310411 .

But it only mention to convert

$storage = &$form_state['storage'];
$form_state['storage'] = &$storage;

to

 $storage = &$form_state->getStorage();
 $form_state->setStorage($storage);

But not a key in the $form_state['storage'] ? any help is appreciated .


texts:
I have created no of nodes as content type as Article in my website(techladder.in). But I am not getting the right file where I can override the content of the file.

For example, I need to display author information above the Disqus comment section.

I was able to override the node file in my theme at following path:
theme/templates/content/node--article.html.twig as following:

     {%   set classes = [
        'node',
        'node--type-' ~ node.bundle|clean_class,
        node.isPromoted() ? 'node--promoted',
        node.isSticky() ? 'node--sticky',
        not node.isPublished() ? 'node--unpublished',
        view_mode ? 'node--view-mode-' ~ view_mode|clean_class,   ] %} {{ attach_library('classy/node') }}

      {{ title_prefix }}   {% if not page %}

          {{ label }}

   {% endif %}   {{ title_suffix }}

      {% if display_submitted %}

            {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
            {{ metadata }}

           {% endif %}

        {{ content }}

{% if teaser %}

 {% endif %}

But here, I am not able to find a file where I can override the content of the node.

Does anyone has suggestions how can I do it in Drupal 8.


texts:
I have a client with a D8 site who wants curly quotes and apostrophes on all rendered content. I was able to do this for the page titles with this preprocess function:

function mytheme_preprocess_page_title(&$variables) {
// Load the node entity from the current route
if ($node = \Drupal::request()->get('node')) {

    // Get the title
    $title = $node->getTitle();

    // Replace left quotes
    $title = preg_replace('/"(?=\w)/', '&ldquo;', $title);

    // Replace right quotes
    $title = preg_replace('/(?<=\w)"/', '&rdquo;', $title);

    // Replace single quote/apostrophe
    $title = str_replace("'", '&rsquo;', $title);

    // Return the title variable
    $variables['title'] = t($title);
}
}

Is there a way to do this for the body field as well? hook_preprocess_field isn't getting me anywhere.


texts: Sorting a multiple node reference field in view based on another field of the node

texts:
I have a view that whereby one of the fields (a node reference field) has "multiple fields settings" checked. So it has multiple values per row.

I want to sort these values based on another field of this referenced node (field_order).

I have added this to the view, but the sort does not occur. Is there any way to sort a multiple field based on a referenced field?


texts: Stop Drupal from redirecting to "Reset Password" on user account activation

texts:
I have a Drupal dev site where users register, then get sent an email with a link that they need to click in order to verify the account. The issue is that link directs them to a page with the title being "Reset Password" (but it doesn't actually enforce a password change). How do I change the page that the user is directed to when activating their account? It shouldn't be enforcing this.

I am also using the https://drupal.org/project/logintoboggan module to improve the registration process, and perhaps this is causing the issue? I am using the "Set a password" option on the plugin to force users to create a password when creating an account, so therefore the registration process should not be enforcing the user to then reset their password.


texts: How can I add extra text fields to the image field when adding/ editing nodes?

texts:
What is the best way to add additional text fields to the image module, other than the title and alt value, when adding/ editing content? Is there a module which already does this?

Edit

I've read through Add custom fields to image field and unfortunately this fella got stuck and I guess this was at 7 times. The fieldable files module is no big help. It does a lot of magic but it doesnt effect images added via node entity form.


texts: How can I POST x-www-form-urlencoded data from REST API plugin?

texts:
In Drupal 8, the REST API plugin can have a serialization format, such as xml or json. This affects the accepted "request formats" for a resource.

Is it possible to add a format for application/x-www-form-urlencoded handling for the REST plugin? or does this need to be handled in a form controller instead?


texts: How to change "New content" text in entity connect autocomplete edit/add buttons?

texts:
using entityreference autocomplete widget (field-widget-entityreference-autocomplete) with entity connect I have the buttons "New content" and "Edit content".

How can I just rename them in "New" and "Edit" respectively ?
These are coded in the value field of the input, hence I can't change them just with CSS..

I think I could do it on a form specific way using hook_form_alter, but I would like to apply it to any form where the widget appear.

I tried already hook_field_widget_form_alter(&$element, &$form_state, $context) but then I got lost, I am not sure it's the right place..


texts: How to make a clone of a website without contents

texts:
I need to create a clone of one of my website.
It will be the same (modules, views, content types, template etc...)
I've already done once by coping everything and then deleting the contents and the users.
Is there the right way? I will need to do 3-4 copies of the website.
Is there any module that can help me(a part from backup and migrate) to do these copies? Should I create an kind of "distribution" enabling modules and creating content type, similar to the master one, from the scratch and then export the database?

If I do as I always did (clone and delete contents and users), how can I reset the content id?

Thanks in advance


texts: Make taxonomy term only link to term page if multiple nodes have that term?

texts:
I have a free tagging taxonomy term field. How can I make it so on the node page the term only links to a term page if there are multiple nodes with the same term?

Otherwise this link and page are pointless, and are bad UX as the user will be expecting to see other similar nodes. So if there is only 1 node with a term then I would like the term to not be a link.

UPDATE ive tried creating a custom module called taxonomy_link_my.

In my taxonomy_link_my.info

name = Taxonomy link my
description = Stop taxonomy term being a link if no other nodes are tagged with the term.
core = 7.x

In my taxonomy_link_my.module (topic is the vocabulary name).

<?php

/**
 * Implements hook_node_view
 */
function taxonomy_link_my_node_view($node, $view_mode, $langcode) {
  if (isset($node->content['topic'])) {
    foreach ($node->content['topic']['#items'] as $delta => $item) {
       if (count(taxonomy_select_nodes($item['taxonomy_term']->tid)) < 2) {
         $title = $node->content['topic'][$delta]['#title'];
         $node->content['topic'][$delta] = array();
         $node->content['topic'][$delta]['#markup'] = $title;
       }
    }
  }
}

However it seems to have no effect.


texts: Entity View Attachments (EVA) with multiple contextual filters?

texts:
I have the following content types which are also organic groups;

Country (group)
Region (subgroup of country)
Area (subgroup of region)
Neighborhood (subgroup of area)
Facilities (subgroup of Neighborhood)

I have a a leaflet map view as an Entity View Attachment with these Entity content settings;

Entity type: Node
Bundles: Country
Arguments: id

I would like create country maps showing all of its corresponding subgroups ie: Regions, Areas, Neighborhoods and Facilities.

Unfortunately I have only managed to get the "Region" content type appearing on the map using the "OG membership: Group ID" as a contextual filter argument and using "current og from context" for "When the filter value is NOT available".

Any ideas for how I can use multiple arguments?


texts:
I have a form that when submitted and validated, needs to be redirected to a page to create a node (node/add/factura-tmn), but I want to send a parameter to this page. Is it possible?

I currently have the following code:

function add_invoice_file_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'node/add/factura-tmn';
  drupal_redirect_form($form_state);
}


texts:
I had downloaded the libraries module. I then watched another tutorial which told me to CREATE  a libraries directory in the sites/all folder. WHich I did, I then downloaded the colorbox plug in and pasted it in the empty libraries directory. I am now getting the following error:

Fatal error: Call to undefined function libraries_get_path() in /Applications/XAMPP/xamppfiles/htdocs/drupal/sites/all/modules/devel/devel.module on line 407

I deleted both libraries directories to start from scratch but the error is still there. How do I fix this?


texts: Views PDF not generating custom style pdf output

texts:
I am unable to print my css styled content to render pdf output,I am using views pdf module for a project,where my views are rendering my style but when pdf is generating no styled output coming.

Any help is needed.


texts: Adding multiple nodes using a single form

texts:
I want a user to be able to create n nodes of type "Photo Gallery Photo" using a single form.

The node would have the following fields:

name (For the entire upload; only shown once)
phone number (For the entire upload; only shown once)
town (For the entire upload; only shown once)
email (For the entire upload; only shown once)
title (per photo)
description (per photo)
photo (Image, per photo)
galleries (node reference checkboxes, per photo)

Is this possible?


texts: How to designate a region for regional shipping charges by weight with drupal commerce?

texts:
My commerce shop needs different shipping charges by weight to different regions in the U.S.; the east coast, the mid-west, and the west-coast.

Such that a 6oz package would have three different shipping charges depending on where it was going.

I would imagine this need three different weight-based rules for shipping, I am specifically wondering about how to implements the conditional statements for these. I would imagine one way to implement this would be a series or AND/OR statements in the conditional, but for a case like the US, thus means sometimes 20+ AND-OR conditions on a state by state basis.

Is there an easier way to designate a geographic region as a collection of states? Or is this the best and only way to implement this?


texts: Adding to that list of display options that includes "Default" and "Teaser"

texts:
Under structure > content types > manage fields, there are display options in the upper right. The system-defined ones are "default" and "teaser" but I have seen "tokens" and "colorbox" added by contrib modules.

What hook or function do I use to give my modules access to create these new content type displays?


texts: What's the best way to insert a user reference field value into the database?

texts:
I use the references module. I have a custom form, into which I capture names into a user reference field via the autocomplete widget. So, on the form, if a user types Joe, the following appears in the input box:

Joe [uid: 5]

Now, I do not want to insert this into my database as it is because my 'Name' field is expecting just the uid. So I need to pass '5' to the database, not the string Joe [uid: 5].

To accomplish this, before I write my record to the database I pass the string Joe [uid: 5] through this code:

// * Search for match (integer) to regular expression and put in $integer.
preg_match_all('!\d+!', $form_state['values']['name'], $integer);

// * Return string representation of array elements.
$name_uid = implode(' ', $integer[0]);

$name_uid now contains '5' and is ready to be inserted. Is there an existing function that already does this? or does anyone have a better way?

The downside of my method is that you cannot have numbers in names, like 'Joe 2'. I've looked in user_reference.module, but it's not obvious, to me, how they do it.

Thanks


texts:
Can any body help me out how do I accomplish social networking login using login using loginprovider.

I have done this for website using oauth connector.

I tried lot but no success for mobile services. What should I pass in parameters, end point I got is something like http://www.example.com/oauthlogin/api/login/info.json. Any body having  idea how legged process is done through oauth 3.x and services 3.x. Or any other options available?


texts: Set a boolean (single on/off checkbox) value while creating a node

texts:
I am creating a node (in Drupal 8) with the following code.

use \Drupal\node\Entity\Node;

$node = Node::create([
            'type' => 'calendar_data',
            'title' => 'testing finaly 1111111111111111111111111 ',
            'field_current_month' => date('Y-m-d'),
            'field_date_type_value' => '1',
        ]);
$node->save();

The value of field_date_type_value is set to 0, not the expected value (1) I am using in the code.


texts: How can we theme menu blocks in drupal 6

texts:
I decide to theme menu blocks in my drupal 6.x.

I have copied block.tpl.php into my theme folder and I have renamed it to block-menu.tpl.php

but it seems it doesn't work !!

How can I modify the theme for menu blocks?


texts: Check if administration toolbar is visible

texts:
How can I check in a theme-file.tpl.php if the administration toolbar is visible or not?

The easiest, but not nicest way to check that, if the user has certain user roles. But is there a way to check that, without checking the roles?


texts: How to fix menu links going below the fold?

texts:
How do you fix menu links in the admin toolbar (drop down menus) from going below the fold when you have many different bundles?

For example, the "Paragraph Types" submenus often go below the fold because they sit alphabetically low on the "Configuration" drop-down.  If you have many paragraph types, it's hard to access them from the drop-down submenus.


texts: Fetch third Level Depth Data from taxonomy with performance

texts:
I have taxonomy with 4 Level State->District->Block->Villages. I want to get all villages of all Blocks of all Districts of a State.

I have done it by loops but my performance is very slow. please help me this take more time than expectation and very slow process.


texts: How to add additional query parameters to a views page url?

texts:
I have a view with two displays as page. I need the URL of the pages as gallery?display=grid and gallery?display=slideshow and filter the views based on the additional parameter 'grid' or 'slideshow'.

Can anyone help me with this?


texts:
I have 2 content types. For example UserGroup and User. UserGroup has Entity reference field and there are unlimited of Users. I would like to show in views something like this:

User group name

User 1
User n

User group name

User 1
User n

and for the User their fields (contact, birthday etc.)

Now I set relationships field_users (which is set in UserGroup) and Format -> Show -> Fields. There are Name (UserGroup), Name (User via relationship) but I see:

UserGroup1

User1

UserGroup1

User2

and etc.

Please tell me how can I fix it. Thank you.


texts: Deploying to multiple hosts using Webistrano

texts:
We're using Webistrano to deploy our Drupal sites to testing and production.

The recipe we're using is as follows:

namespace :drupal do
  desc "symlink_files"
  task :symlink_files do
    invoke_command "ln -s #{deploy_to}/shared/files #{deploy_to}/current/drupal/sites/default/"
    invoke_command "ln -s #{deploy_to}/shared/settings.php #{deploy_to}/current/drupal/sites/default/"
  end

  desc "refresh_configuration"
  task :refresh_configuration do
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} -y fr-all"
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} -y updb"
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} cc all"
  end
end

after 'deploy:symlink','drupal:symlink_files','drupal:refresh_configuration'

This method is working great for single-host deployments, but fails for multi-host deployments. The reason is that the refresh_configuration task will run on each host, causing all kinds of race conditions and corruption on the central database server.

My question is, can anyone suggest a way to fix the Webistrano setup to only run refresh_configuration task on one server only?

PS. I'm not interested in changing the deployment system to Aegir or anything else.


texts: How can we get Block Bundle Type for block in code?

texts:
I am trying to override block content by using hook_preprocess_block(&$variables). I was expecting to find bundle type in $variable, but not getting anything related to this.

Here is kint display of $variable inside the function -

More Info - This is a block type (say content_slider) created from Drupal UI & a block (say content_slider_homepage) is added.


texts:
I have a view using one content type: fee_schedule
The view contains fields for species, keywords (hidden), and the title.

The filters need to show ALL species except when searching by keywords.  The keywords field and the title field are combined using Global Combine fields filter that is exposed.

Here's the issue:  When someone uses the exposed species drop down, it works as expected.  It shows the 'All' species and which ever species they selected.  But when they put in keywords (like 'bulk') then it still shows All species (even though these species do not have 'bulk' as a keyword), along with the species that do have the keyword 'bulk'.  When searching using keywords, I need the view to display ONLY the species with the keyword.  When searching by species, I need it to show the content with All species and the specific species they selected.

Here's the link to the view: https://vdl-dev.umn.edu/services-fees

I am using and/or filtering as follows:

Content Published: yes AND
Content Type: Fee Schedule AND
Global Combined fields filter exposed (title and keywords) AND
Content Species (each specific species but not All)

OR

Content Species (All is only selected)

Maybe I can't do what I need to do using views.  Any help much appreciated.


texts: What cache tables should I keep on Memcache on a multi-site server?

texts:
I can spare 64-96Mb of memory on my VPS running a dozen Drupal 6 and 7 sites. In this situation, what cache tables should I keep on Memcache, and why?

I realize cache_update and cache_form are not proper caches, but my question rather assumes it's better to have a few well-cached tables than lots of poorly cached ones. Is this assumption correct?


texts: TB Mega Menus: Image block doesn't show anything

texts:
I'm building my first page with Drupal, creating a subthem of Omega 4, and for the menus I chose to use TB Mega Menu. The problem is that I want one of the columns of the drop down to contain an image. For that, I create a block and add that image to it, having it this HTML code:

But when I add that block to a column, it shows nothing. If I check the option to show the block title, it shows the block title, but no image.

Any help on that? I have searched for any issues like mine, but no luck.

Thanks in advance.


texts:
I searched for a PowerPoint player (ppt from Microsoft Office) but I couldn't find what i needed.
Is there a module that can display PowerPoint files on Drupal sites?


texts: How to add phone number field to simplereservation/add page

texts:
I have installed the simplereservation module. I can add a reservation by visiting xxx.com/simplereservation/add page. I do not see phone number field on that page. How to add phone number field to the add page?

I think comment field is needed. I copied the comment form and pasted there. Then I edited the form for phone number as below:

  $form['phone'] = array(
    '#type' => 'textfield',
    '#size' => 50,
    '#title' => t('phone'),
    '#default_value' => $reservation["rcomment"],
    '#description' => t('You can add a phone for your reservation.'),
  );

When I go to simplereservation/add page, I do see the comment, phone number field plus other fields. However, after I enter the reservation info plus the phone number, I click Save this reservation. On the reservation page, I see other info except the 'phone number' + 'this reservation is for'. How can I see the phone number on the reservation page?

I have not learned how to use hook yet.

I did look at the simplereservation.install file and i saw how comment filed is defined in simplereservation_schema(). I simply copied the comment code and modified for phone field as below:

 'rcomment' => array(
    'description' => 'Text comment that accompanies the reservation',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ),
    'phone' => array(
    'description' => 'phone no of customer',
    'type' => 'varchar',
    'length' => 25,
    'not null' => TRUE,
    'default' => '',
  ),

I still see the phone field add page not on the reservation page.

In sr.module > i have added

$form['phone'] = array(
'#type' => 'textfield',
'#size' => 50,
'#title' => t('phone'),
'#default_value' => $reservation["myphone"],
'#description' => t('You can add a phone for your reservation.'),

);
In sr.install

'phone' => array(
'description' => 'phone no of customer',
'type' => 'varchar',
'length' => 25,
'not null' => TRUE,
'default' => '',

),
Disabled the module > Uninstalled the module > Cleared the cachse > Enabled the module > Created 2 items bc items were gone.
xxx.com/sr/add

Error:
Notice: Undefined index: myphone in
simplereservation_add_edit_form() (line 545 of ..../sites/all/modules/simple_reservation/simplereservation.module).

line 545:

   '#default_value' => $reservation["myphone"],

Please advise.


texts: db_insert error delta "doesn't have a default"

texts:
When I execute this code:

db_insert('field_data_field_room_rates')
    ->fields(array(
      'entity_type' => 'node',
      'bundle' => 'rooms',
'entity_id' => $roomno,
'revision_id' => 0,
'field_room_rates_target_id' => $mynode->nid
    ))
    ->execute();

It returns back an error saying "General error: 1364 Field 'delta' doesn't have a default value".  Any quick way to work around this without doing a count to respect the order?  I don't want to give it an arbitrary number.

Thanks in advance!


texts: Read field value and pass it to section style atributes only for node page

texts:
I have a color field in content type -> page fields. And i want to read the values of this field and pass this value as a background color(bootstrap subtheme) to element  for main content ( - from page,tlp.php). And only for node type -> page.

In my template.php i tried to use function theme_preprocess_page. My code:

function theme_preprocess_page(&$vars) {

    if (isset($vars['node'])) {

        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type . 'page';

        // check the node type and specific field in not empty
        if (($vars['node']->type = 'page') && (!empty($content['field_color']['#items'][0]['value']))) {

            //read the value of color field
            $bg_color = $content['field_color']['#items'][0]['rgb'];

        }
    }
}

but i dont know how to pass the value of color field ($content['field_color']) to section style attributes. Should i use $vars['attributes_array']['style'] ? and how to pass it to section element style.

Help please.


texts:
I would like to disable some form elements within a Profile2 form in Drupal 7 (ie still visible but not editable). I figured using hook_form_alter would be the way to go but I can't figure out where I need to set the ['disabled'] field to true.

Here is the code that I have:

$fields = field_info_instances('profile2', 'student')
if ($fields) {
  foreach($fields as $field) {
    $field['#disabled'] = true; <- don't know what attribute to set here
  }
}

In Drupal 6 this seemed pretty straight forward but using dsm($field) is not helping me determine what field attributes need to be set. I have Googled this and looked at the Drupal 7 API and I am still lost.

I am hoping someone can help me out here.

Thanks.


texts: After module installation, updating translations still at 0%

texts:
I installed Drupal 8.5.6, in French. It seemed to work well, apart from no CSS working, but I corrected by unchecking CSS aggregation in the performance settings.

I decided to install some modules, one by one. Every time I install a module, after I click on the Install button, I get this.

After waiting more than 2 minutes (which is abnormal to me), I click on the Extend link to see if the module I am trying to install has been installed. The module seems to be installed, since it is checked, but it is not working.

So I uninstall that module, and try installing another module, but I get the same result.

Notice that the first modules I tried installing were the Coffee and Admin Toolbar modules. They get installed properly offline.

I have also noticed that using Drupal 8.2.5 everything is fine.

Is there any version problem, or am I doing something wrong?

I changed the PHP version using on the host to PHP 7.1.


texts: Is it possible to run command of the same functionality as drush pm-download from hook_install or hook_update_n? If not, what other alternative solutions do I have to automatically download and install modules and dependencies from a custom site deployer module?


texts:
Hi I'm trying to understand the main menu but it appears to be self populating with the product categories category plus a built in search API (All Products). The main menu also appears disabled in the blocks area?
Can someone explain the mechanics behind this menu please?

Well it looked like from Category>Product category>Edit vocabulary there is an option for Taxonomy menu with a selection list showing Main Menu. I added a new Category to this same structure and now both my new category and the main menu have disappeared from the menu?
I have tried "Select to rebuild the menu on submit." and also removed my new category from main menu... but still the original is missing.


texts: Domain Acces + Internationalization + Metatag: How?

texts:
I am using those three modules i mentioned in title in my installation.
I was able to localize it pretty much, but what about meta tags for different domains and languages? I am also using Domains Metatag module, but it doesn't allow to localize the domain's metatag for a front page, for example.

Is there a possibility to make it happen? Thanks in advance!


texts: how to make the field label in Views hidden or visible?

texts:
i have a view page with Table format i want to control the label of the fields that i added befor .
i changed the php code in (views-view-table.tpl.php) befor so now i can't control the field label ( hidden / visible ) from the view
this is the code that i have now :

and this is the view page even i check the label nothing happen!

anyone can help me with this please ?


texts: Limit taxonomy terms that can be selected to 2nd level terms only?

texts:
Is it possible to limit taxonomy terms that can be added to a node to 2nd level tags only?

So if my taxonomy is as follows:

Open

-forum1

-forum2

Closed

-forum3

-forum4

How can I limit the selections to forum1, forum2, forum3 and forum4, and exclude Open and Closed?

This may need to be a separate question but I also need to limit tags that can be created to 2nd level only. So a new tag would need to be a child or either Open or Closed.
Thanks


texts: How can I remove the default generated  tags in view's result?

texts:
I am using a views in my drupal web site. I have set 'style' to 'Unformatted' and 'Row style' to 'Fields'

Also I have Rewrote the output of the field with my HTML tags.

But I have a problem in the result.
Every row is located inside a [div] tag
for example the first row is located in

How can I setup the view in order to remove this extra [div] tag ?!?!?

I don't need this wrapper.


texts: Is making a feature of literally everything available actually a smart thing to do?

texts:
I love features for all the benefits they have, especially for performance.

It now seems like a logical step forward to make a feature out of everything available on the "create feature" page on a launch site and enable it (of course so that it doesn't interfere with other features, but you get my point).

Does that seem like a smart idea? I don't see anything problematic with this if I assume I won't change anything on the site for the next couple of days and it's frequented by many visitors.

If you have any best practices to share, I'd be glad as well.


texts: Can't get referenced node to appear in view block

texts:
I have recipe and food nodes, and recipe nodes (e.g. My Favourite Cake Recipe) link to parent food types (e.g. Cake). This link is done via a Parent Food content reference field on the recipe node type.
I'd like to display a block titled Linked Food next to all recipes, but I can't get this to work.
What I've tried
I created a food content view with the following:

Add a relationship with item Content referenced from field_parent_food so that I can display the content of the food node referenced from the recipe page I'm viewing.
Add a contextual ID filter, and set WHEN THE FILTER VALUE IS NOT AVAILABLE to Provide Default -> Content ID from URL so that I only look at nodes with an ID equal to the current page.
Add a field with ID Parent Food so that I display the content of the referenced food.

I then set up this block to display on the recipe content type. When I navigate to a recipe I was now expecting to see the parent food node detailed in the block, but instead I just see the same recipe repeated in the block. What am I doing wrong here?
I've had a look at a view tutorials. As someone who is familiar with relational databases I find the concept of views (or at least the documentation) really impenetrable, so I'm just going to ask...


texts:
I created a page view where user only get articles to edit.

How can I set up the page that it opened when a user logged in?


texts:
My goal is to have an additional region class, when region is rendered on my page--node--9
I am using this template_preprocess_region() function to do this.

But how i can get inside my function ID of page, region is rendered on?


texts: Extra space at beginning of downloaded image

texts:
I'm using custom code to download images, as I need to check permissions and keep a trace of each download (inter alia).

Here's how I decided to go:

Simple link, triggering an AJAX call of my download page
As it's an AJAX called page, html--ajax.tpl.php is used
Same for page--ajax.tpl.php
My final file force the image download

...and the content of the 3 related files:

html--ajax.tpl.php:

<?php print $page; ?>

page--ajax.tpl.php:

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

download.ajax.php:

<?php

// ...extra code to populate $path and $filename

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($path));
readfile($path);
exit;

  My problem is that I've an extra space in my downloaded image bytes

The downloaded image is corrupted, so I decided to compare its bytes with the original image with xxd, and here's the result where you can see an extra 20 byte at the very beginning:

00000000: 20ff d8ff e000 104a 4649 4600 0101 0000   ......JFIF.....
00000010: 0100 0100 00ff fe00 3b43 5245 4154 4f52  ........;CREATOR
00000020: 3a20 6764 2d6a 7065 6720 7631 2e30 2028  : gd-jpeg v1.0 (
00000030: 7573 696e 6720 494a 4720 4a50 4547 2076  using IJG JPEG v
00000040: 3632 292c 2071 7561 6c69 7479 203d 2037  62), quality = 7
00000050: 300a ffdb 0043 000a 0707 0807 060a 0808  0....C..........
00000060: 080b 0a0a 0b0e 1810 0e0d 0d0e 1d15 1611  ................
00000070: 1823 1f25 2422 1f22 2126 2b37 2f26 2934  .#.%$"."!&+7/&)4
00000080: 2921 2230 4131 3439 3b3e 3e3e 252e 4449  )!"0A149;>>>%.DI
00000090: 433c 4837 3d3e 3bff db00 4301 0a0b 0b0e  C<H7=>;...C.....

I used the same approach as the one described in this post to find the origin the the space. The better I could have is to determine that the space appears in page--ajax.tpl.php :

00000000: 5020 44ff d8ff e000 104a 4649 4600 0101  P D......JFIF...

P is printed before the render(), in page--ajax.tpl.php, and D before my readfile().

Any ideas to helps me to find the origin of this space?

Thanks


texts: Can recurring initial payment period be changed after purchase is made?

texts: I've installed the drupal commerce framework and the Commerce recurring framework (it's awesome), and i've created a recurring product. That said, someone just made a purchase, and I realized that I accidentally set the initial period as 1 year (and it should be one month). I've since corrected it, but if someone has already purchased the recurring product, how can I change that period? Will it update for existing orders? If not, where can I go to change it for specific orders?


texts: How to make View setting changes happen simultaneously with deployment of a template

texts:
Making View setting changes happen simultaneously with deployment of a template. Where can I look to solve this problem?

Is there something that puts Views settings into Version Control, like Subversion?


texts:
So I found this answer on here on how to get relative URLs on my Drupal 7 site (How do I modify Drupal so that ONLY relative URLs are used through the whole site?), but it doesn't seem to work nicely with S3FS.

Is there a way to modify this hook to work with S3FS, or is there another way that I should be getting relative URLs that works with S3FS?


texts: How to set or get the triggering element upon submit a form using JQuery?

texts:
I have a Drupal 8 form with checkboxes.
The form submits upon clicking on a checkbox using JQuery.

Here is my code.

 $('#edit-event-types input[type=checkbox]').on('change', function(event, ui){
    $('#events-to-doc').submit();
  })

Unfortunately, if there isn't any submit button in the form, then function submitForm in the form class doesn't execute. But I don't need in a submit button on the form, I want to submit the form clicking on the checkboxes.

Can I somehow set the checkboxes element as the triggering element with Jquery? I need the function submitForm to execute and $form_state->getTriggeringElement() return the checkboxes as the triggering element.


texts: Using taxonomy & Views to create a sport Position Table.

texts:
I'm trying to create a new website for my Football Club. Its supposed to have 7 different divisions (or leagues) and 2 different seasons.
I use taxonomy to create de vocabulary "divisions" and then add... terms.
Then  I tried to do the same with seasons and It worked, but the problem is when I try to create (with views) a position table of each division.

I don't know why if I add two or more fields for each team
i.e.
Team: Barcelona Season:Spring   Division(league): Premier.
Team: Madrid   Season:Spring   Division(league): Premier.

Game: Barcelona VS Madrid
Winner: Madrid.

In the positioning table, it shows the double of values that its supposed to show but if I do not add any taxonomy or just one, it works well.
I do not where could be the problem.

I use the module "League: Online Tournament Manager".

This is a real example: Polish my Paul have the same numbers of games but the team has 2 taxonomys (Division & Season) and shows double of values and Changping Yeya has only Division taxonomy and shows the real (true) values.


texts: Drupal 6 not playing nice with jquery 1.11.1

texts:
I am trying to incorperate a sequential fadIn of several img using a simple Jquery script

     $(document).ready(function(){
$(".fadeInCopy").each(function(index) {
    $(this).delay(900*index).fadeIn("900");
});
 });

I have the jquery loading properly and no errors in the javascript panel. However, the script will not reveal the elements. I have this working on a test page but once I install in Druapl 6 it does not respond. Any ideas?


texts: Do I need hook_update_N if there are no database changes?

texts:
I wrote a little module that provides a form and does some special processing of the submission.  There are no database tables involved. If I change the form or processing, how do I code the update? Do I still use hook_update_N if the module update doesn't affect the database?

Thanks!