texts: How to hide Default values using Drupal Behaviour

texts:
I have created a form using the web form module. In this form i have 3 field. Name, Email and Phone. I have set the default values for Name as Name , Email as E-mail and Phone as Phone (Done this using the form settings).

Now the scenario is, when the user clicks on the Name field , The default values has to go off. I tried this using jQuery but it didnt work. So i thought of using Drupal Behaviours with jQuery.

This is my code

(function (jQuery) {
 Drupal.behaviors.amendor = {
    jQuery('edit-submitted-phone').focus(function() {
      alert('Chekcing the values');
      if (jQuery('edit-submitted-phone').val() == 'edit-submitted-phone'.defaultValue) {
        jQuery('edit-submitted-phone').val('');
      }
    });

    jQuery('edit-submitted-phone').blur(function() {
      alert('setting the values');
      if (!jQuery('edit-submitted-phone').val()) {
        jQuery('edit-submitted-phone').val('edit-submitted-phone'.defaultValue);
      }
    });
  };
})(jQuery);


texts: Drupal registry table not populated with test class files

texts: I tried to write tests for custom modules and I found that registry database table is not populated with .test files and thus admin/config/development/testing displays only one SimpleTest test. I tried to rebuild registry with http://drupal.org/project/registry_rebuild but there is still no files. Is this a Drupal 7.19 bug?


texts:
I have an existing database (which is not under my control) that i want to use as base database for my entity. However I'm stuck at getting the data from the database. There already exists a question about this problem. However that question is only about installing the module and that doesn't apply to loading an entity.

Hope I stated my problem clear enough.


texts: Active menu trail with 2 menu items linking to same content

texts:
On a D6 site, I have a content accessible by 2 ways in my primary links:

Section A :

"my content"

Section B:

"my content"

My problem is that the active trail is set on Section A, but I would like to highlight section B instead.

My breadcrumb (with Custom Breadcrumbs set to "use the menu structure to set the breadcrumb trail") also displays path to Section A instead of Section B.

With Context module (reactions => menu), I've set the active menu to Section B. This changed my breadcrumb which now displays the good section (B).
But unfortunately my primary links remains highlighted on A.

If I switch to Garland, section B is highlighted in my primary links, so obviously it is a custom theme issue, but I can't find where exactly. theme_menu_item() is not overriden... All I'm able to grab in my preprocess functions is a menu with the active_trail already set.

I've also tried Menu Position module, without success...

Any hints are greatly appreciated. Thanks !


texts:
When I run composer update on a Drupal 9 website, I get this warning:

Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.

A similar question has alreday been asked, answered and accepted on StackOverflow.
To summarise the accepted answer:

edit your composer.json and replace the abandoned package with the recommended replacement
then run composer update again

I seriously doubt that manually altering composer.json is the best practice, but that is moot, because it does not apply in the case of "doctrine/reflection". When looking into my composer.json, there is no mention of it, so there is nothing to edit.
So I am checking why it is required:
$ composer why doctrine/reflection
doctrine/common          2.13.3  requires  doctrine/reflection (^1.0)
doctrine/persistence     1.3.8   requires  doctrine/reflection (^1.2)
drupal/core              9.1.7   requires  doctrine/reflection (^1.1)
drupal/core-recommended  9.1.7   requires  doctrine/reflection (1.2.2)

So this abandoned package is required by drupal/core (and others).
In an upvoted commnent, user Kay V writes:

People needing more generic composer usage instructions should consider $ composer remove {{old package}} and then $ composer require {{new package}}.

This doesn't work either, it produces the following messages:

doctrine/reflection is not required in your composer.json and has not been removed [...]
Removal failed, doctrine/reflection is still present, it may be required by another package. See composer why doctrine/reflection.

Two questions:

Why is the most recent version of drupal/core requiring an abandoned package (instead of its recommended replacement roave/better-reflection)?
What is the best practice for handling abandoned packages required by the drupal core?


texts: use different "From" header for different actions when sending emails

texts:
So for example, when a user's creating an account, I want to have the sent email use "From: register@example.com" header.

But also, when I will approve his content I want to use the header "From: info@example.com"

Right now, all emails sent are using the same "From" email header provided in the "Site information" settings.

Any ideas on how to achieve this? Thanks


texts: I cannot sign into my drupal site. The login page just refreshes and there are no error messages

texts:
I cannot login into any account from the login page. I can get to the admin page by doing drush user-login but if I log out of admin and try logging in again, the login page just refreshes and I do not get signed into the account; no errors messages, even if I put in an incorrect username and/or password. After nuking my local repo a couple times, I found out that if I put in the wrong username and/or password or if I log in and out a bunch of times, I will not be able to sign in to any other account. The login page will just refresh.
I tried doing stack traces using debug_print_backtrace() in the UserLoginForm.php located in core/modules/user/src/form but my computer just freezes. Normally, when I actually log into an account, the console on the browser under network shows a 303 which redirects, but when I cannot login, that request is not present. I've cleared cache, cleared cookies, tried different browsers, but nothing seems to work. The watchdog log messages just say a session has been started by a user and
Notice: Undefined index: function in Drupal\Core\Database\Log->findCaller() (line 154 of /app/core/lib/Drupal/Core/Database/Log.php).
I'm making a custom theme and module if that helps. Any ideas would be greatly appreciated. Thanks.


texts:
I have a multilingual website ( english, dutch and german ). The language detection is setup to look at the URL for both interface and content. This results in an admin interface that goes from dutch to english to german depending on which language of a node you are editing.

I set the interface user language above URL in priority to set the interface based on preference. This does nothing ( it still forces the language from the URL ).
Next i tried Account administration pages as a detection method for interface. This has the effect that the language is always set to dutch in my case, fine. But now the moment you try to translate a node it always defaults to dutch as well.

I have been messing about with these settings for the better part of the day. What I am trying to achieve is:

Client can effectively translate nodes but the admin interface is either in there preferred language or just plain english
On the frontend of the website I want the detection to work based on URL detection ( this one works fine ).

How do I configure this O.o

Thanks


texts: Print image field with multiple entries from field in twig template

texts:
I have a twig template for a custom content type. And it is able to render most fields just fine, but I am unable to print an image field with multiple images.

node--mycontenttype.html.twig contains

{{ content.field_mytitle }}
{{ content.field_myheaderimage }}

    {% for galleryimage in content.field_gallery_images %}

 {{ galleryimage }}

    {% endfor %}

content.field_mytitle and content._field_myheaderimage outputs the title and image just fine. But when I use the for loop

    {% for galleryimage in content.field_gallery_images %}

 {{ galleryimage }}

    {% endfor %}

I receive an error

Exception: Object of type Drupal\node\Entity\Node cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter() (line 443 of core/lib/Drupal/Core/Template/TwigExtension.php).

When I just use

{{ content.field_gallery_images }}

It's able to output each image, but this does not allow me to wrap each item in divs and add content to each one.


texts: Unable to jump to a specific spot (seek) when mp4 or mp3 is in private field

texts:
I'm serving .mp4 videos and .mp3 audios using private download (field's upload destination: Private files), and they play OK on native html5 player, but seeking doesn't work, as in I can't jump to the middle of a video or audio.

This happens on Chrome and doesn't happen on Firefox. Also no problem playing and jumping on public download or when the file is saved on local drive and played from there.

After comparing the response headers in several different scenarios I have concluded that the only consistent difference between working and non-working is that Accept-Ranges and Last-Modified headers are missing when seeking is not working. These can be added at hook_file_download but then the media won't play at all.

This a pain to test with Chrome Developer Tools > Networking as Chrome pulls old headers from its memory, so you never know which input is producing which output.

Solution

Install https://www.drupal.org/project/resumable_download. Despite its name and the fact that it's at beta1 (it gives some notices) it does the job. It takes completely care of feeding the media to the browser.

Edit: If the module doesn't work, check out this patch: https://www.drupal.org/node/2362393


texts: Is there a way to set the active menu's text as page title?

texts:
I would like to set the active menu's text as the page title in drupal7. I tried using the page title module and found no replacement patterns to set the active menu as the page title. Any help is widely appreciated.

Thanks


texts:
For some reason, I'm not able to change the name of this site.  I try to change the name to 'Test Name', as shown in this screenprint:

But after I save the page, the name is repopulated with the previous title.

It is an old drupal site with many years of modules and various admins working on it, so anything's possible. It does have Pathauto installed, but I can't see any place where that is overriding the site title.

Any thoughts?


texts:
Drupal 7, Views node to be selected on date range.

I would like to have my view only return nodes that were created last month, no matter when I run the view this month.  So as it's the middle of January, I want all nodes created in December last year, and next month I want all of January's

So the dates would be between first day of last month and the last day of last month.

In php I can use:

echo date('Y m d', strtotime('first day of last month'))

and

echo date('Y m d', strtotime('last day of last month'))

to get the correct date range.

However, in Drupal, the SQL does not create the correct ranges.

Viewing the view and sql logs at 11:55 on Jan 16th 2013 I see :

(node.created >= 1358337264-2678400

which works out as 2012-12-16 11:54:24, so it is a month ago, but not the first day of that month.

Any thoughts.


texts:
I'm searching for a way to let users chose if they want their user profile to be public or to be private (just the owner and admin). I'm not picky if this can se set for the whole profile or for every profile field.

I already looked at User Field Privacy but this one conflicts with Field Permissions (this site needs fields permissions).
And I'd rather not use Profile2 for this functionality since I'm only using the standard profile fields.

I thought about using Field Conditional Formatters but this seams rather complicated to set up for every field.

Any ideas?


texts:
I'm Using File (Field) Paths

“&” displaying as “&” in the file name

i tried to solve it by change the the display of the field to plain text and use the token view mode but nothing change

Any help?


texts: Could not initialize PECL extension even though memcached installed

texts:
I am migrating a site from one remote server to another. I have set up the new server will all the prerequisites installed memcached server and its extension too. But when I try to run drush cr I get the error Could not initialize  PECL extension

I wrote a simple php code to check if memcached is running and if the php code is able to read and write to memcached and it works just fine. Please find sample code below

<?php

$memcache = new Memcached;
$memcache->addServer('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."
\n";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)
\n";

$get_result = $memcache->get('key');
echo "Data from the cache:
\n";

var_dump($get_result);

?>

My issue is I keep getting the error as shown below

In DrupalMemcachedFactory.php line 53:

  Could not initialize  PECL extension

Would anyone of you have any idea why this might be happening? How do I get this sorted?


texts: Can I use plupload to load multiple image files into a single image field

texts: I have an image file field on my Drupal 7 site that allows users to add 4 images.  I would like to give my users the ability to load all 4 images at once.  I have discovered the plupload module and plup library which should be able to let me do this.  However, I have yet to discover an configuration (including the media module) which allows me to do this.  How can I make this functionality work?


texts:
Does somebody of you know how to build a link as described in #9 in https://www.drupal.org/project/views_contextual_filter_query/issues/2686467#comment-10983075

I tried it this way

[title]

but the output ends with a "?" ... like me :-) The link to the node works, but the query/argument/contextual filter is missing in the url. How can I fix this?


texts: Adding additional fields on user registration page (first name, last name)

texts:
In Drupal 7, what methods are there to add additional textfields to the user registration page at /user/register? I mainly want to also get their first + last name during registration. There doesnt seem to be a way via the interface to add these extra fields as required for sign up.

What is the quickest way of adding these extra text fields on sign up?


texts: Update to Commerce shipping 2.x breaks site with WSOD

texts:
Implementing shipping 2 is becoming a bit more troublesome than i had anticipated.

Right now, I am getting the following error on a White Screen of Death when I install commerce shipping 7.x-2.0-beta1

Fatal error: Call to undefined function commerce_shipping_services() in /var/www/html/nidadev/sites/all/modules/contrib/commerce_shipping/commerce_shipping.rules_defaults.inc on line 44

I am not sure what to make of this Is there something obvious that I am missing?

Is there some sort of update to rules I need to perform?

The problem goes away when I go back down to Shipping 1

This issue is standing in our way of working with Tim Rohaly on the Fed Ex Commerce module, so the quicker we fix this, the quicker he can get his code out to the community.

Thanks for any help


texts: Autocomplete selection in Rules Component

texts:
How do I create a rules component which lets you select or autocomplete a node from an existing list of nodes?

I have tried all the Data Type while creating a Rule Component. Each one of them requires a direct input rather than a Drop Down Select List or Autocomplete function.

Please advice


texts:
I'm working on a project with a Drupal and a PhpBB section and I'm trying to create a single sign-on using the PhpBB login. When a user logs into PhpBB, he should also get logged in to Drupal. Vice versa is not needed.

I know you can bootstrap Drupal and use the external functions of the user module, but bootstrapping Drupal fully into PhpBB isn't a good idea so I was wondering if there are any other methods doing this.

I also tried out the Services module with the login API request, but the problem here is that the session isn't persistent. When I curl my details to the API, I get a nice json result with a session id, but I can't just keep passing the session id around in the PhpBB section not knowing wether and when the user will get back to the Drupal section.

I also worked with the Phpbbforum module, which worked a little bit but was a hassle if I wanted to do more advanced stuff. It also had a few bugs and issues (for example: the user synchronization would work one way, but not the other way around) so this module is not an option.

Thanks in advance, Tom.


texts: Get whole tree of a taxonomy term from node into seperate php variables

texts:
Can anyone of you brainy folk suggest the best way of retrieving the taxonomy term on a node and both of it's parents then storing as variables on a php snippet?
For example: Country->City->District output to $country, $city and $district?

Thanks in advance for all your answers!...

nb, this is what I get from print_r, [0] being the country, [1] being the area and [2] the district:

field_location_term] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [tid] => 26
                        [taxonomy_term] => stdClass Object
                            (
                                [tid] => 26
                                [vid] => 5
                                [name] => B----a
                                [description] =>
                                [format] => filtered_html
                                [weight] => 3
                                [vocabulary_machine_name] => geographical_location
                                [metatags] => Array
                                    (
                                    )

                            )

                    )

                [1] => Array
                    (
                        [tid] => 27
                        [taxonomy_term] => stdClass Object
                            (
                                [tid] => 27
                                [vid] => 5
                                [name] => B----o
                                [description] =>
                                [format] => filtered_html
                                [weight] => 0
                                [vocabulary_machine_name] => geographical_location
                                [metatags] => Array
                                    (
                                    )

                            )

                    )

                [2] => Array
                    (
                        [tid] => 28
                        [taxonomy_term] => stdClass Object
                            (
                                [tid] => 28
                                [vid] => 5
                                [name] => M----w
                                [description] =>
                                [format] => filtered_html
                                [weight] => 0
                                [vocabulary_machine_name] => geographical_location
                                [metatags] => Array
                                    (
                                    )

                            )

                    )

            )

I thought the best thing to do would be

$country = $node->field_location_term['und'][0]['taxonomy_term']['name'];

But I get no output.


texts:
I made a content type and then added a user reference field to it. Name of this field is "expert_users" that references to 500 users. I should use check boxes widget type for it. Now, when I add/edit a node, all of 500 users are loaded in the "expert_users" field. I thought to insert a dropdown list exposed filter on users' roles to reduce the number of the users referenced. So, instead of display 500 users on content, only 20 users with the selected role (of drop-down list) would be displayed. I don't know how to add this drop-down list.

I am trying to use the Views module to select the users (Advanced option) in the CCK field, but it only shows field names, not exposed filters of the user reference view.

Do you have any idea? Do I have to work with hook_form_alter()?

I am using Drupal6.22, and CCK-6.x-2.x-dev.


texts: Image not responsive in one content type. Can anyone help me resolve this?

texts:
I'm hoping someone might be able to help me. Yesterday, i noticed that the main image on my photo gallery content stopped behaving responsively. For example: http://thesalinepost.com/photo-gallery/saline-sweeps-tecumseh-home-opening-doubleheader Now, the same image style is working correctly on article content http://thesalinepost.com/article/saline-rowers-kick-spring-season-spring-lake-michigan
And on it's working on announcement and events content.


texts:
Scenario:

Drupal 7 site recently migrated from Drupal 6. Using OpenID connect module. All users login with Google, using a Google account with a company domain name. (user@company.com). All users that were migrated can still log in. When a new user is created, he or she cannot log in, and the OpenID Identities tab for the new user is blank. The new user is directed back to the login page. The site is also using the Require Login module, which states that it works with OpenID.

How can I get Drupal to save the OpenID Identity to the user's account? So far my only idea is to give the user a one-time link so he can log in, then ask him to add the https://www.google.com/accounts/o8/id code into the "add identities" field.
Would that even work, since it's not actually google.com for the others? All the working users have IDs that state the company name (www.company.com/id=longstring).
How can I check to see if the site is using the new OpenID protocol and won't stop working on April 20th?

I am having trouble understanding how OpenId works with Drupal.


texts: Change the google marker icon on Geofield module

texts: I need to change the default google marker icon on geofield displayed in my view for a custom marker. I tried adding style google map module but it didn't work. Any idea how to do it?


texts: Datepicker widget. How can I add some variable javascript code from my module to configure the date popup calendar?

texts:
I need to personalize some settings in the date popup calendar in a date field.
This is the documentation for the popup calendar used in the Drupal date field:
http://api.jqueryui.com/datepicker/

I would to configure for example, the minDate property, to set a minimum selectable Date, according the documentation this is the code:

$( ".selector" ).datepicker({
  minDate: new Date(2007, 1 - 1, 1)
});

But... How and where do I type it in a custom module? It looks javascript, but I don't know how to make this code work for my date form element.


texts: In Theme information , views-view.tpl.php (File not found, in folder ./)……?

texts:
In Theme information

Display output : views-view.tpl.php (File not found, in folder ./)

Style output: views-view-list.tpl.php (File not found, in folder ./)

Row style output: views-view-fields.tpl.php (File not found, in folder ./)……

I know it's in conflict with devel_themer, but how to solve?


texts: Access denied to all users after migrating site to new server

texts:
Please don't consider this as a duplicate post. I have tried all the solutions that worked for others, but still struggling to fix the problem (all users including admin taken to 403 page). This is a Windows server running Drupal 7.

Things I have tried -

No base_url value given
No cookie_domain value given
Session table truncated
Cache tables truncated
No file permission differences
Tried Reset password email but the link takes to 403 page
Deleted browser cache

Please let me know if anyone has experience with a similar issue or what else I could try.

This is what I can see in watchdog table.

Thanks


texts:
I use D8 Editor File upload to add files to a node. But i want an overall view from all the files in that node, but only in that node. I can create a view for all the files but i can't filter on the nid of the current page.

The project: attachment_links seems to kinda do what i want but its only for Drupal 7.  Does anyone know of a similar Drupal 8 project or a way do code it manually into a block?


texts: Mink failing to run JavascriptTestBase tests

texts:
I suspect this is more a config issue than anything but struggling to run JavascriptTestBase tests. The error I'm getting is as below:

  wodby@php.container:/var/www/html $ ./bin/phpunit -v -c ./web/core
  ./web/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebWithWebDriverAssertTest.php
  PHPUnit 6.5.8 by Sebastian Bergmann and contributors.

  Runtime:       PHP 7.1.17 Configuration:
  /var/www/html/web/core/phpunit.xml

  Testing
  Drupal\FunctionalJavascriptTests\Tests\JSWebWithWebDriverAssertTest S
  1 / 1 (100%)

  Time: 21.2 seconds, Memory: 6.00MB

  There was 1 skipped test:

  1)
  Drupal\FunctionalJavascriptTests\Tests\JSWebWithWebDriverAssertTest::testJsWebAssert
  An unexpected error occurred while starting Mink: Could not open
  connection: Error forwarding the new session cannot find :
  Capabilities {browser: firefox, browserName: chrome, browserVersion:
  9, deviceOrientation: portrait, deviceType: tablet, name: Behat Test,
  selenium-version: 2.31.0, version: 9}

  /var/www/html/web/core/tests/Drupal/FunctionalJavascriptTests/JavascriptTestBase.php:50
  /var/www/html/web/core/tests/Drupal/Tests/BrowserTestBase.php:484

  OK, but incomplete, skipped, or risky tests! Tests: 1, Assertions: 1,
  Skipped: 1.

I'm running this directly within a docker container. Selenium is also running in a docker container and I know I can connect from my PHP/Apache container to the Selenium container as running

wget http://selenium:4444/grid/console

Returns the selenium Grid Console homepage.

My phpunit.xml file looks as follows:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="tests/bootstrap.php" colors="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutChangesToGlobalState="true">
  <php>
    <ini name="error_reporting" value="32767"/>
    <ini name="memory_limit" value="-1"/>
    <env name="SIMPLETEST_BASE_URL" value="http://apache"/>
    <env name="SIMPLETEST_DB" value="mysql://drupal:drupal@mariadb/drupal"/>
    <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
    <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors"/>
    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", null, "http://selenium:4444/wd/hub"]'/>
  </php>
  <testsuites>
    <testsuite name="unit">
      <file>./tests/TestSuites/UnitTestSuite.php</file>
    </testsuite>
    <testsuite name="kernel">
      <file>./tests/TestSuites/KernelTestSuite.php</file>
    </testsuite>
    <testsuite name="functional">
      <file>./tests/TestSuites/FunctionalTestSuite.php</file>
    </testsuite>
    <testsuite name="functional-javascript">
      <file>./tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
    </testsuite>
  </testsuites>
  <listeners>
    <listener class="\Drupal\Tests\Listeners\DrupalListener">
    </listener>
    <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
    </listener>
  </listeners>
  <filter>
    <whitelist>
      <directory>./includes</directory>
      <directory>./lib</directory>
      <directory>./modules</directory>
      <directory>../modules</directory>
      <directory>../sites</directory>
      <exclude>
        <directory suffix="Test.php">./</directory>
        <directory suffix="TestBase.php">./</directory>
      </exclude>
     </whitelist>
  </filter>
</phpunit>

Could anyone give me any pointers in the right direction?


texts: How to change "Save Draft" value on Webform?

texts:
I want to change the button text value from "Save Draft" to "Save". How can I target the button (CSS or custom module works for me)? I used to target forms like this:

$form['actions']['submit']['#value'] = 'Ask question';

As there are multiple submit buttons, I don't know how to target the one with the class "webform-draft form-submit".

function customisations_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_client_form_88') {

  }
}


texts:
The definition of CACHE_TEMPORARY used in cache_set reads as follows.

  CACHE_TEMPORARY: Indicates that the item should be removed at the next
  general cache wipe.

I am just curious as to what General Cache Wipe means and what constitutes to General Cache Wipe other than obvious cron.


texts: Using Custom Formatters module to output an image's URI

texts:
I'm trying to make a formatter which prints an image's URI instead of the image itself. My problem is I don't know what the formatter is expected to return. The help information is apparently not working on my install.

So, what does it expect as it's return value? This is what I've tried:

function image_path_formatter($vars) {
    $element['content'] = $vars['#items'][0]['uri'];
    return $element;
}

My view has this in content:

Edit formatter


texts: How to show only current user registration list in Node registration view?

texts: I have used views for registration type and listed as table. They listed all registered details to everyone. But I need to show only current user registration list in the table using views contextual filters.


texts:
I need to delete a div made by the container.html.twig. How can I rename this template to this specific region?

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'container' -->
<!-- BEGIN OUTPUT from 'themes/newbikes/templates/system/container.html.twig' -->
<div class="form-group">

thx.


texts: I updated my site and now the site only shows up in Firefox.  I believe it has something to do with the redirect since if I type in mysite.com/mysite then it shows up.  I've tried updating the .htaccess file and the default/settings.php files and can't get it to work correctly.  Any ideas?  Thanks!


texts:
I'm using the Meta Tags Module and it has been a solid way to add meta tags throughout the site - especially the increasingly important Canonical URL meta tag.

I'm having trouble adding the same tag to views connected to a static page.

How can I add a canonical URL to some views pages?


texts: How to upload image or video from mobile device to content

texts:
Creating node via mobile browser goes ok, but when adding image or video i can only record and upload which also works fine, but i can not access gallery and choose an image to upload.

Options available after clicking Choose file are:
- Camera
- Camcorder
- Voice Recorder
- Documents


texts: displaying content using entityfieldquery

texts:
I want to display content based on term ids using below method.If I include the below code in for loop it works but thats not appropriate way to call loop for each index value.Here $all_children[] contains term ids. Can anyone please tell me what is wrong with below code , or any suggestions?

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->entityCondition('bundle', 'escorts_product');
$query->propertyCondition('status', 1);
for($i=0;$i<=20;$i++)
  {
   $query->fieldCondition('field_product_sub_cat', 'tid', $all_children[$i],'=');
  }
$result = $query->execute();
if (isset($result['node']))
  {
    print "nomeer";
    $nids =  array_keys($result['node']);
    nodes = node_load(array_keys($result['node']));
    if ((node_load($nids, NULL, TRUE)))
      {
       foreach($nids as $nid)
         {
          //content
         }
      }
   }


texts: Unlike other rules my custom Commerce Fees rule is executing on every cron job

texts:
I have the following Commerce Fees rule:

{ "rules_setup_fee" : {
    "LABEL" : "Setup Fee",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "Commerce License Billing" ],
    "REQUIRES" : [ "rules", "commerce_fees" ],
    "ON" : { "commerce_fees_order" : [] },
    "IF" : [
      { "NOT data_is_empty" : { "data" : [ "commerce-order:commerce-line-items:0:line-item-label" ] } },
      { "AND" : [
          { "text_matches" : {
              "text" : [ "commerce-order:commerce-line-items:0:line-item-label" ],
              "match" : "VS"
            }
          }
        ]
      }
    ],
    "DO" : [
      { "commerce_fees_apply" : {
          "entity" : [ "commerce-order" ],
          "fee" : "setup_fee",
          "amount" : "999",
          "currency_code" : "USD"
        }
      }
    ]
  }
}

which is working just fine, however it is the only rule that shows in the log messages way too frequently:

Type    rules
Date    Thursday, January 14, 2016 - 17:50
User    drupal
Location    http://drupal/admin/config/system/cron
Referrer    http://drupal/admin/config/system/cron
Message Rules debug information:
" Reacting on event Apply a fee to a given order.
0 ms Reacting on event Apply a fee to a given order.
2.988 ms Evaluating conditions of rule Setup Fee. [edit]
3.538 ms The condition data_is_empty evaluated to TRUE [edit]
3.547 ms AND evaluated to FALSE.
3.563 ms Finished reacting on event Apply a fee to a given order.
Severity    notice

It seems like while other rules execute only when necessary, this one does on every cron run. What kind of condition I should add to the rule to make it execute only when someone tries to actually tries to put something in the shopping cart?


texts: How to add a user-friendly option to link to nodes from body text or text-field?

texts:
I'm looking for an option or module that provides the possibility to link to other internal nodes avoiding the usage of full html in a text field. Users should be able to highlight a term and assign a link to it. It would be nice to have a kind of select-list containing the available nodes to link to.

I have done this before, but only for external links and with a minified editor. But i have no idea how to put a list of nodes there. Is there an alternative to achieve this?


texts: Ampersand does not get urlencoded and breaks my GET parameters

texts:
I am using views to create a dynamic url that contains some parameters. Unfortunately I am including the node title as a parameter and it just so happens that many of the titles contain &.

So my custom url in views looks something like this:
seminar?c=[field_seminar_cycle]&n=[field_seminar_num]&t=[title]

But it seems that when creating the view the ampersands inside the [title] don't get urlencoded. I am guessing that the drupal way of building a link is to split the url based on special chars and then urlencode the others parts before joining them all together.

Is there a way to urlencode the title field before adding it to the link? Can it only be done though templates or is there any workaround though views' gui?


texts: Views contextual filter - Contains search with taxonomy field

texts:
I am searching with taxonomy terms, is there a way to do the search with anything that contains what i am searching for will be returned?

For example if i search Amer nothing will return, but i would like America to return in the results. I know that there is an option when you are just searching by a field, but i don't see it for taxonomy. Does anyone have any ideas??

---EDIT---

I do have the search set as an exposed filter too...


texts: Custom content type which is a check list

texts: I am trying to build a new project in which i as admin can easily add or edit a checklist which is used for tracking a days job which i want any registered user to fill out . This is possible either by creating a custom module or using an existing one . I have used Checklist module and Matrix Module . But was not able to achieve my goals. I would like your help to guide in any any direction that you think it is possible and the i will peruse it . If i am not able to achieve my goal i will get back to you asap .


texts: How can I iterate through all the key and value of configuration object

texts:
I have an admin setting form (Configuration form) called 'example.settings'. I can load the configuration using below code.

  $config = \Drupal::config('example.settings');

Is there a way to iterate through and get all the configuration values in this config object


texts:
I need to display dash (-) in front of each sub-menu element. For example, the output should be

Home

About

- Process

- Process 101

- Compnay

Useful Links

I tried the following:

function theme_menu_link(array $variables) {
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
     $sub_menu = drupal_render($element['#below']);
   }

   $output = l($element['#title'], $element['#href'], $element['#localized_options']);
   return '
' . $output . $sub_menu . "
\n";
  }


texts: Display Youtube videos in a gallery of thumbnails with a primary player

texts:
I'd like to be able to display a gallery of youtube video thumbnails underneath a primary Youtube video "player" area. When a thumbnail is clicked, that video would play in the main player area without the user being taken to any other page. Is there a way I can accomplish this with existing modules and/or Views?

Thanks!


texts: Need help to work with videos and FFMPEG

texts:
I am building a website that people upload a video and then they can cut a piece of the video. I am using FFMPEG.

I know how to do this using pure PHP, but since my website is based on Drupal, I prefer to use the Drupal modules.

I saw PHP FFmpeg and FFmpeg Wrapper modules that work with FFMPEG.
I would like to know is there any advantage in using these modules or using the pure PHP is preferable? Can these modules save the clipped videos as a node or not?

Thanks in advance.


texts: Assigning CSS classes to exposed widgets in a view?

texts: I have several exposed widgets in a view, they allow users to sort stories by date or by tag. However, I am trying to style the block and because each widget is only given a 'views-exposed-widget' class by default, I can't figure out a way to style each widget differently. Is there a simple way to give each widget a different css class or id? I need to set different widths to different divs, etc.


texts: Alter exposed form not working with AJAX

texts:
I have the same problem like this View exposed filter block no alter form with ajax but for Drupal 8.

I have form alter where I change exposed filter label and some options in the select box, but when I choose some option that is submitted with auto submit and works with AJAX, form alter is not called and I get old label and options for the filter.

Any suggestions?

UPDATE:
I think that is working now. This comment pointed me in wrong (maybe?) direction: https://api.drupal.org/comment/61807#comment-61807

I've been using mymodule.view_execution.inc file and functions for my views are executed on first page load but later mostly ignored.

Now I moved that code to mytheme.theme file and it seems ok for now.


texts:
I am trying to run a select statement on a table for a column.
The column is decimal(20,0) unsigned.

A majority of the entries can be found using the select statement:

db_query('SELECT * FROM {foo_table} WHERE foo_id = :other_id',array(':other_id' => $value))

and $value is a string holding a large number, and example number is 395589699550470144

I believe that query is treating the $value as a string for some of the larger numbers. Now this query works.

db_query("SELECT * FROM {foo_table} WHERE foo_id = $value")

But this query is insecure due to user input method.

Is there a way to force the query to always convert the string to a number safely?


texts:
I have defined my own entity: 'game'; created some 'games' with entity_create; and loaded one of these 'games' into a form for editing. Now, I want to update the entity with my submit handler. Here is the relevant code inside the handler:

$game = entity_load_single('game', $form_state['values']['game_id']);
$wrapper = entity_metadata_wrapper('game', $game);
$wrapper->some_property->set($form_state['values']['some_value']);
$wrapper->save();

This throws:

  Error

  EntityMetadataWrapperException: Entity property some_property doesn't
  support writing. in EntityStructureWrapper->setProperty() (line 493 of
  /.../sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

I was looking for a function like entity_update, but it doesn't seem to exist. How can I update my 'game' entities? Thanks.


texts: How to properly inject services into other services

texts:
I'm trying to figure out how to inject Drupal services into a custom service class. The class in question is my MenuService which builds an associative array of menu items which will be encoded to json and sent as a response for my custom REST endpoint ( /api/menu/{menu_name} ).

As a part of that, I need three classes:

\Drupal\Core\Path\AliasManager

\Drupal\Core\Menu\MenuTreeParameters

\Drupal\Core\Menu\MenuLinkTree

Any help on tracking down the MenuTreeParameters service would be helpful. I don't see it on this list. If it's not a defined service, can it be injected?

Note: Made some edits as I answered most of my own question


texts: Getting all revisions of an entity with EntityFieldQuery

texts:
I'm trying to get all revisions of an entity with EntityFieldQuery.

Here's my code:

function entity_hash_queue($entity_restrict = NULL) {
  if ($entity_restrict) {
    $entity_info = entity_get_info($entity_restrict);
    if ($entity_info['entity keys']['revision'] != NULL) {
      $query = new EntityFieldQuery;
      $query->entityCondition('entity_type', $entity_restrict);
      $results = $query->execute();
    }
  }
}

I'm trying to figure out what property of the EntityFieldQuery object I can use to ensure that it gets every revision of an entity (if that entity supports revisions).

I'm getting a list of all entity objects, but not each revision for each object. How do I go about getting that information? I can't find anything.


texts: Where to include javascript instances in drupal

texts:
I've added my.js using js injector module and updated .info file.
Where do I have to create those instances?
Sorry, I'm new with technology.


texts:
I am tring to use Drupal.t() within some javascript, and I am not able to do it.

Actually, it throws no errors, Doing something like :

console.log(Drupal.t('supplier'));

returns 'supplier', even though I am in another language and the alternative value was supplied for such language (The PHP code with the t() function works).

Extra question : Is there a way, to know from Drupal Javascript utilities the current locale, I am in ?

At the moment, I found a workaround by testing the following (pure jQuery) :

if(jQuery('body').hasClass('i18n-fr')){//so that we can
 locale = '/fr';                       //make localized ajax calls.
}

Cheers,

Any ideas ?


texts: THEME_preprocess_field() not recognised in template.php

texts:
I'm using Drupal Bootstrap. Mail (password reset, user blocked etc..) from admin sends messages without preserving line breaks.

I tried this to fix this issue, but THEME_preprocess_field(&$vars, $hook) doesn't work for me.


texts: How can I retrieve the value of a field in a flagging?

texts:
I have a global flag, spam, that has a textfield, reason, attached to it.

According to the Flag API documentation, I know I can check whether a user is flagged like this:

$spam && $spam->is_flagged($account->uid)

However, in this case, I want to retrieve the flagging, and then check the value of a field in that flagging.  I didn't see any directions for doing so in the documentation, so I'm at a loss about how best to proceed.


texts: I need to create a auto generated number in web forms. I have used serial module for this but its working on webform in content. Please help me how i can do this.


texts: Post/redirect form to url of node selected

texts:
This is a continuation of this:

https://www.drupal.org/project/webform/issues/3023984

I was able to redirect to a node/term url using the token based on the answer provided, great!
However this is where it gets complicated. The first select list has three items, selecting one item will open a corresponding conditional second list - that is, there are 3 hidden list that will get displayed based on the selection of the first.

[webform_submission:values:ELEMENT_KEY:entity:url]

will work only for one list. How can I make ELEMENT_KEY be based on the selected list.

Thanks


texts: How to display users with same select list value on a custom user profile page

texts:
Firstly in my site, using Profile 2. i created a 'Select list field' that allows each user to choose his/her country.

I then created a custom user profile page using views by  following these steps:

1.Create a view and add a "page" display.
2. Use "user/%" as the page path.
3. Add a contextual filter "user uid" and select "provide default value" user ID from URL.

Now i want to add a block to each users profile page that displays all users from the same country as the currently viewed user profile

I have tried adding the "Profile Country" contextual filter and selecting "provide default value" user ID from URL but no results are displayed.

Is there a way to do this?


texts: Using Invisimail within a Contemplate Template

texts:
I'm in Drupal 7 and using Contemplate and Invisimail, but I can't figure out how to get my emails to be obfuscated.

I think it is because the display of the node is using the contemplate template, which simply says:

<?php print $node->field_email['und'][0]['email'] ?>

I figure I have to wrap that in a call to invisimail_encode_email, as such:

<?php print invisimail_encode_email($node->field_email['und'][0]['email'], 'html_entities') ?>

but that did not work (error message about undefined array index). So, maybe I'm calling that function with the wrong parameters? or maybe I'm calling the wrong function.

Basically, how do I call invisimal from within php?


texts: How do I use "DOES NOT CONTAIN" with \Drupal\Core\Entity\Query\QueryInterface?

texts:
I have a node with a list field of text values. I want to write a query that gets all nodes that don't have one of the selected values.

How do I write this query?

$query->condition('field_states_excluded', $state, 'DOES NOT CONTAIN');


texts: How to change the "vid" in a field content_taxonomy

texts:
I would change the vid in this code, I tried to replace it but not to change how do you make it?

 $fields[] = array(
    'field_name' => 'field_galerie_type',
    'type_name' => 'rf_galerie',
    'display_settings' => array(
      'weight' => '2',
      'parent' => 'group_galerie_donnees',
      'label' => array(
        'format' => 'above',
      ),
      'teaser' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      '4' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => array(
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
    'widget_active' => '1',
    'type' => 'content_taxonomy',
    'required' => '0',
    'multiple' => '0',
    'module' => 'content_taxonomy',
    'active' => '1',
    'save_term_node' => 1,
    'vid' => '60',
    'parent' => '0',
    'parent_php_code' => '',
    'depth' => '',
    'widget' => array(
      'group_parent' => '0',
      'show_depth' => 1,
      'default_value' => array(
        '0' => array(
          'value' => '',
        ),
      ),
      'default_value_php' => NULL,
      'label' => 'Type',
      'weight' => '2',
      'description' => '',
      'type' => 'content_taxonomy_select',
      'module' => 'content_taxonomy_options',
    ),
  );


texts: how to get POST data value to menu function using ajax& jQuery in drupal

texts:
jQuery(document).ready( function () {
    jQuery("#edit-suspension").change(function()
        {
             var basepath = Drupal.settings.basePath;
           var key = jQuery(this).val();

      //alert(key);
  jQuery.ajax({
           type:'POST',
           url: basepath+ "custom_menu",
           data : {output:key},
            success:function(data)
            {
                     jQuery('#content').html(data);
              }
        });
    });

how to get the output value in the menu function using $_POST method


texts: How to conditionally update and import nodes using Migrate?

texts:
I need to migrate new nodes and update others in the same time. 2 installations of the same project are out of sync, which means, that the same nid may not indicate the same node on both sides. But I'm sure they're the same if their titles are equal. So I think, that I need a conditional field mapping, as illustrated in the following pseudocode:

if source_nid = destination_nid
  if source_title = destination_title
    addFieldMapping('nid', 'nid')
else
  continue

I have only one idea, how can I do this - split migrations into two different parts with filters managed by prepareRow() method (one of the for node updating, the other for import of new nodes). Is this the only way? I would appreciate something more elegant.


texts:
I want to modify query parameters used when accessing a Drupal page. I tried implementing hook_url_inbound_alter(), but it only allows to parse/modify the path, and it doesn't allow any interaction with the query string.

I see there is also drupal_get_query_parameters(), which allows to read the query parameters.

I could detect the presence of a query value in index.php and do a string replacement on the value if needed, but I don't want to pollute the front controller.

Do you have any better advice?


texts: Regions missing on page templates defined in a controller

texts:
I have two custom blocks that I created in files placed in the modules/custom/mymodule/src/Plugin/Block folder.

I defined two extra regions in the mytheme.info.yml file
I placed the blocks in the regions using the 'Block layout' page in the admin area.

It's all working great on all pages that use the "normal" twig template naming conventions, such as page.html.twig, page--front.html.twig and other templates I created based on the suggestions in the comments twig debug outputs.

My problems started when I created templates via a Controller. Here is an example from my routing.yml file:

mytheme.bikes:
  path: '/catalog/Bikes'
  defaults:
    _controller: '\Drupal\mytheme\Controller\MyPageController::catalog_bikes'
    _title: 'Bikes'
  requirements:
    _permission: 'access content'

And the controller:

public function catalog_bikes() {
  return array(
    '#type' => 'page',
    '#theme' => 'page__bikes',
  );
}

If i go on mysite.com/catalog/Bikes the page--bikes.html.twig template is loaded, BUT, without the extra regions I added to mytheme.info.yml file


texts:
While doing an upgrade to the Devel-module something went terrible wrong. Decided to remove the module through the "Uninstall"-tab. The module is however not listed there, while it's marked as active under the "Install"-tab. Removing the module manually (deleting the files) causes errors so I cannot do it this way either.

Ironically I need this module to be able to re-install other modules which are outdated. Anyone got any feedback how to cleanly remove the Devel-module without the Uninstall tab?

I do not have Drush for D8, need another way as I got D6 and D7 instances installed on the same environment aswell.


texts:
I would like my users to be able to select the countries they have visited and then highlight those countries on a world map.

I've come across a few commercial flash solutions with XML config files but would rather like to avoid flash and have jpgs or pngs generated.

This site is a good example of what it should look like.


texts: Dynamically filling up fields of a node in Drupal

texts:
We have a content type named "Person", which has fields as Full Name, Age, Address etc.

There are thousands of people entries on the site. We are using Views to sort out people's list on different pages as per need.

Lately, there has been a requirement that we need to sort the list of people by Last Name. But the problem is that there's no last name field as there's only "Full Name" field of the person in the site.

I am using views to sort the results in the pages and I am not sure how to sort the results by last name. Is there any way I can achieve this?

May be I can create a field as "Last Name" in the content field but is there a way I can dynamically fill in the Last Name by extracting Last word from Full Name?

May be through someway in SQL?

Any idea or assistance would be highly appreciated.

Thanks.


texts: Integration between js and php code in custom module

texts: I'm writing a custom module which outputs blocks with various deltas. Later, a jQuery code has to be attached for every generated block, aware of their id's, as in $('#mymodule-block-delta'). How is that accomplished?


texts: How to configure an additional field for a bundle that is created by a custom module

texts:
In Drupal 8 have a custom module for which bundles are created via yaml files in its config/install folder. I need to add an additional field to the 'schema.'

My steps were:

pm-uninstall the module
delete the content type via the ui
rebuild cache
add the new yaml file (a clone of an existing file with the field name changed)
re-enable the module

This gave me an unmet dependencies error.

If I remove the file and enable the module, the bundle is created, without the field of course.

I can create the field via the ui, but then its yaml file is not present in the install folder, so the module isn't deployable as-is.


texts: Passing Promo Code to Drupal Commerce via URL

texts:
I'm using Drupal 7 and Drupal Commerce Module. I'd like to be able to provide customized links with promo codes in them (promo codes would be a key/value pair in a format like www.url.com/?promo=specialK or some such thing). So Group A, for example, would get their link and click on it and it would bring them to our Registration/Product page form.

This would be the same form for every group with different discounts applied to the product price depending on the promo code attached to the URL.

If the promo is expired I'd like Drupal to just give the user a page that says something like 'Your promo is expired. Sorry. blah blah blah.' However, if the promo is NOT expired it would just apply the discount to the price and let them fill out the rest of the form and submit their payment information, etc > the normal drupal commerce procedure with the discount applied.

I'm thinking of approaching this with Drupal Coupon module to enable the discounting functionality, but I don't know if it's possible to use a URL to pass that promo code automatically to Commerce. Does anyone know?


texts: Way to remove the Override Title form option in Panel component config?

texts:
I am making a Panel Component, in D7, and do not want to show the title. I can just not render out the title on the page - that's fine - but I'd also like to remove the form fields that allow you to enter in the title.

Would anyone know how to do this? I cannot find any info out there.


texts: Drupal 8 CKeditor behaves LTR in an RTL site

texts:
I've installed Drupal 8.0.2 in a standard installation process and in English.

I later changed The site's default language to Hebrew (Which is an RTL language) and my content type is now setted to the site's default language - Hebrew. I even determined my user's administration account, called "admin", to Hebrew (a new Drupal 8 feature that let's you pick a specific front-end language to a certain user).

After that I've organized the CKeditor full-profile edit-bar in an RTL manner at it's configuration page (and flushed all caches afterwards):

You saw - I did everything by the book, and yet:

I encounter two issues that comprise my whole problem:

1. The CKeditor edit-bar appears the opposite from how I arranged it (as can be seen one image up).

2. CKeditor input area typing cursor starts in the left instead of the right (I could easily manually flip the Edit-bar but the cursor will still appear in the left).

When I installed a test site in Hebrew from the start (instead of installing first in English and then add Hebrew and make it default), I didn't encounter that problem, and the edit-bar was RTL. I have no clue how to explain this! Maybe you can!


texts:
I'm getting a 404 on a user/reset/%/%/% path. The cached router item looks good but the page is still not found.

Array
(
[title] => Reset password
[page callback] => drupal_get_form
[page arguments] => Array
    (
        [0] => user_pass_reset
        [1] => 2
        [2] => 3
        [3] => 4
    )

[access callback] => 1
[type] => 0
[file] => user.pages.inc
[module] => user
[_load_functions] => Array
    (
        [2] =>
        [3] =>
        [4] =>
    )

[to_arg_functions] =>
[weight] => 0
[_number_parts] => 5
[_parts] => Array
    (
        [0] => user
        [1] => reset
        [2] => %
        [3] => %
        [4] => %
    )

[_fit] => 24
[_visible] =>
[_tab] =>
[tab_parent] =>
[tab_root] => user/reset/%/%/%
[menu_name] => user-menu
[delivery callback] =>
[theme callback] =>
[theme arguments] => Array
    (
    )

[load_functions] => a:3:{i:2;N;i:3;N;i:4;N;}
[access arguments] => Array
    (
    )

[title arguments] => Array
    (
    )

[title callback] => t
[description] =>
[position] =>
[context] => 0
[path] => user/reset/%/%/%
[file path] =>
[include file] => modules/user/user.pages.inc
)

I've used drush fn-hook menu_alter to see if anything is changing this path but I would figure that end up in the cached router entry above. Any help with this would be much appreciated.


texts: OpenLayers module only displays latitude/longitude instead of map

texts:
So I began experimenting with OpenLayers because I'm creating a content type that requires it.

I followed the Step-by-step instructions from the docs (added geofield to node, create data overlay view, cloned and set up my map and created a page view to display the map)... but what I actually need is to somehow embedded the maps for each post. What is the next step for something like this? Right now in each node I see the node pictures and this: POINT (-0.138513 50.8239).


texts: Should I use Spaces or Domain Access to share & separate content between subdomains?

texts:
I realise that without the following additional information the title question is too broad.

I have multiple sibling Drupal 7 sites with their own domains that I wish to consolidate into a single site, whilst to some degree retaining their apparent separateness. The rationale is discussed in this blog post, but to summarise:

The sites have been developed in parallel and share many features
Cross site search indexing would be much simplified by a single database
Maintenance of a single site would be less costly
Updates and new features could be rolled out simultaneously across sites
The single, [incidentally] simplified and documented site would be easier to hand over to another developer

From the approaches considered in these two excellent but dated appraisals from Atchai and Palantir I had initially identified Spaces as my preferred, maintainable solution, but an apparent shift in usage, and seemingly low overall usage of Spaces leads me to question my assumptions.

Googling shows a dearth of recent articles on the subject, and d.o usage shows a decline in the weekly installs for the spaces module, which implies that people are taking a different approach.

Domain Access, however, is on the up:

Does anyone have any recent experience that would help?


texts: How to Hide Specific Pages to Anonymous Users

texts:
I need to be able to block the user's URL to be seen by anonymous users. Specifically:

http://www.mysite.com/users/user_name and http://www.mysite.com/user (which are the same page but different URLs).


texts:
Is there a module from Drupal Commerce to schedule Delivery date and time ?

Customer is required to specify the date and time. This then will be displayed in the admin side.

thanks appreciate your help


texts: Suggested template file is not working for Custom Search's template

texts:
I have installed Custom Search module for my drupal7 setup.

I am trying to modify template files for search-result and search-results.

By default its using template files from contrib module's theme itself which are as follows:

sites/all/modules/contrib/custom_search/theme/custom_search-results.tpl.php
sites/all/modules/contrib/custom_search/theme/custom_search-result.tpl.php

As per the theme-debug's hook suggestions I have created tpl files and have placed them within my sub-theme's templates directory, which are as follows:

sites/all/themes/bootstrap_sub/templates/custom-search-result.tpl.php
sites/all/themes/bootstrap_sub/templates/custom-search-results.tpl.php

I have cleared cache for several times, and still it uses template files from the module's theme directory.

Can anyone please help me out with this issue.

Thanks in advance.


texts: Alter views exposed filter using any hook function

texts:
I want to alter an exposed filter of a view to add a new field to the existing filter. I tried the same with hook_views_pre_view() and the new filter field added successfully. But after typing something to that autocomplete field, that field disappears. Means on the first page load, field displaying correctly but when AJAX starts it disappears. Also I tried with other hook functions like hook_views_pre_build and hook_views_pre_execute(). Can any one help me on this? Thanks.

function modulename_views_pre_view(&$view) {
  if ($view->name == 'my_view_name') {
      $view_filters = $view->display_handler->get_option('filters');
      //Add new field
      $view_filters['new_field'] = array(
        'id' => 'new_field',
        ..
        ..
      );

     $view->display_handler->override_option('filters', $view_filters);

  }
}


texts:
I have a block that displays an item fetched from the database at random. The block has DRUPAL_NO_CACHE as cache parameter. However, when visiting the page as anonymous user with the cache on, the item never changes.

Some code:

function foo_block_info() {
  $blocks = array();

  $blocks['foo'] = array(
    'info' => t('Foo'),
    'cache' => DRUPAL_NO_CACHE,
  );

  return $blocks;
}

function foo_block_view($delta = '') {
  if ($delta == 'foo') {
    $block = array(
      'content' => theme(
        'foo_block',
          array(
            'item' => entity_get_controller('foo')->get_random_foo(),
          )
        ),
    );
    return $block;
  }
}

function foo_theme($existing, $type, $theme, $path) {
  return array(
    'foo_block' => array(
      'template' => 'foo-block',
      'arguments' => array(
        'item' => NULL,
      ),
    ),
  );
}

I suspect it's a Drupal Core bug, I've checked the forums but can't really find a solution for Drupal 7.

I know I could insert the item in the DOM with AJAX, but that's a last resort.


texts: hook_update_n($sandbox) batch getting executed only once

texts:
Following is the code where I'm willing to update the description of the field_meta_tags of all my products using the batch process.

It's getting executed & working as expected, but only for the first batch.

function mymodule_update_8001($sandbox) {
  if (!isset($sandbox['total'])) {
    $products = \Drupal::entityQuery('commerce_product')
      ->condition('type', 'default')
      ->execute();
    $sandbox['total'] = count($products);
    $sandbox['current'] = 0;
  }

  $products_per_batch = 25;

  $products = \Drupal::entityQuery('commerce_product')
    ->condition('type', 'default')
    ->range($sandbox['current'], $sandbox['current'] + $products_per_batch)
    ->execute();

  foreach ($products as $product_id) {
    $product = Drupal\commerce_product\Entity\Product::load($product_id);
    $product->set('field_meta_tags', serialize(['description' => '']));
    $product->save();
    $sandbox['current']++;
  }

  \Drupal::messenger()
    ->addMessage($sandbox['current'] . ' products processed.');

  $sandbox['#finished'] = empty($sandbox['total']) ? 1 : ($sandbox['current'] / $sandbox['total']);
}

Once the above hook_update_n($sandbox) is executed, getting the following output at the terminal:

 --------------- ----------- --------------- -------------
  Module          Update ID   Type            Description
 --------------- ----------- --------------- -------------
  mymodule        8001        hook_update_n   Updates.
 --------------- ----------- --------------- -------------

 // Do you wish to run the specified pending updates?: yes.

>  [notice] Update started: mymodule_update_8001
>  [notice] Update completed: mymodule_update_8001
>  [notice] Message: 25 products processed.
>
 [success] Finished performing updates.

Not sure how $sandbox['#finished'] is getting the value as 1, since that's how I remember we ask the batch to stop processing.


texts: Formatting is lost after publishing the content

texts:
I am using WYSIWYG with TinyMCE in my Drupal 7 website. I observed that the copied content looks similar in editor and even preview also looks nice. But all the formatting is lost after publishing the content.

To debug the issue, I checked the HTML and found that the actual style is present in the code. Please see the below screenshot-

I noticed that after disabling the color property of background for td element, the original color appears. Please see the below screenshot-

Please suggest any way to solve this issue.


texts: Display the user avatar in  a user panel

texts: Is there an alternative to make the login box that turns into the default user panel (My Account, Administer etc.) display the user's profile picture above the username?


texts: How can I programmatically add webform elements to an existing webform?

texts:
I have a webform that is very simple, it's a questionnaire. It is attached to a content type called "event". e.g.

discussion_1:
  '#type': likert
  '#title': 'Discussion 1'
  '#questions':
    'Question 1': 'Question 1'
    'Question 2': 'Question 2'
    'Question 3': 'Question 3'
  '#answers': likert_five_scale

Is it possible to alter this webform when the webform is rendered by populating the questions from another source such as a view?

i.e. there will be a variable number of discussions with variable numbers of questions.

I am trying to dynamically build a webform based on data that is coming from the node to which the webform is attached


texts: How customize update interval of aggregator module

texts:
By default   update inteval of RSS aggregator in Core aggregator module start form 15 min, I mean 15 min is minimum value,

But I need update RSS aggregator shorter than 15 min,and update my feed each 2,5,10 minute too,

How can I set Update interval to what I required?

one solution is using alternative module like feeds module but it is not stable yet.


texts: Render a node field inside page.html.twig

texts:
I have an image field on my content type (field_hero_image).

I don't want it to render in the node.html.twig file. However, I DO want to render it in the page.html.twig file. Specifically, I want to render it alongside the page title.

What code would I use in my page.html.twig file to access node level fields and render them?

(There is a similar question posted, but I was unable to use the answer provided there to solve my problem.)

This for Drupal 8 theming.


texts: Get list of custom fields and update their settings programatically

texts:
I'm using D8's core contact form, I have added some custom fields and I want to change one of custom fields' settings config programatically.

I have tried this

\Drupal::service('entity_field.manager')->getFieldDefinitions('contact_form')

but I get error:

LogicException: Getting the base fields is not supported for entity type Contact form. in Drupal\Core\Entity\EntityFieldManager->buildBaseFieldDefinitions() (line 204 of core/lib/Drupal/Core/Entity/EntityFieldManager.php).

Is there any way to get list of fields and update their configs and settings?


texts: How to add tables relations into custom entities content type?

texts:
I have a custom content entities in my Shop module.

I want 2 tables :

Orders
Order line

I create a custom content entity for orders, but I ask about the way to do the order line.

Do I need to create a second custom entity content and make a field reference orders table inside?

Or there is a way to declare subTable into the main entitie (orders for me)?


texts: Adding an existing view to content nodes sorted by taxonomy terms

texts:
I'm setting up a webshop with a pre-made theme I bought. My issues is the following:

I'm trying to set up the product grid so it can be filtered by product types, which I store in a vocabulary.

I added a menu to the product grid page using the Taxonomy Menu module, which creates a menu block from a vocabulary, and the menu links lead to pages where products display sorted by the taxonomy terms assigned to them. It's not really filtered, tho, the path is mysite.com/vocabularyname/termname - so, it's all the nodes with the term assigned to them.

The theme has a neat view for the product grid, however, when I click on any item in my menu, the page, altohugh filtered properly, does not appear with the same layout, it's only fields thrown on top of each other, and I can't seem to be able to assign the same view to those pages.

I tried cloning the page display of the original grid and setting the view path to the URL of the pages sorted by the taxonomy terms (smt like this: mysite.com/vocabualryname/*). Is it the right approach at all? Or am I missing something, contextual filter, or otherwise?

It might be a really basic issue, all the better for me, I'm quite new to drupal.


texts: Token, Filefield_Path, Path Auto and Image

texts:
I'm trying to put the Images (Image 1.jpg) for a content type (Critter\Fluffy) into a folder such as thus:

files/Critter/fluffy/Image1.jpg

Yet, no matter which set of tokens, it doesn't take the Title of the Node - it uses the edit name.

FILE (FIELD) PATH SETTINGS

File path-> Result

[current-page:url:path] -> files/node14edit/fluffy3.jpg
[current-page:title] -> files/edit-critter-fluffy/fluffy3.jpg
[current-page:url:unaliased:path] -> files/node14edit/fluffy3.jpg

What am I missing?


texts: Localhost Drupal Install on Linux shows file and not site

texts:
I am trying to set up a local Drupal install on my Linux 16.04 laptop install for learning/exploring Drupal.

I have made it through this install guide
, completing all steps, but when launching my http://my_example_drupal_site.localhost/web/
I am getting the below output.

Any idea why this is?

/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
 */

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;

$autoloader = require_once 'autoload.php';

$kernel = new DrupalKernel('prod', $autoloader);

$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();

$kernel->terminate($request, $response);

Solved

Followed this guide as suggested and got my install working.

Ran into two issues along the way. Turns out when setting up my Linux Box long ago, I had an entry in /etc/hosts/ file that had a name for 'localhost'.

When pointing my browser at localhost, the default Apache "It Works!" page did not work. However when pointing to the name I had in /etc/hosts/ it did work.
But php file would not load and only showed "Index Of /" in the browser.

After more searching, I came to find I needed to load the mod in apache.

Trying:

a2query -m php7.0
No module matches php7.0

did not work, even though it was already installed which I discovered after trying to reinstall it

php7.0 is already the newest version (7.0.25-0ubuntu0.16.04.1)

Finally stumbled upon this answer in AskUbuntu and low and behold this worked for me, allowing me to enable the mod in apache

sudo apt-get purge php*

sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi  php7.0 libapache2-mod-php7.0

I don't know how or why, but it worked for me.


texts: Views CSV export, not exporting complete data

texts:
I have one CCK field called "Questions" with type "Long text".

I'm trying to export this value using views data export in CSV format.

Below is the text to export.

  Some text, trying to export.

While export in CSV, I have got only partial data. ie, "Some text".

After comma "trying to export" value is missing in CSV.

Is there any way to get complete data?

Note: Other than "views_pre_render"


texts: What's the alternative for my failing PHP code about block visibility based on user?

texts:
I would like to remove certain blocks, so that admin can not see them.
In block visibility settings - in pages tab, I try to put followng php code but with no effect. (In user tab there is no php field to put code.)

<?php
if(arg(0) == 'administrator' )
return true;
else
return false
?>

What I am doing wrong?

EDIT: On my other D6 site I use argument:

 user_access('access administration pages')

but on D7 site it does not work, what can be another way of doing it?


texts:
To handle users who like to occasionally use the custom ellipsis character from MS Word in titles, I would like to add replacement options for the character in the Punctuation settings for Pathauto using hook_pathauto_punctuation_chars_alter(). The problem is determining what value to put in the value setting in the hook. I found the T_ELLIPSIS constant in tokenizer.php, and tried using it like so:

function my_module_pathauto_punctuation_chars_alter(array &$punctuation) {
  $punctuation['ellipsis'] = array(
    'value' => T_ELLIPSIS,
    'name' => t('')
  );
}

and the value shows as Ellipsis (389) for the field label in the settings. However, when the alias is generated with the ellipsis character in the node title, it doesn't get replaced.

Is there a better/easier way to handle this? Also, should I use something like the UTF-8 code instead of the constant?


texts: Every five seconds without refresh the new web page

texts: How can I on a drupal site do a partial refresh of a page's content with AJAX every 5 second?


texts: I could not find a clear explanation about what is a 'fid'. I got is an identifier for file in drupal, but no more than that. How it is generated? Is unique for any file? When it is used and why? Could someone give a clear explanation of this entity?


texts: difficult to understand drupal hook menu function

texts: I am new to drupal.I can't understand how drupal hook menu works.I visit the drupal site and try to read documentation.but it is too difficult to understand.can you please tell me a good tutorial so that I can understand how they work.thanks in advance


texts: Calling node delete (node_delete_multiple) is not deleting all comments from database

texts:
When I do a query on the database (SELECT * FROM comment c  where c.nid = 119445765;)  I get a 12 rows in set (0.00 sec)
The I call node_delete_multiple(array(119445765)).
Then I go back to the database and perform the same query SELECT * FROM comment c  where c.nid = 119445765;)  I get a 5 rows in set (0.00 sec).

Now These may be replies to comments since this is a forum. However, how do I ensure they are deleted? Do I have to perform the query myself?

UPDATE:

I have stepped debug this issue here is my notes:
1. node_delete_mutliple -> invokes comment_node_delete
2. comment_node_delete perform this query $cids = db_query('SELECT cid FROM {comment} WHERE nid = :nid', array(':nid' => $node->nid))->fetchCol(); and it correctly returns  all cids  associated with the node.
3. comment_node_delete calls comment_delete_multiple which in turns calls $comments = comment_load_multiple($cids); NOW comment_load_multiple($cids); is not returning the correct number of comments. Surprisingly it is always ommiting comments by a certain user.

I am continuing to debug and will add more info,

Update 2

 $cids = db_query('SELECT cid FROM {comment}
 WHERE nid = :nid', array(':nid'  => 119318471))->fetchCol();
 dpm($cids); // Gives the correct number of $cids
 $comments = entity_load('comment', $cids, $conditions = array(), TRUE);
 dpm($comments); // Is an array with fewer comments than number of $cids

So the problem so far is in entity_load.

Note I failed to mention that the database is migrated from another system and may contain some bad references.


texts: Independent arguments for View Page and Attachment

texts:
Setup:

A Views page with an Attachment

Is it possible to have the first argument in the url affect the main page only, and the second argument affect the attachment only?

e.g.
http://url.com/%1/%2

%1 is a cck field in a node.  If %1 == 'acme' the main page displays a list of all nodes where a certain cck field equals 'acme'.  It then ignores the second argument (e.g. %2 can equal anything or nothing without  affecting the page list).

%2 is an nid.  The Views page's attachment displays a single node where the nid the value of the second argument.  (Argument 1 will always be true for this node, so it can be inherited, but it doesn't have to be).

Is this possible?

I also tried by using a combination of an argument for the page and exposed filter for the attachment I could create a url like:

http://url.com/cck_field_value_to_match?nid=123

…but that still produced no results for the attachment.

…but that still prod


texts:
I have a table in node page. i have requirement to make it sort-able on click.

can anyone help?


texts:
Can we use Boost together Cloudflare?

I am curious whether using both can be enabled on the site, and whether doing so will actually improve performance.


texts: set new content-type as product in ubercart

texts:
When I install Ubercart, it creates a new content type ("Product"), and uses it for handling products.

Can I create another content type, and use it as product?


texts: I have Facebook for Drupal installed on my Drupal instance. My application and everything is working fine. I want to make it so one of my custom content types requires Facebook login to submit. Can I do this using the hook_form_alter()? This will be for anonymous users. I want them to see the content type (which they can already see) but once they fill in the fields and hit submit the form will require for them to be logged in through Facebook. Should i use that hook or can i accomplish this in another way?


texts:
I have created a custom module whishow data from table.I have used following code:

$query = $query->extend('PagerDefault')->extend('TableSort');
$query
->fields('u', array('fields'))
->fields('n', array('fields'))
->limit(50)
->orderByHeader($header)
->setCountQuery($count_query);

It show the pagination correctly (50 per page) when there is less data.But when no. of rows exceeds 1 lakhs it show inconsistent rows per page.


texts: Show step-by-step dialogs for helping user with using the site

texts:
I built an app with Drupal, and I would like to add step-by-step dialogs to help users learn how to use the app.

I found some boostrap plugins, but I would like to know if there is already a Drupal module that has this functionality.


texts: Dismiss Ctools popup on click of a button(running on ajax) inside ctools popup

texts:
I have created a ctools popup in which I have 2 buttons(add to cart and add to wishlist) which run on ajax.I have used Commerce Ajax Add to Cart module(https://www.drupal.org/project/dc_ajax_add_cart) which displays the popup showing the details of product added to cart when I click on add to cart.

The thing I want to do is when I click on add to cart button ctools popup should be dismissed and only the popup showing the details of product added to cart should be displayed.I tried

$(document).ajaxComplete(function(){
Drupal.Ctools.Modal.dismiss();
});

but using this the popup gets dismissed even if I click on add to wishlist as it also runs on ajax.

Any help would be of great use.


texts: How to output unlimited value Field Collection with dates into a Views table format with no duplicates?

texts:
I have a Content Type called "Safety Training". It has various fields within it, including a Field Collection named "Dates & Locations", set to unlimited values so they can add infinite date/location pairs.

The two fields defined within the Field Collection are Date (a date ISO field with the ability to enter start/end date and times) and Location (taxonomy). The Date and Location fields are both only single value.

I have a Views page, where I am outputting the individual nodes and grouping them by category of Course Type. This is the format I need the Views table in (from the old site, static HTML):

This is what I have right now in Views (this is in the preview):

How can I separate the date, time, and location into individual table columns called "Class Date", "Location", and "Start/End Time" that will group them like in the old site?

I tried creating a Relationship, choosing "Content: Dates & Locations (field_safety_date_location)", but this immediately creates a duplicate of each item (so there's two Worker Initials, because there's two dates?).

This is the SQL query Views displays:

SELECT node.title AS node_title, node.nid AS nid, draggableviews_structure.weight AS draggableviews_structure_weight, 'node' AS field_data_field_safety_date_location_node_entity_type, 'node' AS field_data_field_safety_standard_fee_node_entity_type, 'node' AS field_data_field_safety_late_fee_node_entity_type, 'node' AS field_data_field_registration_link_node_entity_type, 'node' AS field_data_field_safety_category_node_entity_type
FROM
{node} node
LEFT JOIN {draggableviews_structure} draggableviews_structure ON node.nid = draggableviews_structure.entity_id AND draggableviews_structure.view_name = 'safety_environmental_training_schedule_and_fees' AND draggableviews_structure.view_display = 'page_1' AND draggableviews_structure.args = '[]'
WHERE (( (node.status = '1') AND (node.type IN  ('safety_environmental_training')) ))
ORDER BY draggableviews_structure_weight ASC

If anyone has any idea, please help! Thank you.


texts: Regions not showing in block region demonstration

texts:
My regions are not showing anymore in my block regions demonstration. However they are showing in my block layout.

The regions also not display on the pages. I don't know what I did wrong. I checked the .info.yml, libraries.yml and .theme but nothing helped. I cleared the cache and still it wouldn't display.

What I did:

Cleared the cache
Checked info.yml
Checked .theme
Checked .libraries.yml
Added blocks to the regions in question


texts:
I have View set up to display a list of images that are related to nodes elsewhere in my site, and I've styled them so that hovering over them darkens the image and displays the node's title. Unfortunately, the title div obscures the image, and making the title into a link only affects the title text.

What I'd like to do is wrap the title div in  tags, so this:

Title

Turns into this:

Title

I have an inkling that I'll have to do this either with hooks or in one of the views.php files, but I'm not sure where to start; can anyone help me?


texts:
I am using a node template to layout a node and I want to reference content from other nodes.  Obviously I have the current node fields available to me, but I want to select any of the sites nodes.

I understand I can create view blocks and include these in the template but looking at the node tab in the panel content, there is an option to set the node, the only option being 'node being viewed'.  This kind of suggests there may be a way of references any node.


texts: I have a site that I have a form for users that they write down their personnal info's. I did a view, and then I made a field that has this view. Now what I want to do is to see this view field in the user's edit form. I can see all the fields that I want in the user's form but I cannot see the view field.


texts: Create an Image link right next to the content title of a content type

texts: How do I create an image(eg. plus_sign.png) link just next to the content title of a given content type? Please help!


texts:
I'm trying to use Search_api_solr and search-api.
I install the required modules and run the solr server and create a core.
But when I'm trying to add a server to my drupal 8 site, an error appears
Solarium\Exception\UnexpectedValueException: Neither collection nor core set. in Solarium\Core\Client\Endpoint->getBaseUri() (line 299 of /var/www/html/vendor/solarium/solarium/src/Core/Client/Endpoint.php).

I try to change the following block in Endpoint.php file to my data but it's not working.

protected $options = [
        'scheme' => 'http',
        'host' => 'xx.xx.xx.x',
        'port' => 8983,
        'path' => '/solr/',
        'collection' => null,
        'core' => 'my_core',
        'timeout' => 5,
        'leader' => false,
    ];

also, should the host include the http:// or only the ip address?
However, I try all above with no luck.
Any advice. Thanks in advance.


texts: How to access the raw content of a views field, for use with Services Views

texts:
I have a user that I want to expose to services. Using Services Views. I'm using fields as the format, and adding the "photo" field to my display. My issue is that when I view the service (as JSON). I get all the HTML as well as th image URL, for instance

users_node_picture: "<img typeof="foaf:Image" src="http://mysite.com/sites/mysite.com/files/styles/thumbnail/public/pictures/picture-36.png" alt="" />",

I need just the url, I've tried the following with no luck.

Strip HTML (removes everything)
Rewrite output (same result)
Row theming (does not effect the services result, only the html page)
Installed Views PHP (by returning the row, I simply get the field id)

Is there any other way to effect the output of this field before it is outputed by Services Views? I thought perhaps I could do something with template_preprocess, but I'm not really sure how I would go about doing it.


texts:
So I'm new to Drupal and am creating my first module. I can get the page to display html, but I'm not quite sure how to connect to the MySQL database. Here is my code:

<?php
// $Id$

/**
 * @News
 * First module
 *
 * Just a simple news module
 */

function news_main() {
    db_set_active('default');
    $query = mysql_query("SELECT * FROM news");
    while ($news = mysql_fetch_object($query)) {
        $output .= '
'.$news->title.'

'.$news->body.'

'.$news->date.'
';
    }
    return $output;
}

/**
 * Implements hook_menu().
 */
function news_menu() {
    $items = array();

    $items['news'] = array(
        'page callback' => 'news_main',
        'title' => 'News',
        'access arguments' => array('access content'),
        'type' => MENU_NORMAL_ITEM,
     );

    return $items;
}
?>

I just get a blank page whenever I try to view it. I'm sure it's something simple, but I'm completely new to Drupal and it's API. I've looked through documentation for hours and couldn't figure it out.


texts: Rules with Commerce Discount for a certain type of product.

texts:
I'm trying to get a handle on Rules in Drupal.  The concept seems to be very flexible and straight forward for the most part.  However, I'm stuck and hoping someone can lend some assistance.

I have a Drupal Commerce store that sells two items.  Gift cards and books.  The store offers a volume discount of buying 3-5 books at a time. I have got the discount working using Commerce Discount and rules.  The issue is the discount is added to the entire cart, not just books.  Under Rules there is no way, that I can find, to select the content type of the line item being added and compare it to the books custom content type.

Can someone please explain or help me with where to look to only apply the discount to commerce products from the custom content type Books.

Here is the basic setup..
Drupal Core 7.15
Drupal Commerce 7.x-1.3
Drupal Discount 7.x-1.x-dev
Rules 7.x-2.2

Books is a Custom Content Type.
Discount should only be applied to Books.

Rules Setup
1. Event
   + Calculating the sell price of a product
2. Condition:
   + Entity exists by property //This one way I have tried but not working, seems the most reasonable way
   + Total product of type quantity comparison //This counts the total by product in cart
3. + Apply discount to product


texts: Image Migration Failed - pulling the source ID instead

texts:
I have a migration that just failed. Error:  File 'public://import/3' does not exist
The images I am pulling into the node are in that folder, public://import. How do I get the image (image name) and get it into the node? I am confused with all the reading and code snippets I find always show something different. I finally got this far now I need to figure out the next step but I am not sure what to do here. Please help if you can. Thanks!

Code:
id: photo
migration_group: null
label: Photos
source:
  plugin: csv
  path: modules/custom/custom_migrate/assets/csv/profile.csv
  header_row_count: 1
  enclosure: '"'
  ids:
    - photo
  fields:
    5:
      name: photo
      label: Photo
  constants:
    source_uri: 'public://import'
    dest_uri: 'public://photos'
process:
  file_name:
    -
      plugin: callback
      callable: trim
      source: photo
  file_source:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_uri
        - '@file_name'
    -
      plugin: urlencode
  file_dest:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/dest_uri
        - '@file_name'
    -
      plugin: urlencode
  uri_file:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/dest_uri
        - '@file_name'
    -
      plugin: urlencode
  filename: '@file_name'
  uri:
    plugin: file_copy
    source:
      - '@file_source'
      - '@file_dest'
    reuse:
      - 'TRUE'
  uid:
    plugin: default_value
    default_value: 1
  status:
    plugin: default_value
    default_value: 1
destination:
  plugin: 'entity:file'
migration_dependencies:
  required: {  }
  optional: {  }

Here is the profile code to hopefully help explain the full picture. Thank you for any guidance!!!!
dependencies:
  module:
    - migrate_source_csv
id: profile
migration_tags:
  - CSV
migration_group: null
label: Profile
source:
  plugin: csv
  path: modules/custom/custom_migrate/assets/csv/profile.csv
  header_row_count: 1
  ids:
    - id
  #column)names:
  #  0:
  #    name: image_file
  #    label: Image file

  #keys:
  #  - id
  fields:
    0:
      name: id
      label: ID
    1:
      name: first_name
      label: First Name
    2:
      name: last_name
      label: Last Name
    3:
      name: birthday
      label: Birthday
    4:
      name: email
      label: Email
    5:
      name: photo
      label: Photo
    6:
      name: languages
      label: Language
process:
  type:
    plugin: default_value
    default_value: profile
  title:
    plugin: concat
    source:
      - first_name
      - last_name
    delimiter: ' '
  field_first_name: first_name
  field_last_name: last_name
  field_birthday: birthday
  field_email: email
  field_language:
    plugin: entity_generate
    source: languages
  field_photo:
    -
      plugin: explode
      source: photo
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: callback
      callable: strtoupper
    -
      plugin: migration
      migration: photo
      no_stub: true
destination:
  plugin: 'entity:node'
migration_dependencies:
  optional:
    - photo


texts: How can I assign a URL with a fragment (#) as an array value?

texts:
In my form:

$form_state['redirect'] = 'mypage/' . $nid . '#comment-form';

redirects to:

/mypage/1%23comment-form

...so it doesn't jump to the comment form. I tried:

$form_state['redirect'] = l('', "mypage/$nid", array('fragment' => 'comment-form');

...that retuned a bigger mess. I need to link to:

/mypage/1#comment-form

Basically, I'm trying to jump to the bottom of the page the user is redirected to.

Thanks


texts: send emails to specific addresses based on value of fields

texts:
I have field_a with select list of 10 value

when field_b is checked
and
when a value of field_a is alfa or beta or ecc, send email to address1 or 2 or ecc

I try with custom module for advance control of features

function test_mail_node_submit($node, $form, &$form_state) {
 if($node->type == 'rso') {
  if ($node->field_b['und'][0]['value'] == TRUE){
   if ($node->field_a['und'][0]['tid'] == '10'){
    mail('example1@mail.com', 'example2@mail.com', 'example text');
   }
  }
 }
}

I did not understand how to use drupal_mail, or hook_menu hook_mail_alter


texts: Custom view single content wrapper css style

texts:
My custom view which shows only two rows of data looks like this

content1
content2

but I want to display them side by side like this
content1  content2

to do this I have to apply float left and width 50% to the content wrapper css class or id
but the problem it has a long views-row views-row-1 views-row-odd views-row-first css class how do I modify this class ?

Result I need is


texts: How to validate and store Drupal commerce Checkout Date and Time

texts:
I am working on catering services Drupal Commerce website in which each catering companies having open hours(for eg: 8 AM to 11 30 PM) with Open, Busy and Closed statuses.  The objective is that, when a user select a date , time of event and purchases(add to cart and check out) a food item it should check the entered time is valid between open hours of the caterer whose status is Open. The selected time and date should keep and show in all checkout out operations and orders.

Is it possible with rules or commerce conditions or any other modules

Please help


texts: Upload a JSON from a third party application

texts:
I have a client hosted on Acquia, and they are requesting that we implement functionality to allow another companies 3rd party application to upload a JSON file to an upload directory within their Drupal 7 website, or alternatively POST json data to the Drupal 7 website and we save that as a json file on the Drupal 7 upload directory.

Is this possible with Drupal 7? Services? Post request with ftp credentials?

Note: As clarified in the comments I would much prefer if the third party could create a service which serves the JSON data which we can just consume via feeds. But it doesn't seem like thats an option from their end, they have the ability to send post requests with data. This JSON data will not be converted into nodes, it will simply be consumed by another third party application hosted on a Drupal page which creates the display/layout for the JSON data which should be dynamically updated daily. The JSON data is public, but the request for JSON should be authenticated.


texts:
I am trying to redirect new users after registration depending on values saved in $_SESSION. I use ajax for registration form submission and hook_user_insert fro redirect

function MYMODULE_user_insert(&$edit, $account, $category){
global $user;
if(isset($_SESSION['VAR']) && !$user->uid){
    drupal_goto('path/to/somewhere');

}

Once form is submitted I receive alert AJAX HTTP request terminated abnormally and page html code. What should I change to make redirect working?


texts:
I've got fatal error EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7700 of .\includes\common.inc) when trying to access user/xyz.

I tried to retrieve info about the malformed node at line 7700, where the error message is built, thinks like :

if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
 dpm($info);// or dpm($entity);
 throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
}

dpm($entity) returns an unexpected user object, and $info a huge qty of things.

Could somebody put me on the right way ?

I already read whatever I could find about Missing bundle property errors, but none helped solving.

dpm($entity) returns

uid (String, 2 characters ) 70
name (String, 9 characters ) John
pass (String, 55 characters ) $S$DUwPuOuDPiDL4nRTYXqc7a5uOfMKey7pyhOFUEKka1XM...
mail (String, 30 characters ) john@example.com
theme (String, 0 characters )
signature (String, 0 characters )
signature_format (String, 13 characters ) filtered_html
created (String, 10 characters ) 1396286331
access (String, 10 characters ) 1397146661
login (String, 10 characters ) 1396513460
status (String, 1 characters ) 1
timezone (NULL)
language (String, 2 characters ) fr
picture (NULL)
init (String, 30 characters ) john@example.com
data (Array, 5 elements)
roles (Array, 1 element)
og_user_node (Array, 0 elements)
message_subscribe_email (Array, 1 element)
field_bio (Array, 0 elements)
field_name_first (Array, 1 element)
field_name_last (Array, 1 element)
field_facebook_url (Array, 0 elements)
field_linkedin_url (Array, 0 elements)
field_twitter_url (Array, 0 elements)
user_trusted_contacts (Array, 1 element)
group_group (Array, 1 element)
group_access (Array, 1 element)
metatags (Array, 0 elements)
rdf_mapping (Array, 3 elements)
realname (String, 13 characters ) John Doe
content (Array, 13 elements)
entity_view_prepared (Boolean) TRUE
privatemsg_disabled (Boolean) FALSE


texts: Is there a way of displaying the IP address of a comment in a view?

texts:
I have created a view to help me manage spam. Its main shortcoming that it does not display the IP address the comment came from.

Is there a way to obtain the IP address the comment came from?

When I go through the fields available to add to the view I can't see any field which contains the IP address.


texts: Filter users in views with a mandatory role and another role that is optional

texts:
Suppose I have a Role A and Role B.
As per my requirement The Role A is mandatory for a user and the Role B is a good to have role.
I want to filter out the users in the views. So If a user has only Role A, he should be listed. If the user has both the roles he too should be listed but if the user has Role B only he should be restricted.
Please Suggest.