texts: Field in custom node tpl - Simple issue that this newb can't figure out

texts:
I have been trying to learn the ins and outs of hooks and basic theming in Drupal.

I currently have a template file for one of my content type (node--opportunities.tpl.php). Everything has been going great theming with this except for a field collection that I am now stuck on. I know there are a multiple ways of theming a field collection and this is the worse. But I can't figure it out when the array is perfectly right in front of me.

field_services is the field name. When I dsm($content) on the node you can see it perfectly. So I'm using a foreach to loop through the items, pull them out and load them. Then print their values with my markup. But it will not render. Even when I 'dsm' the final array, it shows me my fields perfectly. But when I try to render them, nothing happens.

Can anyone help me understand what I am doing wrong? I am more interested in why my investigative attempts to print the values of this array are fruitless than I am interested in actually theming the field collection.

    hide($content['field_services']);
    //horizontal radios
    print '
';
      print render($content['field_opportunity_type']);
    print '
';

    //if (!empty($content['field_services'])) {

        print '
';

         foreach ($content['field_services']['#items'] as $entity_uri) {

          $a_field_collection_item = entity_load('field_collection_item',                 $entity_uri);

            foreach ($a_field_collection_item as $a_field_collection_item_object ) {

              dsm($a_field_collection_item_object);

              print render($a_field_collection_item->field_service);
              print render($a_field_collection_item_object->field_service_multiplier);
              print render($a_field_collection_item_object->field_extend_service_total);

              //print render($a_field_collection_item_object->field_service['und'][0]);
              //$...->field_service['und'][0]['entity']->field_unit_price
              //->field_service['und'][0]
            }
        }
        print '
' . "\n";
    //}

I've also tried these as suggested with no luck. Here is also a printscreen of the dpm:

DPM PS http://ecteam.net/Untitled.png

    dpm($a_field_collection_item_object);

    print 'test';
    print $a_field_collection_item->field_service['und'][0];
    print $a_field_collection_item->field_service['und'][0]['entity']->title;
    print $a_field_collection_item->field_service['und'][0]['target_id'];
    print $a_field_collection_item->field_service_multiplier['und'][0]['value'];
    print $a_field_collection_item->field_service_multiplier['und'][0]['value'];
    print $a_field_collection_item->field_extend_service_total['und'][0]['value'];

Note: field_services is the parent field collection, field_service is the individual field that contains the service title that I am trying to render from it.


texts: How do I clear cache using an SQL query?

texts:
After a module update, my site has become unusable, and only shows a php error message.
I tried circumventing the problem with drush cc, but that didn't help.

Also tried with a custom php script but that has issues finding my DRUPAL_ROOT

I just want to clear the cache tables from Drupal 7 directly on the mysql server, but I'm unsure which tables should be cleared for that and especially which I should not clear.

Do I just need to clear all the [SITE-PREFIX_]cache* tables?


texts:
I have an array that I have JSON decoded from a JSON object. Below is my array I am using for select options. The problem is each select options has a option group with a number (0-11). How can I convert this array to one that does not have these numbers in front of it?

Here is my array:

    array(21) { [0]=> array(1) { [198413]=> string(23) "option1" } [1]=> array(1) { [247598]=> string(24) "option2" } [2]=> array(1) { [195666]=> string(17) "option3" } [3]=> array(1) { [195632]=> string(22) "option..." } [4]=> array(1) { [243763]=> string(24) "option..." } [5]=> array(1) { [196600]=> string(13) "option..." } [6]=> array(1) { [196597]=> string(11) "option..." } [7]=> array(1) { [196592]=> string(16) "option..." } [8]=> array(1) { [196549]=> string(17) "option..." } [9]=> array(1) { [251324]=> string(10) "option..." } [10]=> array(1) { [195564]=> string(50) "option..." } }

Here is my code:

      $result = drupal_http_request('https://'.$key.'@'.$company.'.example.com/example.json');
    $feed_array = json_decode($result->data, TRUE);
    $projects = array();
    foreach ($feed_array['todo-lists'] as $project) {
    $projects[] = array(
    $project['id'] => $project['name']
    );
    }


texts:
I use the module pathauto for SEO-friendly path. So in general the user do not see  e.g. mydomain.de/node/8. But if the user type it by himself in the browser address he can see the change to alias in the browser address. How can I achieve that the user get the information "The requested page could not be found." or something else if he type e.g. /node/1, but NOT the information of alias or not existing node?

I tried to find a module. But there is no ready one. And I wondered using a block (see image) is not working. I do not know why, but this would solve my problem.


texts:
I have a content type with several file fields. I have a view listing nodes of that content type. Now I want to add an exposed filters for each file field to let users filter only those nodes which have a file attached to corresponding field (or not have, whatever they choose).

So, I see choice options like this:

Any
Has file attached
No file attached

Is there a module for this? Or my only way is to write a custom Views filter?


texts: How may I schedule when comments can be Opened and Closed?

texts:
I've been tasked to set up a Q&A styled project where we invite an industry leader, subject matter expert (SME) to answer questions for hopeful students in the same field. The individual requesting this project is a fan of reddit's Ask-Me-Anything styled interviews. So, yes, that is a big driver of this project.

We'll have a period of a week where the students can ask questions and two weeks where the SME can respond to those questions. In the fourth week, both can further respond with follow up questions or expanded responses. After that, the conversation will be available as read-only archive with nothing new added. I'm thinking nested comments would be sufficient.

Can I tell Drupal to open and close comments on certain dates, or even use a date field of when comments should be closed?
I'm okay with either using a contributed module (I haven't found one), Rules (I've not used very much), or custom code (My default, but there are people much smarter than me who have probably already done this better).


texts: Views: Only show 3 largest values and their sum per user

texts:
I am creating a scoreboard website for fisherman that shows the sum of their top catches for the day.  A custom content type allows the anglers to upload a photograph, fish type, and fish length numerical value (DONE).  Anglers may upload as many catches per day (DONE) as they want.  I have Views showing me all fish caught (DONE).  I have Views_Calc showing me data about "all fish caught" per day (DONE).

However, I only want to calculate, display, and store in the database the SUM of the X longest fish an angler has caught that day.

So, I'm trying to build:

1) A View ranking anglers by the sum of their, say, 5 longest fish caught per day.

Consider that some anglers may have a tough day fishing and only be able to upload, say, 3 fish per day.  Conversely (and this is the situation I am having trouble rendering) an angler may submit, say, 14 fish caught that day but I only want to display the sum of the 5 longest.

I would like the SUM to be a database entry so it is accessible via Views for other purposes.

The rendering may look like:

RANK   |  ANGLER NAME  |  5 LONGEST FISH
  1    |  John Smith   |   49.75 inches
  2    |  Joe Blow     |   47.25 inches
  3    |  Kevin Jones  |   42.50 inches
  4    |  Dave Craig   |   37.75 inches
...

Any pointers?  Thanks in advance!


texts:
I want to place one or many spoiler in a node, I mean I want to hide specific paragraph in a spoiler.

I used Spoiler module but it didn't work, How can I use spoiler in Drupal 6 ?


texts: Drupal8 site status - "unsupported release" / "not supported" is this deliberate?

texts:
Is this a deliberate message as drupal8 is not yet the latest production release?

The reason for raising this question is that it was unexpected in my opinion to see this. I would not have expected to see messages about unsupported / not supported - after all, Drupal 8 is being very actively developed, so to my mind it IS supported. Maybe it depends on the point of view - i.e. for production, then no, not yet. Please advise, thanks!

(see screenshot below)

Tried searching issue list for drupal 8 on drupal.org a few times but blank screen - perhaps volume of issues and peak time may be causing the results to not be displayed. Haven't raised this as an issue because it may be something I've not done right in the setup.

Wondering if it might be related to this problem (which appears to be just a warning, though):

$ drush up
The external command could not be executed due to an application error.

(Discussed here: Error when updating modules with Drush )

My system setup

Running on a puphpet.com configured VM, Ubuntu 12.04 LTS 64bit
PHP 5.5.12-2+deb.sury.org~precise+1 (cli) (built: May 12 2014 13:46:35)
mysql  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.2
Drush Version   :  7.0-dev

Obtained drupal8 doing the following:

$ git clone --branch 8.x http://git.drupal.org/project/drupal.git drupal8.localvm
Cloning into 'drupal8.localvm'...

and then

$ git pull
Already up-to-date.


texts: How do I create an "About us" page and make it appear in the main menu?

texts:
I have created a custom page page--about.tpl.php.
And want that page to hook it in menu.
I have gone through hook_menu but didn't get my answer.
I also read page template suggestion.

Tell me how I can do that.


texts: How to show a page create with the view module in the administrative overlay?

texts: I've created a view with the view module which is a kind of administative page and i'd like to show that page using the administrative overlay, how can i do that?


texts: How to set variable for all theme templates in Drupal 8?

texts:
I want to set few global variables which I need to be available in all my theme's Twig templates in Drupal 8.

Drupal 7 documentation mentions preprocess function:

  themeName_preprocess
  This one is named after the theme itself. Applies to all hooks.

So I added the function below to my themename.theme file, but the variables aren't set.

function themename_preprocess(&$variables) {
  $theme_path = $variables['base_path'] . $variables['directory'];
  $variables['theme_path'] = $theme_path;
  $variables['images_path'] = $theme_path . "/images/";
  $variables['templates_path'] = $theme_path . "/templates/";
}

When instead of defining themename_preprocess I define themename_preprocess_page (below) the variables are properly defined and available in page.html.twig template. I also tried defining template_preprocess(), but got error PHP Fatal error:  Cannot redeclare template_preprocess() (previously declared in /home/robert/programming/dns-drupal/core/includes/theme.inc:1202).

function themename_preprocess_page(&$variables) {
  $theme_path = $variables['base_path'] . $variables['directory'];
  $variables['theme_path'] = $theme_path;
  $variables['images_path'] = $theme_path . "/images/";
  $variables['templates_path'] = $theme_path . "/templates/";
}

But I want the variables to be available in all templates instead of only page.html.twig. How can I do that?


texts: Want to Install picasa gallery and best is PWI

texts:
I want to use http://code.google.com/p/pwi/   in drupal. it is a jquery library and with my knowledege as far as adding libraries need to code a little. need to use (hook library or add library) don't know which suits, I am not a PHP guy. but Drupal has been fun and want this badly. If little help or pointing will climb up. Tried other picasa modules like picasa node ,Brilliant gallery but none has features like this.

Thanks


texts:
I'm wondering what could be causing my migration to run so slowly.  I'm using dev versions of migrate and d2d as I always have without issue.  There are over 120,000 users and the first 2000-9000 import within a few seconds.

After that it only processes 2  at a time (about every 30 seconds).

d2d code:

  $common_arguments = array(
    'source_connection' => 'legacy',
    'source_version' => 6,
  );

  $arguments = $common_arguments + array(
    'description' => t('Migration of users from Drupal 6'),
    'machine_name' => 'User',
  );

  Migration::registerMigration('DrupalUser6Migration', $arguments['machine_name'], $arguments);

include file:

class User extends DrupalUser6Migration {
  public function __construct(array $arguemnts) {
    parent::__construct($arguemnts);

    $this->addFieldMapping('roles', 'roles')
      ->sourceMigration('Roles');
  }
}

The legacy database the data is coming from is on my local machine on the same SSD the new site is on.  Any ideas on why this is running so slow?  At the rate it's going out it will take over a month to import all of the users...


texts: How to use views to filter specific workflow state in current month

texts:
I have a system that is heavily workflow dependant. I have a content type called 'Profile' with 3 states :

Lead
Prospect
Customer

I would like to know how to create a views contextual filter of all Profiles that changed to the Customer state in a given month i.e. which Profiles Customer this month.
D6 Views 2.x has this option but I cannot find it in D7 Views 3.x

Thanks


texts: Member list with Demographic Data - is there a module or how do I build a View?

texts:
I want to be able to do a Member Directory page that when clicked, displays a sortable view of Users, including First name, Last name, etc.

Is there a module for this or how do I build a View?


texts:
Are there any alternatives to the drupal media module for drupal 7?

Looking for functionality to preview and upload images and set the image style before displaying the image. Or would the media module be the best bet for this type of task?


texts: How to open a new form in a block without reloading whole page?

texts:
I am using Webform with ajax mode. I have added the Webform in block so as only the block is refreshed instead of whole page, it's working fine.

All I want to do is open new form after getting confirmation message without reloading whole page.

How can I do so?


texts: Does the #cache property for render arrays cache content from a query when used in a controller?

texts:
I have a custom page displaying a query result from the database. Before I attempt to cache it myself, I am trying to see if Drupal 8 render arrays support caching in anyway for authenticated users. My use case is a route and a controller on the node entity. Users go to node/id/something that displays a list of entries in a table. I would like to cache this in the controller.

I am using the following code.

public function displayContent(NodeInterface $node) {
  // query the DB to generate content.
   $content['#markup'] = $result_of_db_query;

    $content['#cache'] = [
      'keys' => ['entity_view', 'node', $node->id()],
      'tags' => ['node:' . $node->id()],
      'max-age' => Cache::PERMANENT,
    ];
    return $content;
}

It doesn't work: The database query is executed on every page request.
I am not sure if this is due to the fact this page is an administrative page and users must be authenticated.


texts: how to theme the read more link using fields mode in views,

texts:
In views i have created a block view in where i want to list only the titles of 5 nodes,
using the 'field' setting in views.
Under 'pager' i have set the amount of items accordingly.
I have enabled 'the read more' link in case more nodes show up.

My problem is that when my read more link shows up it is way out of line with the listing.(right side)

With my chrome element inspector i set the aligning of the read more link to left which is acceptable.

How can i accomplish this with in my drupal set up.

Help appreciated.


texts:
I am working on a client's website and need to implement this age gate on it. The problem is it only shows on a specific url/page but not on other pages. Been looking for solutions since past 2 days but couldn't find anything on google about it.

This is what I did:

Added the shown below in html.html.twig and uploaded the relevant css and html. But the age gate popup only shows on www.xyz.com/?AvpClearCookie=1 but not on the www.xyz.com

I was trying to show it on home page but with the very limited knowledge I have about drupal it seeming difficult for me to get it done. Really appreciate if anybody could show me some light on this.


texts: Bulk import images into content image field

texts:
I've created a content type called "Products" wich has the following fields:

code (Product's id)
Title (Product's name)
Description
Image (Product's picture - image field)

I've imported a list of products from a CSV file using Feeds module. So far everything is ok. Except for the pictures.

Then I have a lot of pictures (3000+) that I need to do a bulk import into each product's image field.
The picture's files are named product_code.jpg, e.g.: 001.jpg being the image of the product 001, 002.jpg for the product 002... and so on.

I've searched for modules that could do this kind of import, but have found none.
I took a look at the database and I'm thinking about uploading the files to the server via FTP and alter the tables by hand, since the filenames = product's code.

What's the best method for me to do this kind of import? Is there any module I am missing?

Thanks!


texts: nginx sets content-type text/html on redirect

texts:
I set up nginx as a reverse proxy for Drupal. Static files are served from a different domain. It works well, imagecache files are generated well, too. But the problem is: when the derivated image does not exist, the request for this image returns a redirect with the content-type:text/html, and Facebook or jQueryMobile (only when running in an iPhone, not in desktop browser) does not like it.

The context: when a file is requested from mycdn.com, if it does not exist, it is redirect to mysite.com which is a site that does the reverse proxy. So, it can be seen that imagecache does nothing here, just a use case. The question here: why nginx adds a text/html when it does a redirect?

Here is  the scenario:

GET http://mycdn.com/sites/default/files/imagecache/gallery/myfile.jpg

Server  nginx
Date    Tue, 26 Jul 2011 05:28:09 GMT
Content-Type    text/html
Content-Length  154
Connection  keep-alive
Location    http://mysite.com/sites/default/files/imagecache/gallery/myfile.jpg
Expires Thu, 25 Aug 2011 05:28:09 GMT
Cache-Control   max-age=2592000

then the result of the redirect

GET http://mysite.com/sites/default/files/imagecache/gallery/myfile.jpg
Server  nginx
Date    Tue, 26 Jul 2011 05:28:10 GMT
Content-Type    image/jpeg
Connection  keep-alive
X-Powered-By    PHP/5.2.17
Expires Tue, 09 Aug 2011 05:28:10 GMT
Cache-Control   max-age=1209600, private, must-revalidate
Etag    "58a657c2ee47424f202387000c191b7e"
Set-Cookie  DRUPAL_UID=64; expires=Thu, 18-Aug-2011 09:01:29 GMT; path=/; domain=.thongtincongnghe.com
Vary    Cookie,Accept-Encoding,User-Agent
Last-Modified   Tue, 26 Jul 2011 05:28:10 GMT
Content-Encoding    gzip
Content-Length  1400

nginx configuration on mycdn.com (I removed unrelated info):

server {
    listen       80;
    server_name mycdn.com;
    root   /home/ttcn/public_html;
    expires 30d;

    location / {
        try_files $uri @redirect;
    }

    location @redirect {
        rewrite ^(.*)$ http://mysite.com$1;
    }
}

Brief, with a desktop browser, there is no difference. Everything works flawlessly. But jQueryMobile on a mobile does not work (until the derivated image is generated, through a desktop browsing), Facebook OpenGraph does not work (I put the derivated image url in the og:image value) - it does not take that image until it exists on the server.


texts: how to theme images uploaded with multi-value field?

texts:
I have a multi-value image field. Now I want to theme it based on the number of the uploaded images.

if there is one image {
//theme here
}
if there is 2 image {
//theme here
}

And so on. I'm trying to do it in field--field_project_image.tpl.php file. I can use

foreach($items as $values => $item) {
  print '
'.render($item) . '
';
}

but I think i need to use if statement and then be able to style each picture differently.


texts: How to output the label of a field in a template?

texts:
I am overriding the node template for a custom content type, say node-custom.tpl.php.
The content type have some fields that I want to show in columns like this :

|Label1|Data1|
|Label2|Data2|
|Label3|Data3|
|Label4|Data4|

If I use render($content['field_custom_data']) both the data and the label are drawn.
I know how to hide the label from the render using the content type display configuration but I need a solution for the label.
The site is multilanguage if that matters.


texts:
Recently implemented Omega/ST Alphorn and was hoping for a real responsive/adaptive result. Overall it works as expected, apart from the inline images in articles. (IMCE/WYSIWYG)

Done some searching, done some reading and found that inline images apparently are still a big challenge. It´s either js, cs, php or a combination of those.

Leaves me with two questions:

Is there a way to get a true responsive site without first learning php, css, js and then potentially mess up a perfectly working layout?
Is it really that hard to make inline images behave well in a responsive grid? I mean...  images in websites are not exactly a new phenomena, right?

Cheers

Oh, one more thing... Maybe someone with +300 reputation can create a tag `inline_images´ ... the fact that it does not even exist, worries me a bit.


texts:
I have a view where each page is a contract.  My client wants a button on the page that says "Send me more information." The button will send two emails, one to the customer saying "We'll get back to you" and one to my client.  My client's email needs to contain several fields from the view. (User email and name and node title at least.)

I've looked at various ways to do this, and none are quite right.

Views Send opens a message form.  I want the customer to do nothing more than click the button.
Webform would be good but I don't know how to pass the data from the view into a hidden field on the form.
Rules would work but I can't figure out what the event would be to trigger sending the emails.

I am an experienced site builder but really know zip about PHP, so I can't make a custom module.

Does anyone have any good ideas for what seems like a simple thing to do? Am I missing something obvious?


texts: How to add drupal contributed modules into a custom module

texts:
I've done a custom module to generate some forms. There is a image field present. I would like to add cropping functionality in image field.

I've seen that is very interesting the Imagefield Crop module. I would like to use it in my code.

So, my question is: Is there any way to add this module functionality into my image field?

Edit 1:

This is my code:

$form['imagen'] = array(
        '#title' => t('Image'),
        '#type' => 'managed_file',
        '#upload_validators' => array('file_validate_extensions' => array('jpeg jpg png gif')),
        '#upload_location' => 'public://',
        '#progress_indicator' => 'throbber',
        '#status' => FILE_STATUS_PERMANENT,
        '#progress_message' => 'One moment while we save your file...',
    );

It is necessary for our company to generate the forms in a custom module, because we need to process data in a special way, that with drupal content type is not possible.

So, I feel totally lost. It is posible to do something like a reference or something similar to use image_crop??

Thank you in advanced.


texts:
Use case:  When the Status is Overdue, the word overdue should display in red, and if it's Accepted, it should display as green.

I was hoping to use Rules to set this up, but don't see options to get this logic in.


texts: Get out of maintenance mode using database query (without using drush or admin area)

texts:
I understand there are very many stackoverflow questions on this very topic.

How can get my site out of maintenance mode? for example.

However I've never seen one that explains how to turn off maintenance mode using only a database query. I run a complex site that does not allow you to login directly using /user since it's using a special sso. So there are times when I do not have access to the admin area and I do not have access to the user login either. I don't always have ssh access to run drush, but I do usually have direct access to the mysql database.

I did find an entry in the config table that seems related.

The name is system.maintenance and the data is

a:3:{s:7:"message";s:93:"@site is currently under maintenance. We should be back shortly. Thank you for your patience.";s:8:"langcode";s:2:"en";s:5:"_core";a:1:{s:19:"default_config_hash";s:43:"Z5MXifrF77GEAgx0GQ6iWT8wStjFuY8BD9OruofWTJ8";}}

I see where it shows the message, langcode and hash settings but I do not see where it defines whether it's on or off.

Is there a location in the database that would allow me to turn maintenance mode on and off directly?


texts: Drush upwd Changes Database Hash but Login Fails

texts:
I have a weird one. I have a site that was abandoned for a while and we need to get access to it again. So I tried to use drush to reset the admin password, but it's not working.

I'm using Drush 8.1.17 on what I presume is a Drupal 7.57 site (because of the CHANGELOG.txt file in the docroot).

Syntax for my command is like:
php drush.phar upwd fakeadmin --password="examplepassword123"

I get a message Changed password for fakeadmin success and because I'm literally looking at the users table in my database I can see the hash change in the password field. Yet, when I copy the text 'examplepassword123' (without single quotes) into my login page, it does nothing.

Am I just messing up the Drush 8 syntax? (I'm already more used to Drush 9). What would cause it to not work?

EDIT: Drush just uses whatever DB credentials are in the standard sites/default/settings.php file correct? So if that's correct, then I should be working with the right database. No?

EDIT 2:

1) I tried it without the double quote just in case and that didn't work either.

2) I also tried running the script /scripts/password-hash.sh "examplepassword123" and copied the resulting hash into my database, and nothing happened. (found reading through this: https://www.drupal.org/node/992400)

3) I would almost say I'm using the wrong database at this point except that with another drush command I was able to see it add a new user_role row in an attempt to make another user we have access to an admin. Ideas?

EDIT: Well this was disappointing and weird. Drush was somehow changing the hash but not the password? An employee of ghosts past somehow had it saved on their hard drive, and gave me the password, and it was the same as before. I'm not going to question it....


texts:
I want to override theme menu link items in my theme.
I know that I must use theme_menu_link(array $variables) theme function.

But I want to know, is there any way that I can change the output render of theme_menu_link function based on region.

for example if menu link item is located in header region, it must be wrapped in div tag and if menu link item is located in footer region, it must be wrapped in li tag.


texts: using contextual filters to filter with relationship

texts:
I have articles and issue nodes, where every article is related to an issue. I am trying to create a Views block which shows related Articles. This block should show on on the Article node page.
What I tried was this:

I created a view of Articles. I set the relationship to Entity Reference: Referenced Entity field_article_issue and created a contextual filter on field_article_issue_number (a field in issues) using that relationship. This didn't work, and the block shows nothing. What am I doing wrong?


texts: How to add a prefix - suffix to a node title from a module

texts: I loaded a renderable array within a hook_block_view.  I need to add a prefix and suffix to the title before rendering it. How can I manage to do that ?


texts: Listing two different custom entity types in one view

texts: We defined two entity types, questions and answers. They are related to each other but we will need a view listing all questions and answers in order of title or created date for example. When you build a view you have to choose one entity type which will be listed in a row maybe including the data from referenced entities but you do not get a view listing the base entity and the referenced entities each in a seperate row. Additionally the view we need should not depend on this reference - each entity should be filtered and sorted individually. I think I need someting like UNION in SQL?! Is there a way to achieve this with core Views module?


texts: theme_hook process: calling a theme function not working(example from DGD7)

texts:
I'm just working through an example module in DGD7. The module reports statistics about the themes. It displays this information in the help region on the appearance admin page.

I can't get it to display and I'm wondering if I understand the theming process correctly.

My understanding is this:

I call my function. (with a function)
My function returns data.
I tell drupal about my theme function with hook_theme
My theme function then turns my data into HTML.

Here's the module:

It uses a switch to call the function based on the path:

function xray_help($path, $arg) {
 switch ($path) {
  case 'admin/appearance':
   return xray_appearance_summary();
 }
}

Then this function calls data from a stats function which returns a compact. (the stats function works - tested with dpm())

function xray_appearance_summary() {
  $data = array();
  $data['themes'] = xray_stats_enabled_themes();
  return $data;
}

They give a theme function (I'll put it last because it's quite long) but don't show how to call it with hook_theme. I tried using this hook_theme to call the theme function:

function xray_theme() {
  return array(
    'appearance_summary' => array(
      'variables' => array(
        'themes' => NULL,
        'attr' => NULL,
      ),
    ),
  );
}

The theme function takes two variables $themes & $attr so I put both of those in. But I get the error.

Notice: Array to string conversion in menu_get_active_help() (line 1722 of C:\XAMPP\htdocs\drupal\includes\menu.inc).

Am I misunderstanding hook_theme?

function theme_xray_appearance_summary($variables) {
  $themes = $variables['data']['themes'];
  // Collapse attributes for paragraph tag to a string.
  $attr = drupal_attributes($variables['attributes']);

$output = '';
  $output .= "<p $attr>";
  $output .= t('This site');
  $output .= ' ';
  $output .= format_plural(
    $themes['num_themes'] - $themes['num_hidden'],
    'has only one theme available',
    'has @count themes available'
  );
  $output .= ' ';
  $output .= format_plural(
    $themes['num_hidden'],
    'plus one hidden theme.',
    'plus @count hidden themes.'
  );
  $output .= ' ';
  $output .= t('Of the non-hidden themes,');
  $output .= ' ';
  $output .= format_plural(
    $themes['num_enabled'],
    'one is enabled.  The enabled theme',
    '@count are enabled.  In the enabled themes,'
  );
  $output .= ' ';
  $summaries = array();
  foreach ($themes['summaries'] as $name => $info) {
    $summary = '';
    $summary .= $name . ' ';
    $summary .= format_plural(
      $info['regions'],
      'has one region',
      'has @count regions'
    );
    if ($info['overlay_regions'] || $info['regions_hidden']) {
      $summary .= ' ' . t('(including') . ' ';
      $summary .= format_plural(
        $info['overlay_regions'],
        'one overlay region',
        '@count overlay regions'
      );
      $summary .= ' ' . t('and') . ' ';
      $summary .= format_plural(
        $info['regions_hidden'],
        'one hidden region',
        '@count hidden regions'
      );
      $summary .= ')';
    }
    $summaries[] = $summary;
  }
  $output .= xray_oxford_comma_list($summaries);
  $output .= '.';
  $output .= '</p>';
  return $output;
}

EDIT ONE.

I've got rid of the error by changing the switch; thanks to Yuriy, but nothing still displays:

 case 'admin/appearance':
      $variables = array('data' => xray_appearance_summary());
      return theme('xray_appearance_summary', $variables);


texts:
Does drupal_get_path_alias only work if you are requesting a page, or can it also work if you are requesting a form? For example:

drupal_get_path_alias(node/1);

works fine, but the below doesn't

drupal_get_path_alias(node/1/edit);

so the user sees a mixture of aliased and normal paths. Could I have:

content/todays-news

and

content/todays-news/edit

Thanks


texts:
I'm making my first drupal website and I want to have a image slider on the homepage. I would like there to be a page in the backend where the end-user can upload and choose which images are in the slideshow. I looked at the nivo-slider module but it only allows the creation of one slider and what I really need are two separate sliders one for English and one for French content.

Is there a module that has this functionality already? If I wanted to create something like this myself would that involve making a module or can it be part of my theme's code somehow?


texts:
I'm building a D7 site using domain access. What I need now is to make a nodes list for each domain. The list would make use of the Facet API. And the list would only display the nodes on that specific domain.

I used to think adding a NODE INDEX view page, with "avaliable on current domain" filter would do the trick. But then I found there is no "avaliable on current domain" when views is selecting Node Indexes from the database !

What sould be done to restrict the results to current domain?

FYI, the site is using database search, not apache solr


texts: Javascript works inline in webform but not as standalone

texts:
I have a javascript that works if I place it in a mark up in my webform but breaks the form if I make the form a multipage. If I place the script as it's own file and then call it using drupal_add_js(path_to_theme() .'/scripts/SCRIPT_NAME.js'); in my webform-form-NID.tpl.php nothing hapens.

Here is my script in my markup:

$(document).ready(function(){
    var ac_config = {
        source: "/example/sites/all/themes/skeletontheme/js/democities.php",
        select: function(event, ui){
            $("#edit-submitted-info-company").val(ui.item.company);
                        $("#edit-submitted-info-address").val(ui.item.address);
                        $("#edit-submitted-info-address2").val(ui.item.address2);
                        $("#edit-submitted-info-city").val(ui.item.city);
            $("#edit-submitted-info-state").val(ui.item.state);
            $("#edit-submitted-info-zip").val(ui.item.zip);
        },
        minLength:1
    };
    $("#edit-submitted-info-company").autocomplete(ac_config);
});

In the stand alone .js file:

(function($){
    var ac_config = {
        source: "/example/sites/all/themes/skeletontheme/js/democities.php",
        select: function(event, ui){
            $("#edit-submitted-info-company").val(ui.item.company);
                        $("#edit-submitted-info-address").val(ui.item.address);
                        $("#edit-submitted-info-address2").val(ui.item.address2);
                        $("#edit-submitted-info-city").val(ui.item.city);
            $("#edit-submitted-info-state").val(ui.item.state);
            $("#edit-submitted-info-zip").val(ui.item.zip);
        },
        minLength:1
    };
    $("#edit-submitted-info-company").autocomplete(ac_config);
});

First question is why does the script not work if I add page breaks to my webform.

Second question - why won't the script work the way I have it formatted as it's own .js file.

Thanks for any assistance.


texts: Basic Drupal site architecture based on taxonomy

texts:
I come from a custom web dev background but I'm working on some Drupal projects now. I am confused about the best method to set up basic site architecture. What I want is for taxonomy terms or variables to drive display of content throughout the different areas of the site. I gather I should be using taxonomies as these variables...If I am wrong please let me know

So say I have one taxonomy (BRANDS) with two terms:

BMW
AUDI

I also have three content types:

Article (can belong to multiple brands)
Video (can belong to multiple brands)
Model (only single brand)

I want to create 3 types of pages (I think what I should be doing is using views) BUT - I should only need to use ONE view per page type:

Index Page (which accepts taxonomy term and displays all videos articles and models associated with the term - this is not an individual node page) (url should be something like /BRAND eg: /BMW)

Model Page (which shows the model node - and also content [videos and articles] associated with the BRAND taxonomy term) (url should be like /BRAND/Modelnode eg: /BMW/3-Series)

Article Page (which shows an article node - and also videos and models associated with one or more BRAND taxonomy terms associated with that article)(url should look like either BRANDS/Articlenode - eg: BMW-AUDI/Articlenode or just /article/Articlenode if the taxonomy does not need to be coming from the url to feed into views or whatever generates the page content)

If i was doing a custom PHP driven website, this would be easy to do, but it's confusing as hell in Drupal. What is the standard and best practice way to go about creating each of these page types - and if it is created using views - only use one view per page type [ ie the view will accept url or internal taxonomy arguments to dynamically show content]?


texts: What is the fastest way to convert a large volume of documents (.html) to drupal nodes

texts:
How would you go about creating a large number of nodes from a large number of html documents?

I am trying to create something similar to a book and have a lot of .docx files on my computer. I am aware I should use a wysiwyg editor to clean up the formatting and make it look like I want saving it as HTML.
However there is the issue of getting all the .html files uploaded as nodes without having to copy-paste 200+ times.

Any ideas?


texts:
I have a problem when I make a search with the common search bar, when the user is logged. The result url is http://search/node/%item instead of http://example.com/search/node/%item.

I hope someone can help me, sorry for my english.

Thanks.


texts: What replaced the ContentFormControllerSubscriber class?

texts:
In the past, there was a ContentFormControllerSubscriber class in Drupal, but there is no track of it anymore; the change records don't report anything about that class too.

The reason I am looking for that class replacement is that I noticed the Chaos tools module using a similar class to alter the requests passed to Drupal, and I was wondering if the priority (29) used in the getSubscribedEvents() method of those classes is still sufficient to alter the request before it is too late, and not doing it too early.
I guess the Chaos tools module used that value because it was used from Drupal core too; I am assuming there was a good reason to do so.


texts: Adding RewriteCode in https does not work for links other than base url

texts:
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.example\.com*
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

With this I swap from http:// to https://www in one single redirect step.

Unfortunately this does not work for sub-pages. So http://example.com/categorypage will get redirected to https://example.com.

How do I fix it? What should be added in .htaccess to fix the redirection from http to https for sub-pages?


texts: Views Filter by Field value (content type A) = Field value (content type B)

texts:
I am getting exhausted trying to filter views by matching 2 fileds value from 2 different content types.

For Example:

Content Type (Employee A), with the following fields:

ID (integer)
Name
phone Number
Address

Content Type (Employee B), with the following fields:

ID (integer)
Position
Skills
Salary

What I need to do is a View that show

ID, Name, phone Number, Address, Position, Skills, Salary ... By comparing ID integer value from (Employee A) = ID integer value from (Employee B)

Please help me doing this.


texts:
This code I use when checking if user has a role

if (in_array('administrator', array_values($user->roles)))

How to check for multiple roles? I tried something like this

if (!in_array('administrator', 'operator',  array_values($user->roles))

I made it work like this

if (in_array('administrator', array_values($user->roles)) && in_array('operator', array_values($user->roles)))

but there must be some less code solution.
but it is not working. Thank you.


texts: Avoid duplicates on a view based on results from another view

texts:
I have a node type and two views:

One displaying the last 3 elements with a field marked as «important».
Another with 3 random elements, marked as important or not.

I don't want the views to repeat nodes.

Since the "lasts" views should always display the last 3 important elements, I thought about filtering the nodes on the random view, but I don't know how.

I managed to do it for a single node in another context. When viewing a node, choosing «Provide default value» with some PHP code combined with the option «Exclude», I can manage to hide that node from the views.

$node = menu_get_object();

if (isset($node->nid)) {
   return $node->nid;
}
else{
  return 0;
}

Suppose I can get the nodes shown on the "lasts" views programatically. Then what? This approach will only work to filter out a single node, not the three I'll get from that view.

Any ideas?


texts:
I bound an action to my flag to display a message on flagging. However because I am using AJAX flags the message is only displayed after I refresh the page.

Is there any way to make the message appear after the flag is flagged and not on page reload?

Thanks


texts:
I'm trying to figure out the best way to create a product on Commerce 2.x.

What we have is physical products that don't have variation, so basically each product is a stand-alone.
What would be the best practice for creating a product?

Currently, I created (in this order):

Product Variation type (with fields that represent product properties)
Product type (where I select the variation type)

I didn't create any attributes though.

Would this be the right way of doing it?

Also for my second question, I created a Product list page with Views and selected Table view. However, I can't find "add to cart" field nowhere.


texts: Newbie question : where to put "advanced" page content?

texts:
It's been almost 3 years that I'm a web developer and I just started with Drupal 8. I have to say that's I'm feeling really confused by all the things in the Drupal worlds that you have to understand in order to create a website.

Here is the thing, I'm supposed to create a little website (3 pages for now) with a 100% custom appearance. I started by creating a new Drupal 8 theme with its libraries and dependencies and started coding the website's layout in twig. I added a few blocks in the theme's configuration (and in the twig) like a header block, two highlights blocks, a main content block and so on.

I'm at the point where I finished the layout and I'm supposed to add content of the 3 pages :

A main page containing text, images, a thumbnail of the last posted photos album, and an overview of the two last posted articles.
A form who's supposed to store the data somewhere (in the database I guess).
A second form who's supposed to do quite the same.

My questions are :

Since I have a very specific content for my three pages with HTML/CSS and Javascript, where am I supposed to put it ? Simply in 3 separated "Basic page" in the "Content" section of Drupal ? It seems way too simple. The "Basic page" content isn't supposed to be only text/images ?
I'm using a "naked" Drupal. In order to create the forms and other special stuffs, I'm supposed to use modules, right ? Are there any that are mandatory ?

Thank you all in advance, and please excuse my English, it isn't my mother tongue.


texts: How to fix special characters in node titles?

texts:
When I imported content from my legacy system using the migrate module some special characters didn't get imported correctly.

For example the " character got changed to &#34;  and is showing as such in the node title.
Is there an easy option fix that when displaying or do I have to replace it at the database level?


texts: radios options separated into different wrappers

texts:
I'm trying to customize a radios field to wrap some of the options into a div.

What the best way to do it?

I had a look to theme_radio but no success on it :(
example:

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

    <input id="edit-SOME_ID" class="form-radio" type="radio" value="SOME_VALUE" name="SOME_NAME" />
    MY LABEL

ANSWER:

See Djouuuuh answers +

$output .= drupal_render($element['element'][$i]);

if you do this one below it won't work with ajax...

$output .= theme('radio', $element['element'][$i]);


texts:
I want to use the Support Ticketing System module to create a 'help desk' for my site. However, I'm not really sure I understand the 'client' system. All I really need is for the user to be able to submit a support ticket to a department, like 'Pre-Sales' or 'Bug Report', and for a member of staff to be able to respond to their issue. I'm just wondering if the support ticket module is 'overkill' and I could code something more simple?

Or, should I just add each department as a client and let users pick which department they'd like that way?

I was using osTicket and was content with it, however I need a user-login system and all the details are already on the drupal site.


texts: Cannot print $variables using template_preprocess_views_view_rss() in readable format

texts: How can I print out $variables from template_preprocess_views_view_rss() in a readable format?  The RSS view page uses a non-rendering format and is impossible to read. I need to manipulate the feed because no D8 RSS module is stable at this point.


texts: How to set number of articles per page on the Blog module?

texts:
I came across a 6.15 drupal site that I had to modify one simple thing:
put instead of 3 articles per page , 5
on the front page the blog resume is shown, and it seem that the blog module doesn't have any setting to do that..
It isn't made with views, nor is it a block.. I don't even know how they get to the front page (probably by being promoted..)

here a snapshot of what I see on the front page...

how can I set the number of articles?
I can't find it anywhere...
I was thinking of defining a view or something and renounce of this built-in functionality...


texts: Workbench Moderation - Admin Preview - Show Current Revision in Front-End

texts:
Can someone please help me on the following use case related to workbench module showing current revision but in the front-end.

What I need:

When we hit the preview button on edit content type (editorial) form, I need a LIVE PREVIEW, to show the current version edited, using my front-end theme I've, to show the article details. I don't want the default preview of Drupal.


texts: Approach to create headless drupal with login

texts:
I am curious on the approach I will have to take if I would like to build an app that connects to Drupal. I have already built simple headless drupal app using only get requests.

I am able also to make posts requests with Basic Auth or Auth0 mainly via postman and the concept of this is clear.

What is not clear to me is how I will be able to manage a logged in user from let's say a React/Vue.js app.

Let's say we have an app that servers 2 types of content: News and Events.
News is public and Events is for logged in users.
News and Events will be two Rest Export views in Drupal and Events will have an authentication method.

Now if a user wants to see Events he/she must be logged in. So the user will login via a login form and the session should be persisted. The app sends the request to Drupal, logs the user in and give a cookie/token/jwt back? So I will be able to use that cookie/token/jwt to access events and events/nid?

What should I use in this case in order to persist a login?

Thanks in advance.


texts:
I've just installed Panopoly 1.14 and I can't add views to my panels.

I create the view block normally without any problem; I can see the view, inside the block section, but when I try to create or edit the panel, I can't see views at all in the left side of the add-content screen where it should be.

I checked the permissions and I have all the administrative ones. What am I missing?


texts: Add css class to the container of the action button from a Form

texts:
I have a contact form in a Block, using the contact_block module, now I want to add some bootstrap classes to the div container of the actions buttons (send message).

At the end of the form it I got this wrapper:

<button class="btn btn-primary btn-xl text-uppercase button button--primary js-form-submit form-submit btn-primary btn" data-drupal-selector="edit-submit" type="submit" id="edit-submit" name="op" value="Send message">Send message</button>

I want to affect the div id="edit-actions".

According to twig debug, I should do a hook of the container, but I don't know how to specify that I want to affect that div.

Inside the themes/bootstrap/templates/system/container.html.twig is the structure of the containers, so I can add some classes there, but I don't know how to specify which container I want to affect. I had tried to change the name to container--contact_message_feedback_form.html.twig, but it doesnt work.

{%
  set classes = [
    not attributes.hasClass('toolbar-menu-administration') ? 'form-group',
    has_parent ? 'js-form-wrapper',
    has_parent ? 'form-wrapper',
  ]
%}

{{ children }}

Extra info:
Drupal 8.4

Subtheme bootstrap

I have already a hook_form_alter() to remove the preview button.

function twig_block_form_alter(&$form, $form_state, $form_id) {

  if (strpos($form_id, 'contact_message_feedback_form') !== FALSE) {
    $form['actions']['preview']['#access'] = FALSE;
    $form['actions']['submit']['#attributes']['class'][] = 'btn btn-primary btn-xl text-uppercase';
    // Adding prefix and suffix to the form.
    $form['elements']['edit-actions']['#prefix'] = '
';
    $form['elements']['edit-actions']['#suffix'] = '
';

  }
}


texts: I want to display 10 contents of same content type as links in a single view. Is it possible? How?


texts:
I have а custom module that will show some reports. It will have two textfields, so when a user clicks one of the fields "starting date" and "end date" a calendar will popup and will able to select the dates. After selecting the dates, it will show the table with the results.

I've been using "Date" module with content type/fields, but I've never done in a custom module.

If these are the two fields:

<?php

$content['starting_date'] = array(
     '#type' => 'textfield',
     '#title' => 'Starting date',
);

$content['end_date'] = array(
     '#type' => 'textfield',
     '#title' => 'End date',
);

?>

How can I show the popup calendar when a user clicks on some of the textfields and show the results?

I'm using Drupal 7.

EDIT: I'm marking Clive's answer, but the date_popup works only on forms, not custom fields.


texts: How to hide a views result item based on role?

texts:
I have a View based on taxonomy vocabularies and terms. The view only contains 2 fields, taxonomy vocabulary and taxonomy term and the output is HTML list.

How can I hide one of the terms in one of the vocabs in the view result based on the role of the logged in user?

UPDATE:
With the help from No Sssweat below, this is how the final snippet looks like:

function mytheme_preprocess_views_view_fields($vars){
  global $user;
  if ($vars['view']->name == "view name" && strip_tags($vars['fields']{rendered_entity}->raw) == tid && in_array('user role', array_values($user->roles))){
    $vars['fields']{rendered_entity}->content = NULL;
  }
}

... in case anyone else need something like this snippet.


texts: Return inserted serial from drupal_write_record

texts:
I have a module which creates records in the db via drupal_write_record and this works perfectly. However I need to get the automatically assigned serial number for each record which is written into a variable.

Does anyone know how I can achieve this and get the index #?

I need the index variable to use in another table to create the reference...

Edit: Clives answer worked as below:

// Create object
$call = new stdClass;
$call->uid = $user->uid;
$call->call_type = $call_type;
$call->cli = $cli;
$call->start_nid = NULL;
$call->timestamp = $timestamp;

// Insert call row in db
drupal_write_record($table,$call);

// Test correct index
drupal_set_message($call->call_id);


texts: How to edit the People (users admin view) to include filter by user name?

texts: I want my admins to be able to search through the admin users view by the user name. I have a site with a lot of users and periodically the admins want to be able to check on various user fields. Is there a way to do this?


texts: Webform many dropdownlist results saved under one unique field

texts:
I'm working with webform to collect information on car relliabilty level.

I've set one dropdownlist to allow user choosing a car brand. As a car brand is selected, only the coresponding dropdownlist, with car models, is showing up (done with Webform Conditional).

All is working fine, but I realize each model dropdownlist is saving data in its own field in the database.

I want to analyse results by car brand and car models.
What would be the best way to proceed?

Saving all models in one fields, when data are submitted? Maybe with a hook
Merging all car models after data submission in one unique field?

My test: http://fiabilidad-coche.blg.lt/?q=node/10

Any help or hint would be greatly appreciated.


texts: Trying to customize default markup for exposed filter

texts: Would it be possible customize the markup of an exposed filter? Currently I'm displaying the exposed filter for a view using a block. My complaint is the bloated markup Drupal generates.


texts: Default value to 'datetime' field in form loaded from the database

texts:
I want to display the datetime field on my Drupal 8 form with some date loaded from the database, but the front end always shows empty fields as if no data has been provided. I tried several combinations to default_value field, but none of them are showing any thing.

The code I am using is the following.

$form['dateopening'] = array(
  '#type' => 'datetime',
  '#title' => t('Opening Date'),
  '#default_value'=> date('Y-m-d H:i:s', strtotime($dateFromDB)),
);

Why doesn't it set the default value as expected?


texts: Using webform rules to create node after webform submission

texts:
First of all, let me explain my project. I want users to place orders of products using webforms and then create a node with a link/reference to the submission and others custom fields.

It looks like this :

CONTENT TYPE PRODUCT :
- Field name / Field image / Field category / Field description

Webform is enabled for PRODUCT content type. So I've created products examples and each of these products have their own CUSTOM webform (all the forms are differents)

For example :

PRODUCT A (product content type)
- fields values + custom webform fields

So what I want this kind of node beeing created after webform submission :

CONTENT TYPE ORDER NODE :
- webform sid reference (linking to the submission results)
- Some fields which will be the same for every product

Do you think is possible with a custom module or should I find another way to achieve this ? (I suppose replacing webform by a content type, but the problem is webform, in my case, is very usefull)

I have to point out that I'm a beginner in Drupal module's developpment.

Thank you ;-)


texts: Automatically group the sub menu items in drupal 7

texts:
My website contains project for following categories-

C language
Java language
Shell script

I have a custom content type "project", which has these fields as radio button. I have a menu item in main menu called project, which has above three categories as sub menu item. I want whenever I add any "C language" project, it should automatically attach as a sub menu item of "C language".

How to achieve it?


texts: Hook to trigger when a field collection item is being deleted

texts:
I have create a module and I am using the following hook implementation.

The code works on success, but how do I prevent or stop further processing when I get failed as status?

mymodulename_field_collection_item_delete($field_collection_item) {
   $itemID = entity_id('field_collection_item', $field_collection_item);
   $fc = entity_load_single('field_collection_item', $itemID );
   $pid = $fc->field_product_guid['und'][0]['value'];
   $responseAPI = json_decode(deleteProductRequestAPI($pid,"DELETE"), true);
   if($responseAPI['status']=='success'){
     drupal_set_message(t('Is successfully deleted.'));
   }else{
     drupal_set_message(t('Failed to deleted.'));
   }
   die;
}
// here curl request sending
functin deleteProductRequestAPI($pid,$method){
  // here i have written code for send request and will
  // get response in status as "success" or "failed".
}

The field Collection name is Products and the content type is Brands.


texts: Views 'uses AJAX' with exposed filter prevents modal opening

texts:
I have a views page which displays rows of teasers. Clicking on the H4 title opens a Foundation reveal modal. Here is the views template:

<img src="<?php print $fields['field_image']->content; ?>" />

        <h4 data-open="<?php print 'modal' . $fields['nid']->raw; ?>"><?php print $fields['title']->raw; ?>

<?php print $fields['body_1']->content; ?>

<div class="reveal" id="<?php print 'modal' . $fields['nid']->raw; ?>" data-reveal>

<img src="<?php print $fields['field_image']->content; ?>" />

<?php print $fields['title']->raw; ?>

<?php print $fields['body']->content; ?>

<button class="close-button" data-close aria-label="Close modal" type="button">
    &times;
</button>

The title field (Content: Title) is linked to the original piece of content, and is printed $fields['title']->raw instead of $fields['title']->content as I want the Foundation reveal modal to appear, not the page node.

I've added an exposed filter (Content: Has taxonomy term - Select terms from vocabulary Tags) with 'Use AJAX' (found under 'Other' in the Page Display details of the view). Once the category has been selected it's autosubmitted and the teasers which have been tagged accordingly are displayed.

All good so far, however, I can no longer open the Foundation reveal modal by clicking on the H4 title link.  Is there any way of resolving this?

I'm using views 7.x-3.20

Update
Before clicking on the Exposed filter dropdown, the modal opens when you click on the h4 link. It toggles the display from 'none' to 'block':

Before clicking the link:

After clicking the link:

However after clicking on the Exposed filter dropdown and selecting a category there is no style element:


texts: Using wget to get the latest module version

texts:
I was contemplating building a quick bash script to wget all of the modules I use on Drupal sites but every time the module version changes, the link changes.

Take for example the views module. At the time of writing it's at version 7.x-3.0-rc3 and therefore the link is as such http://ftp.drupal.org/files/projects/views-7.x-3.0-rc3.tar.gz

If I were to add this to my bash script it'd obviously stop working as soon as the next version is released.

Is there a URL which I can use with wget which will always give me the latest non dev version of a Drupal module.

[...]drupal.org/projects/views-7.x-stable.tar.gz for example

I don't want to use GIT or CVS etc as this will mean anyone using the script will need to install said program first. I would just like to be able to pass this script around to developers in my office to quickly download and deploy the latest Drupal version and modules we use constantly.


texts:
I need to override the block configuration form in Drupal 8.

To override the configuration form for a new block we are creating can be done by implementing BlockBase::buildConfigurationForm method.

But I need to alter the configuration form for all the blocks which means overriding the BlockBase class. How can I implement this?

Is there a generic way to override all Drupal Core classes?


texts: Drupal 7: Webform: Send Email Custom PHP on Webform submit

texts:
0 down vote favorite

I have a webform and I want to send an email to a user on submit action on this webform.

Note: I do not want to use the inbuild emails module for webform as it has some limitations related to the functionality that i want to achieve. Hence I want to send a test email on Submit action via a custom PHP.

I know how to write PHP for a webform but I need some guidance on how to use it for sending emails.

Also I want to send emails on submit action only if user selects a select option on this form.

How can I do this? Please help I am stuck on this for a long time now.

I tried using Rules module but I can not check the webform field values in rules.


texts: Display custom field content in node.tpl

texts:
i've a custom filefield in a custom content type and i use to display it in a node.tpl .But here my filefield has no limit number and under D6 i use this code :

    foreach($node->field_objectif_bts as $file) {
  if ($file['view']) {
      $header = array('data' => 'Les objectifs des formations BTS');
      $rows[] = array($file['view']);
      $attributes = array('id'=> 'objectif-bts','sticky' => FALSE);
    }
}

$output = theme('table', $header,$rows, $attributes);
print $output;

In Drupal 7 it doesn't work, so I'm looking for modifications to do on this code or new code for Drupal 7 theming.

Actually, I tried the following.

foreach($node->field_objectif_bts as $file) {
  if ($file['und']['value']) {
      $header = array('data' => 'Les objectifs des formations BTS');
      $rows = array($file['und'][0]['value']);
      $attributes = array('id'=> 'objectif-bts','sticky' => FALSE);
    }
}

$output = theme('table', array('header' => $header, 'rows'=> $rows), $attributes);
print $output;

I also tried this code, but I get an error.

$w = entity_metadata_wrapper('node', $node);
foreach ($w->field_objectif_bts->getIterator() as $file_w) {
  // $file_w->file returns the wrapper of the File entity. You can
  // then address it's values as:
  $name = $file_w->file->name->value();
  $mime = $file_w->file->mime->value();
  $custom_field = $file_w->file->field_objectif_bts->value();
  // etc. You can see all available fields by inspecting the
  // return value of $file_w->file->getPropertyInfo()
  if ($custom_field) {
      $header = array('data' => 'Les objectifs des formations BTS');
      $rows = array($custom_field);
      $attributes = array('id'=> 'objectif-bts','sticky' => FALSE);
    }
    $output = theme('table', array('header' => $header, 'rows'=> $rows), $attributes);
print $output;
}

The error is the following:

  EntityMetadataWrapperException: Unknown data property field_objectif_bts. in EntityStructureWrapper->getPropertyInfo() (line 339 of /var/www/drupal7/sites/all/modules/entity/includes/entity.wrapper.inc).


texts: Getting Contextual Filters to exclude data for a matching filter

texts:
I have a site where I have 7 different geographic locations each with its own dedicated internet page showing, for example, forthcoming events for a particular location and other location specific data.

I have single common Panels node that acts as a template for all locations.  I pass the location identity in the url (www.mysite.com/location-name) and let Views and Contextual Filters populate the template according to the location identified in the url. All that works fine.

Now the bit that causes problems:  what I would like to do on each location's page is to list forthcoming events for the other locations, but exclude events for this location (since they are listed in more detail in a different View).

My theory was to use Contextual Filters to recognise the location from the argument in the url and then allow Views to collate all the events from all the other locations, except this one.  In other words I want to negate the contextual filter for the location argument in the url.

I am aware that Views provides an "exclude" for certain entities within contextual filters but is not providing the "exclude" button for this particular case using a textual argument.  Any help gratefully received!


texts: How to force Panels to render a node field even when field is empty

texts:
I have a field that I want to display via the Views Hybrid formatter in a panel pane as a node element. It renders just fine when there is at least one user-selected item in the field, but when there is none, it is treated as an empty field and so none of the view results show either. The whole thing is not displayed just because the field is empty.

How can I force panels to render a node element even when the field contains zero values?


texts: Display all nodes with actually viewed taxonomy term

texts:
I have an taxonomy term.

I want to display all nodes that has this term assigned just under the taxonomy term description.

So when user goes to page with the taxonomy he can see the description (that works by default) but also e.g. teasers of all nodes that has this term in field. I guess I have to somehow use view with some filter, but I cannot get it working.

I added the view with block that I've put into structure -> block layout.

I can display all the nodes that has field1 set to term A by adding (to view) Filter criteria field1 = term A. But this is "hardcoded" and I need term A to be another term based on which term page am I visiting.

For example, when I visit page of term A I want to display all nodes that has field1 set to term A. But when I look for term B page, I want to list all nodes with field1 = term B in my view.


texts: Using Context, can I (programiatically) move the page's menu to a different region?

texts:
Using Context, can I move a node's menu to a different region?

Or more specifically, from inside hook_context_page_reaction(), can I get access to the page's render array to move items between regions?

I'm working with this below.

/**
 * Implements hook_context_page_reaction().
 */
function context_movemenu_context_page_reaction()
{

    $node = node_load(menu_get_object()->nid);
    if ($plugin = context_get_plugin('reaction', 'context_movemenu')) {
         $plugin->execute();
    }
}

and using this execute() method. I'm just dumping all incoming args to see what I can send over.

function execute() {
   dpm(func_get_args());
}

Am I approaching this from the wrong location? Ideally, this sites has most of it's configuration in context. The site owner likes that workflow.


texts: Alter $form before _form_validate() is called?

texts:
I need to conditionally set the #required property of a specific form field to FALSE. I know already that the requirement check is performed in _form_validate(). However this function is executed BEFORE any other custom attached validation handlers as it is in fact responsible for calling them.

So I'd like to know if there's a way to alter $form of $form_state BEFORE _form_validate() is called...?

Or maybe there are ways to perform the requirement check at a later time in validation?

Thanks

PS: One could also do reverse thinking (make the field optional and require it in a custom validation handler), but there are reasons I cannot do this.


texts:
My setup is as follows:

Drupal 7.34
Media 7.x-2.0-alpha3
CKEditor 4.4.6.08188c4

My problem is:

When I add an image from the "library" via media browser in CKeditor and try and link it via the "link" icon - the image does not link up. If I switch to source view I can see that no  tags have been added. If I save page - image link is not applied.

However, the link is saved if I edit source and add link  tags in manually.


texts: Add external JavaScript files containing a parameter in the URL

texts:
I need to add some external JS files to my website. This is an extract of the module.libraries.yml file.

my_live_chat:
  js:
    https://mylivechat.com/chatinline.aspx?hccid=12345678 : { type: external, attributes: { defer: true, async: true, data-cfasync: 'false' } }
    https://www.mylivechat.com/chatapi.aspx?hccid=12345678 : { type: external }

As you can see, they have this final variable hccid in them that is different for each website.

I'd like to create a custom module where I only need the client ID (the hccid value) and the module adds all the needed JavaScript files.

I know how to create a custom module with a settings form to ask for the variable value and I know how to add external JavaScript files to my module.libraries.yml file.

How can I deal with that variable so it can be different on each website without modifying the module?


texts:
In Drupal 8 with DbLog logger, I am trying to log some audit messages to a different user than the currently logged-in user. Unfortunately, it looks like something is overwriting my context.

I tried \Drupal::logger("proreos")->info("bla", ['uid' => 5]); and \Drupal::logger("proreos")->info("bla", ['user' => User::load(5)]);, but neither of them worked. In both the cases, the current user ID was instead used.

How can I use a different user ID?

To clarify: This is not about logging another uid, it is about assigning the row in watchdog to a different user.


texts:
I would want to reorganize the profile of the users, in the following way:

Name (h1),
Custom field 1,
Custom field 2,
Edit tab ($tab),
Block.

I tried to delete the $tab variable in page--user.tpl.php, and add it in user--profile.tpl.php, but it does not work.

How to move the edit tab in user-profile.tpl.php ?


texts:
I want to allow my editors to add taxonomy terms to vocabularies. But to do so, I need to give them the permission "Use the administration pages and help", but as soon as i do that, they also can see the menu item "Configuration" in addition to the menu item "Structure".

How can I avoid that?


texts: How can I show/hide just one menu item based on user role?

texts:
I have a single menu item that I would like to show or hide based on user role.

Use case: I have a membership site with paid and free memberships.  In the navigation menu, I want to show a link for users who do not have the "paid" role to the "Upgrade your account" page.  There's no need to limit access; I simply want to show or hide the link.

I know I could make a separate menu and restrict access to that menu block by role, but is there an easy way to do the same for a single menu item link in an existing menu?


texts: How do I correctly load a webform using Ajax?

texts:
The page I need to make is a bit complex and my team and I face many problems with it.

We need to have a page with multiples sections (just square blocs with text on it). Each section displays (on click) a select. When we click on that select, we have to load a webform using AJAX and here is our problem.

We created a view with a select exposed filter and when we change the select value, a webform is loaded in AJAX. BUT only the HTML is here, the input masks on the fields are not loaded until we click again on the apply button for loading another webform (or the same as the first one, doesn't matter).

So, how can we correctly load our webform?

And, even if the masks are loaded on the second load, we don't have our custom handler called when we submit the form. Instead, we are redirect to htp://ourwebsite.com/views/ajax and the custom handler is never called.

Edit : Here are some screen shots.

In the first, this is a content type which contains the view with a select (the one that will load the webform using ajax).
In the second one, we see the webform loaded after the FIRST click on "Apply" : the input masks are not loaded.
In the third one, I just clicked once again the Apply button and when the webform is load, we see the input masks. But even in this case, the custom handler is not called when the webform is submit


texts:
I am trying to place some hooks, but I don't even think they are being called.

THEMENAME_menu_alter(&$items)

and

THEMENAME_user_view_access($account)

are the hooks I am placing in my template.php file. However, they don't seem to be reacting to it. And yes, I am converting the dummy THEMENAME placeholder to the name of my theme in use.

But my real question is: are these hooks just for use in Custom Modules? Or can they be called in from template.php too?

If its just for custom modules then I guess that would explain why it's not reacting. But even so how is one suppose to know if a certain hook is only for a module or not?

P.S: I have also tried clearing the cache several times.


texts: How to prepend a Views query with another query?

texts:
Due to a configuration problem at my host, I'd like to execute the query "SET optimizer_search_depth=0;" in the same DB session as a specific Views query.  I looked into hook_views_query_alter() and hook_views_pre_execute(), but in both cases the query is only available as a Query object.

I think I need some way to modify the raw query string before it's executed, but (presumably) after it's built.  Is this possible?


texts: Show workbench moderation comments on node view page

texts:
I use the Workbench modules suite: Users do change the state of content items (moderate) and can enter a comment about that change.

This status change history can be seen in the tab node/node_id/moderation.

I want to include that view at the bottom of every node view page.

Do you have any suggestions how to achieve that?  Maybe the Display Suite module is useful for that (it has some computational field stuff)?


texts: Find current layout name for a Panels Node?

texts:
I'm using Panel Nodes for a layout, one of which is a specialized layout that will change the overall theme design (Namely hiding the header and footer).

However, I cannot seem to find a way to detect what the current layout being used is -- at least with Panel Nodes (panels_page_get_current() works only with Panels Pages, not Panels Nodes). See: http://groups.drupal.org/node/12565

Anyone have a clue how to detect whether a specific layout is being used by Panels -- and then, preferably, pass that on to theme suggestions?

Thanks!


texts:
I searched a lot without success, i hope i can find the right answer for me.

I want to make a simple bet system, without any real money. At the time of the registration the user get x fakecredits. I decide to use the comment system to check how much the user wants to bet, so i added a field called bet to comment form.

What i want to do now is very simple as logic:

if (Bet < User Money){
 submit content;
}else{
 don't submit;
}

i already made a view that shows user money. i only need the if statement. I also created a module with module_form_alter, but i don't know what to put then.

Thanks in advance

Drupal version 7.x


texts: Admin's node set to published by default?

texts: I currently have nodes set to unpublished by default because I want to approve user submitted content before publishing it live. However, admins should have their nodes published by default. How can I accomplish this?


texts: How do I keep unique form id for ajaxified form?

texts:
I have a form(which is extending the FormBase class) that requires entity as argument(but I am not manipulating with this entity so that's why I am not using the EntityForm which is irrelevant to this issue but just FYI). The form uses data from the entity to build the form id. I am instantiating the form as object and I am keeping the entity as property on the form.

Due to the fact that I have multiple such forms on a single page I need the form id to be unique and matching the provided entity object to avoid collision of submitted values. In Drupal 7 this was taken care of via hook_forms().

Now I want to ajaxify this form but there is an issue that after the first submission the entity object is no longer available to the form. I have stored the data I need in the $form_state but I cannot access this in the getFormId() method.

So I have made the form id non-unique and each form instance has the same id. I have tried to get around this issue by setting the form id in the form array itself as #id attribute but that did not helped.

So my question is how to have an ajaxified form with unique form id that is based on data from provided argument to the form?

This is how I am invoking the form(in lazy loader):

$entity = $this->entityManager->getStorage($entity_type)->load($entity_id);
$form = new MyForm($entity);
return $this->formBuilder->getForm($form);

and the form itself:

class MyForm extends FormBase {

  private $entity;

  public function __construct($entity) {
    $this->entity = $entity;
  }

  public function getFormId() {
    return 'my_form_' . $this->entity->getEntityTypeId() . '_' . $this->entity->id();
  }

}


texts: What is the purpose of the Manage Display in Content type?

texts:
For example, in the Body field there is a LABEL with the following values:

And there is FORMAT with such values:

How does something change on the site depending on the selected values in the Manage Display and what does each value mean?
I tried to create my Content and change these values in Manage Display. But nothing happens to my Content and it doesn’t change at all. Although I tried to choose different view mode.


texts: Aggregating CSS breaks with Internet Explorer

texts:
Selecting the option to aggregate and compress css files breaks display in internet explorer 11. It displays fine with other browsers, or fine in ie11 if I deselect that option. The site in question is wowforfun.org

Thanks in advance.

Edit: Here's a part of the css as served to ie:

‹      µYér¤8þ?OÁŽ£#Ú³M•¶!öÇ>Á>ƒ
T 1 F»Üï¾™:@ªÚîÙí—Ë:Ryç§Ô
é%ÏxÝVTÒáÈENE²oÏAÇ+–§ü•ŠSÅß’’å9mÒ–wL2Þ$äzIÓ!krzNöq<Þ¸Ä‚¾*ÖÉ°“ïMÞÐtþ;d5)ÌhMDÁš$N[’ç¬)ŸRÅ†#É^

Looks like it wasn't uncompressed at all.

Edit 2:

My .htaccess section related to compression:

<IfModule mod_headers.c>
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">
  # Serve correct encoding type.
  Header set Content-Encoding gzip
  # Force proxies to cache gzipped & non-gzipped css/js files separately.
  Header append Vary Accept-Encoding
</FilesMatch>

And here's the settings.php section:

# $conf['css_gzip_compression'] = FALSE;
# $conf['js_gzip_compression'] = FALSE;

I've tried those two lines both commented and uncommented, didn't make a difference.


texts: How do I load entities with Null values?

texts:
The following fails with an exception.

\Drupal::entityTypeManager()->getStorage('foo_module_division')->loadByProperties(['enabled'=>TRUE, 'parent_code'=> NULL]).

How else do I specify I want to load entities whose parent_code field is NULL?


texts: How to hide empty fieldset, but leave prefix and suffix in place?

texts:
Simple as this - I have a Form API fieldset with dynamically changing content. When it's empty, I don't want to show it at all. I use #prefix and #suffix to generate div my AJAX works with.

When I use:

$fieldset['#access'] = FALSE;

it disappears with it's div and no future AJAX call can make it reappear. So, how to hide it with empty, but leave wrapper intact?


texts: How to change the default link for "Contact person by email" generated by the "Email contact form" field display?

texts:
I have a content type set up with an email field that displays a link to a contact form. I want to alter the link from something like this:

Contact person by email

to something like this:

Contact person by email

That way the link will popup into a modal instead of going to a new page. I have the requisite modules installed to render the modal and can do it manually in the content area of a node, I just haven't figured out how to apply the class and dimension info to a field link.


texts: disable email activation only for users who registered via hybridauth module

texts: I've faced a problem, I use hybridauth module + original registration module in Drupal 7. And I want to disable email activation for users who registered by hybridauth module(because they use already activated social account), and still retain enabled email activation for users who registered by original registration module. Thanks in advance!


texts: How can I setup a site with Acquia Dev Desktop 2 beta?

texts: I'm using the new version of Acquia's Dev Desktop beta 2 (https://docs.acquia.com/dev-desktop2) and I want to use it to test and develop on Drupal 8, but it seems tied to a specific set of distributions (ex. commons, COD, Acquia Drupal) and doesn't have the option to install a separate installation. How can I use this for another version of Drupal, besides the versions they are offering?


texts: Why is arg() failing to get the router object on pages with aliased URLs?

texts:
So I posted this question about how to get NID of current node and I'm assured that arg() should work to return the router item for the current page, regardless of aliasing. However, it doesn't work.

The relevant snippet is

if(arg(0)=='node' && is_numeric(arg(1))){
   $nid = arg(1);
   dsm($nid);
}

I've also tried

$load = node_load();
$dsm($load);

and

$item = menu_get_item();
dsm ($item);

and

$node = menu_get_object();
dsm($node);

For all of these methods, they work when I edit the page (and thus make the URL displayed become /node/%/edit) and when I just navigate to /node/% (where % is the NID) but they display either nothing or (in the case of arg()) only the alias (e.g. "about-our-company for the path alias /about-our-company).

How can I reliably get the NID of the current node?


texts: Always expanded menu items not showing up expanded in custom menu

texts:
I have a custom menu profile-menu and have configured a block to display that menu. It has four menu items with 'expanded' => TRUE. However, during test runs these expanded menu items do not show as expanded. I've dug through the Drupal menu code and it looks like Drupal won't handle 'expanded' unless the variable 'menu_expanded' includes the menu name, which is odd because I've never had this problem outside of the test environment. I tried adding variable_set('menu_expanded', array('profile-menu')) to hook_install but for whatever reason when I call variable_get('menu_expanded') inside the test case that variable is an empty array.

If during the test case I call menu_cache_clear_all(); variable_set('menu_expanded', array('profile-menu')), everything does work as expected. The code that seems to be gated by this variable is in menu_tree_page_data.

What's the right way to make sure certain menu items (which I have defined myself in hook_menu) are always expanded? Because setting expanded => TRUE in hook_menu apparently doesn't cut it during test cases. Also, why am I only seeing this issue when running test cases?


texts: How to send an email to an author on a specific date using date field specified in a node?

texts:
In my content I have one date field which is entered by the author, who fills that as future estimate date like  tomorrow or after 1 month. Depending on that estimated date, on that day mail should trigger.

Example: my date field is "weaning date" which the author will fill at as after one month on that day should trigger a mail.


texts:
I wanted to list the terms that a node has in a tree view. I've gotten that far that the list, sorted by the parent, is done, but the terms is in wrong order. Some terms becomes childterms to the wrong parent.

How do I fix that?

function my_module_cmp($a, $b) {

$a = (array) $a;

$b = (array) $b;

return strcmp($a['name'], $b['name']);

}
// A block with the current nodes linked categories in a tree view

function myfunction_category_block_contents($delta) {

// get nid from URL

$nid = arg(1);

$node = node_load($nid);

// get the terms using that nid

$terms = taxonomy_node_get_terms($node);

usort($terms, "hr_torget_cmp");

// create the head

$html = '
Kategorier
';

$html .= '
';

$i = 0;

foreach ($terms as $term){

    // the tid

    $tid = $term->tid;

    // the name

    $name = $term->name;

// DEBUG    $html .= $tid.'
';

    // get terms

    $parents = taxonomy_get_tree(10,$tid,NULL);

    // if the term is a parent
    if ($parents) {
        $html .= '
'.$name.'
';
    }
    // if it isnt
    else {
        $html .= '
';
        $html .= '
'.$name.'
';
        $html .= '
';
    }

$i++;

}

$html .= '
';

$html .= '';

return $html;

}


texts:
I'm developing the main website (A) for an organisation in D7 but for other reasons there are microsites (B) related to this website using CMSs.

I need to give this other users an endpoint in which they can check if the user and password given to them are correct in my drupal instance and of course be able to verify the request only comes from a trusted source (in another physical server without a fixed IP)

So this would be something like:

User enters credentials in website B
Website B's server sends those credentials to my endpoint (A)
Website A check if they are correct and return either ok and the
role that user has or error is there's no user matching them

I looked into Open ID and OAuth approaches but those require user interaction and rely on the users authorizing, etc. What we need is to make it all transparent to the end user so they don't have to know in which of the CMS he/she is in and make an authorization for each one.


texts: Schedule an email to be sent to new users a week after registration

texts:
I am creating a site in Drupal 8 and would like to be able to schedule an email to be sent to new users.  The email should be sent automatically one week after they have registered.

In Drupal 7, I would have used Rules Scheduler to do this, but this doesn't appear to have been ported to Drupal 8 yet.  Could you suggest another way that I could do this?


texts: 'Show block on specific pages' wraps url in paragraph tags

texts:
I have a Drupal 6 site and I want to add a block to a page. This block is generated from a custom module, from the hook_block function.

Under the blocks admin section, under Page specific visibility settings header, there is the setting for Show block on specific pages. I've entered my url under Pages and selected Show on only the listed pages.

When I click save, Drupal wraps my path in <p> tags. I don't have anything in my module that would be overriding the default drupal behavior. Why is this happening and how can I get it to stop?


texts: I need to programmatically make some users take an existing quiz. The quiz has only one question, which is a long answer one, and I have the text needed to fill it. I just can't find any function in the Quiz module that I can call to submit the answer. Is it possible?


texts: How can I hide the entity ID on an autocomplete widget?

texts:
I have an autocomplete widget for a taxonomy entity reference.

Every term shows its entity ID between parentheses; plus, if the term name contains spaces, it appears between quotes, e.g. "Lorem ipsum (125)".

How do I remove the entity ID and the quotes?


texts: Are there any alternate module for qq_import module (Quiz Questions Import Module)?

texts: Are there any alternate module for qq_import module (Quiz Questions Import Module) ? It seems it has no Drupal 7 version for it.


texts: Whenever a user try to recover password or try to register I got mail delivery system error

texts:
Receiving Mail Delivery System error for almost every email generated by Drupal 7

What can be the reason?

here below the message from remote host

  SMTP error from remote mail server after end of data:
     host p3nlsmtpcp-v01.prod.phx3.gdg [72.167.191.78]:
     552 5.2.0 qo8J1p01B4NPGeA01 :: CPANEL :: Message rejected for spam or virus content ::
     Please include this entire message when contacting support ::


texts: how to save a field created by using hooks in database

texts:
I added fields mobile no,landline no, using the below code to the form which i created with webform module. when i fill the fields along with two added fields and submit them .i cannot find the two added field in results.how can i make them appear in results.

function search_enhance_form_alter(&$form, $form_state, $form_id) {

if($form_id == 'webform_client_form_2') {
  $form['mobile no'] = array(
  '#type' => 'fieldset',
  '#title' => t('mobile no'),
  '#collapsible' => TRUE,
  '#weight' => 30,
);
$form['mobile no']['text'] = array(
  '#type' => 'textfield',
  '#description' => t('This is a test to see the form_alter hook in action1.'),
);

$form['text'] = array(
  '#type' => 'textfield',
  '#description' => t('This is a test to see the form_alter hook in action.'),
  '#title' => t('land line no'),
  '#weight' => 10,
);
}
}


texts: Create 2 separated taxonomy pages with views

texts:
I have 2 nodes type "Article" and "Page", I also have 2 taxonomy for each node type are "Taxo 1" for Article and taxo 2 for "Page", is there any way to create 2 seperated views so,

with "taxonomy/term/%" for Article I have grid views

and

"taxonomy/term/%" for "Page" I have "Unformated List",

beside 2 node types have alot of different fields.
Is there any way to handle that?


texts: How to write a module that changes user role when account is created

texts:
I am writing a module called "Applicant" and I want it to add a role called "applicant" to a user after the user creates their own account.

applicant.info

name = Applicant
description = Handles Applicant User Actions
core = 7.x

applicant.module

<?php
function applicant_user_insert(){

}

What would I include inside of the hook in applicant.module to access the current user's roles and add "Applicant"?


texts: How can I build a redirect from submitted form values?

texts:
I'm working on a short weather app.

What I want to do, is to catch name of the input of city and redirect users to the city's page URL after submit.

function form_findYourCity_submit($form, &$form_state) {

  $city = $form_state['values']['city_name'];

  // catching city name from input and assigning it to a variable
}

And I want after submit redirect user to new page with url/something/?city=something on which I then want to use if isset $_GET['city'] and then do my operations with the weather API database and pulling data based on the city.


texts:
When I am updating Drupal core, and uploading files via FTP, how can I prevent mydomain.com/install.php trying to load and displaying WSOD errors like "Fatal error: require_once() [function.require]: Failed opening required..."?

I'd like to display a static page with a BRB message instead.


texts:
I setup a site with domain access. It has 2 subsites.
I want to publish content from the main site to the subsites. This is already working good with send to affiliates. But I want some local admins on the subsites to have the permission to decide if they want to use the content or not. Is it even possible with domain access or is it just one way from top to bottom ?


texts: Drupal 7 Change User Login block link text

texts:
I've set up the standard "User Login" block to the "header" region of my theme. I clicked on "configure" and selected "Link" under "Block Type". Now the link to sign in appears as "Log In/Register". How do I change this text?
I have also LoginToboggan enabled.


texts:
We have a Drupal 7 site running Drupal Commerce. Our host has now informed us that they will be updating PHP from 5.6.3 to PHP 7.2.

Is Drupal Commerce for Drupal 7 compatible with PHP 7.2?
I have tested Drupal 7 with PHP 7.2 on another domain; for most of the part, it appears to work. However, I have not been able to test Commerce on PHP 7.2, yet.


texts: Database field of timestamp type cannot be added to the database using hook_schema()

texts:
I have created a custom module in drupal 8. But in the .install file there is a field for created_date which has a type of timestamp. When I try to enable that module it gives the below error.

exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_date'' in

.install file

<?php
function golf_reservation_schema()
{
  $schema['golf_reservation'] = array(
   'fields' => array(
       'id' => array(
           'type'     => 'serial',
           'not null' => TRUE,
       ),
       'property_tid' => array(
           'type' => 'int',
           'not null' => TRUE,
       ),
       'property_name' => array(
           'type'     => 'varchar',
           'length'   => 100,
           'not null' => TRUE,
       ),
       'title' => array(
           'type'     => 'varchar',
           'length'   => 20,
           'not null' => FALSE,
       ),
       'full_name' => array(
           'type'     => 'varchar',
           'length'   => 255,
           'not null' => TRUE,
       ),
       'tee_date' => array(
           'type'     => 'varchar',
           'length'   => 255,
           'not null' => TRUE,
       ),
       'tee_time' => array(
           'type'     => 'varchar',
           'length'   => 255,
           'not null' => TRUE,
       ),
       'golfers' => array(
           'type'     => 'int',
           'not null' => TRUE,
       ),
       'no_of_carts' => array(
           'type'     => 'int',
           'not null' => TRUE,
       ),
       'special_request' => array(
           'type'     => 'text',
           'not null' => FALSE,
       ),
       'created_date' => array(
           'mysql_type' => 'timestamp',
           'not null' => true,
       ),
     ),
     'primary key' => array('id'),
   );

   return $schema;
}

But when I execute this query in database it does not give an error

CREATE TABLE eme_golf_reservation (
  `id` INT NOT NULL auto_increment,
  `property_tid` INT NOT NULL,
  `property_name` VARCHAR(100) NOT NULL,
  `title` VARCHAR(20) NULL DEFAULT NULL,
  `full_name` VARCHAR(255) NOT NULL,
  `tee_date` VARCHAR(255) NOT NULL,
  `tee_time` VARCHAR(255) NOT NULL,
  `golfers` INT NOT NULL,
  `no_of_carts` INT NOT NULL,
  `special_request` TEXT NULL DEFAULT NULL,
  `created_date` TIMESTAMP NOT NULL,
  PRIMARY KEY (`id`)
)

I am running the latest Drupal version with MySQL 5.6.30.


texts: How do I delete all terms from a vocabulary (bulk delete)?

texts:
I have a large vocabulary, and admin views does not yet work for taxonomy. Taxonomy Manager does not do this as well.
Are there other options for bulk-deleting taxonomy terms?


texts: entityCondition check if a field is not empty

texts:
My user table has an init field in it, it maybe empty or not.
I want to find all rows that are not empty
I tried

  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'user')
    ->addTag('role_filter');

function mymodule_role_filter_alter(QueryAlterableInterface $query) {
  $query->innerJoin('users_roles', 'ur', 'users.uid = ur.uid');
  $query->innerJoin('role', 'r', 'r.rid = ur.rid');
  $query->condition('r.name', ['administrator', 'contributor', 'publisher'], 'IN');
  $query-> isNotNull(ur.init); // I ALSO TRIED a != '' condition
}

What I am doing now that works is:

  $results = $query->execute();

  $users_node_list = entity_load('user', array_keys($results['user']));

  $return_results = array();

  foreach ($users_node_list as $key => $value) {
        if ($value->init != ''){

but that is post query.

and read https://www.drupal.org/node/1157006

but this is not working (I don't get any results when I add this)

Ideas?


texts:
I was trying to add the BoWoB Chat module to my site. It doesn't work and the error log file in its directory contain multiple lines like the following ones:

  Failed opening required 'sites/all/modules/og/og.field.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/mysite.com/sites/all/modules/og/og.module on line 16

Lines 15 and 16 are the following ones.

// Load all Field module hooks for Organic groups.
require(drupal_get_path('module', 'og') . '/og.field.inc');

The file og.field.inc is in the same directory as sites/all/modules/og/og.module and its permissions are 644, so it is readable.

This one has me stumped. Do you have any suggestion?


texts:
I ran into an big issue, I mistakenly got the wysiwyg text format disable in my text formats config, Now I created the new wysiwyg text formats, but the problem is my whole content is not visible from frontend, I found the default text editor for nodes is not getting selected, I even changed the settings under wysiwyg profiles. Now I manually need to edit the existing nodes and select the text editor wysiwyg then only the content is visible from front end. Is there anyother way I can solve this issue, I can't manually edit each node one by one and change the text editor to wysiwyg, there are thousands of nodes, I am sure there might be some way to fix this.

I am using drupal 7