texts: Content types with a field that get data from my custom table

texts:
as it said on the title, I've create a custom table named : writers (contains name,books..of writers)

To add a book, I've created also a content type that contains a form, with many textfields (book title, editor, number of pages..ect),now I want to have a list of writers (that are stored on my table : writers) to be sure that the book I'm adding is a book written by one of the writers I've on my table

I'm working on it for 2 days and I don't know how to do it, please if anyone can helps me it would be great

P.S. I don't want to let the user write the name of the writer on the form (content type) I want to let him choose on a list

Thank you

This is my book.module (to get an item to access to the form book):

<?php

function book_menu (){

$items['admin/books'] = array(
    'title' => 'books',
    'description' => 'books form',
    'title callback' => 'book_title_callback',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array('administer books'),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('book_form')
);

  return $items;
 }

function book_permission(){
  return array(
   'administer books' => array(
   'title' => t('permissions to deal with books'),
   'description' => t('permissions to deal with books'),
 ),
  );
  }

and I have some functions..

Here we have the new function hook_update_7001 :

function book_update_7001(&$sandbox){
$info = field_info_field('field_data_field_writer'); //the select list on the content type

  $result = db_query("SELECT name_writer, uid FROM {writers} ");

  $res = $result->execute();
  $options = array();
   foreach($res as $sql){
    $options[] = array(
        'uid' => $sql-> uid,
        'name' => $sql-> name_writer,
        );
   }
$info['settings']['allowed_values'] = $options;
field_update_field($info);
 }


texts: Using twig, how to show a message on the frontend if a field is empty?

texts:
Using twig, I would like to show a message on the frontend if a field is empty. My question refers to a date field, but I think this question could apply to other field types.
In my event content type I have smart_date field with unlimited cardinality. I do not want to make this a required field, but if the field is empty I want to show a message to visitors. Something like 'No dates are currently scheduled'.
I have created a template file called field--smartdate.html.twig and into this I have pasted the content of field.html.twig my base theme (Bootstrap). Copied below.
  {%
    set classes = [
      'field',
      'field--name-' ~ field_name|clean_class,
      'field--type-' ~ field_type|clean_class,
      'field--label-' ~ label_display,
    ]
  %}
  {%
    set title_classes = [
      'field--label',
      label_display == 'visually_hidden' ? 'sr-only',
    ]
  %}

  {% if label_hidden %}
    {% if multiple %}

        {% for item in items %}

{{ item.content }}

        {% endfor %}

    {% else %}
      {% for item in items %}

{{ item.content }}

      {% endfor %}
    {% endif %}
  {% else %}

{{ label }}

      {% if multiple %}

      {% endif %}
      {% for item in items %}

{{ item.content }}

      {% endfor %}
      {% if multiple %}

      {% endif %}

  {% endif %}

I have read Checking for empty fields in Twig templates is complicated And, yes it does seem complicated and I am still unsure what to do.
I have also tried the Empty Fields module but I am hoping this can be done via the theme.
So what changes must I make to the code to display a message if the field is empty?


texts: How can I create my own hook (similar to the ones Drupal core creates) for other Drupal modules to utilize?


texts:
I was wondering if this is possible. I have a views which is displayed as a page and I want to have menu inside that page. Is there a module available to achieve this?

Here's a picture of what I want to copy:

Thanks for the suggestions. I'm a newbie


texts: Module for getting what is visible from user's webcam

texts:
I need a module that allows users to show what is visible from their webcam.
Is there a module that can do this?


texts: How to get the entity ID in a twig template

texts:
I have a custom entity, with the template my-custom-entity--my-entity.html.twig.
How do I access the ID in the template? I can do this by implementing hook_preprocess_entity, but am wondering if the ID is already available in the template.


texts:
My client wants a real estate website that links to other major sites like Trulia. He wants a way of collecting information from his visitors, and a way of telling that they went through his site to get to the major real estate sites.

How can this be achieved?


texts: What is the right way to get number of items from a field?

texts:
In code review I saw a developer using count($paragraph->field_events) to get the number of referenced entities.

I thought, surely that can't work, that can't be right.  So the question is, what is the correct way to get the number of items from a field on an entity?


texts: alter query for content listing page in admin

texts:
I want to alter query for "admin/content/" listing page for my specific role i.e. admin_country.

when any one login to the site with above role than it will display those node listing which is related to that country (for managing country I have used one field in my custom content type i.e. restaurant).

also this user can perform all operation except delete any restaurant. this user has no rights to delete any type on content/restaurant.

Thanks,


texts: Drupal 7 Captcha in all webforms or per content type webforms

texts:
I am on D7.

I have a content type that is webform enabled.

Requirement
I need to implement captcha for all the webforms for nodes of this content type.

Problem
In D7, you are supposed to give the form_id in the settings page to get captcha in the form, however I will have loads of forms with all different form_ids.

I am using the Captcha module.

Is there any way to implement my requirement?


texts: How to Display Unique Values from database using db_select in Drupal

texts:
i tried with following code but i cant get the attached output

$query = db_select('webform_submitted_data', 'u');
$query->fields('u', array('sid','nid','data'));
$query->condition('nid','49','=');
$results =$query->execute();

echo "
";
echo "
";
echo "Name ";
echo "Post ";
echo "
";
while($record = $results->fetchAssoc())
{
 $sid = $record['sid'];
 $nid = $record['nid'];
$submission = webform_get_submission($nid,$sid);
echo "
";
echo $submission->data[1][0];
echo $submission->data[2][0];
echo "
";
}
echo "
";
}


texts: I am looking for a good way to add security at a field level based on a group.  Different groups will use the same content type. Does OG handle this requirement. I don't want to make the full node private.


texts: Views - Test if field is visible via PHP

texts:
I am developing a custom theme for a specific view. I need to iterate and render each row and field, How can i do that?

Some code:

foreach($view->rows as idx => $row)
{
    foreach($view->field as $name => $handler)
    {
        //I need to check if the field is hidden from
        //display here
        $view->render_field($name, idx);
    }
}

I am going through with the debugger and use $handler array options, but within that I could not find any field that is visible or not.

Can anybody help?


texts: How can I use node_load with a module created page that requires an argument?

texts:
I would like to load the contents of a page like how node_load() works, although what I am trying to load isn't a node but a page created using a module. The entry in hook_menu uses an argument which needs to be passed in the URL. This is for a popup (jquery overlay) that I want to reuse where the code is already done for the standalone version.

Any idea how this can be done? (Drupal 6)


texts: How to check with the Rules module if a user has a custom picture?

texts:
I'm using the Rules module, and I have a rule with these Rules Events:

After saving a new user account
After updating an existing user account

Within the Rules Conditions, I try to put "Data value is empty" -> account: (I don't found "picture", "image" or any of this)

I have: admin/config/people/accounts user images [check]

Any idea how I can check if the user has used a custom image?


texts: Allow special characters in the Search Form

texts:
I can't search with any special character in the default search block form or in search API.
Commonly used word like B&W (black and white) don't seem indexed up well, probably due to some encoding or decoding problem.


texts: Is there a way to create a hotel roommate system for a conference?

texts:
I will host a conference but the hotel room rate is very expensive.  I am thinking of possible to create a system in drupal that allow registers to find a roommate to share a hotel room.

I saw the Room module, but I don't think this is what I am looking for.


texts: Simplesamlphp Authentication Login Failing

texts:
I had a Drupal 7, IIS7, PHP 5.4 Simplesaml 1.14.7 setup that was working for using the simplesamlphp_auth module for login with my remote IdP.  We recently moved servers, so now I am on a Drupal 7, IIS10, PHP 7.3, Simplesaml 1.14.7 setup that isn't working.

When I test my Simplesaml via https://myurl.com/simplesaml (the virtual directory that points to the Simplesaml www folder), I can test my authentication services fine and it returns with the information I'm expecting.  If the simplesamlphp_auth module is enabled but not activated, https://myurl.com/saml_login goes to a page that says "Logon to the site."  "This functionality is not enabled yet."  Makes sense.

The issue is when I activate simplesamlphp_auth and navigate to https://www.myurl.com/saml_login - it downloads a saml_login file instead of redirecting to my remote IdP.  The file looks like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>POST data</title>

Note: Since your browser does not support JavaScript, you must press the button below once to proceed.

    <form method="post" action="https://urlfrommysaml20-idp-remote.php file">

<input type="submit" style="display:none;" />
    <input type="hidden" name="SAMLRequest" value="PHNhbWxwOkF1dGhuUmVxdWVzdCB4bWxuczpzYW1scD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczpzYW1sPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIiBJRD0iXzVmNjc3N2QzYmU2NTMzYzdhZjdhMjAyM2JkN2EyNjkzN2QwMDA2ZWU0NyIgVmVyc2lvbj0iMi4wIiBJc3N1ZUluc3RhbnQ9IjIwMTktMDItMjdUMDA6NTc6MjFaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaGliLmRwby51YWIuZWR1L2lkcC9wcm9maWxlL1NBTUwyL1BPU1QvU1NPIiBBc3NlcnRpb25Db25zdW1lclNlcnZpY2VVUkw9Imh0dHBzOi8vd3d3LnNvcGgudWFiLmVkdS9zaW1wbGVzYW1sL21vZHVsZS5waHAvc2FtbC9zcC9zYW1sMi1hY3MucGhwL2RlZmF1bHQtc3AiIFByb3RvY29sQmluZGluZz0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmJpbmRpbmdzOkhUVFAtUE9TVCI+PHNhbWw6SXNzdWVyPmh0dHBzOi8vd3d3LnNvcGgudWFiLmVkdS9zaW1wbGVzYW1sL21vZHVsZS5waHAvc2FtbC9zcC9tZXRhZGF0YS5waHAvZGVmYXVsdC1zcDwvc2FtbDpJc3N1ZXI+PHNhbWxwOk5hbWVJRFBvbGljeSBGb3JtYXQ9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpuYW1laWQtZm9ybWF0OnRyYW5zaWVudCIgQWxsb3dDcmVhdGU9InRydWUiLz48L3NhbWxwOkF1dGhuUmVxdWVzdD4=" /><input type="hidden" name="RelayState" value="https://myurl.com/saml_login" />

        <button type="submit" class="btn">Submit</button>

    </form>

Anyone have experience with this or know a possible fix?  Thanks!


texts: how to filter taxonomy vacobulary using views contextual filters

texts:
I have taxonomy vocabulary

parent term1 -
  child term1,
  child term2,
  child term3

parent term2 -
 child term4,
 child term5,
 child term6

I will be passing view arguments as parent term1. So the output should be (child term1,child term2,child term3).

Please let me know how to achieve this using views contextual filters

Thank you very much for your help!


texts: Access webform select list key from within rules

texts:
I have a webform that needs to be sent via rules. That's all fine but I don't seem to be able to access the data key for a select list in my webform.

I can get the value like this:

[data:location-value]

But I need to key not tha value.

I tried (as a guess)

[data:location-key]

But that doesn't work.

Any ideas?


texts: How do I allow both kg and lbs units for a field

texts: I want the user to be able to submit weight as either kg or lbs and do any necessary conversion on the fly. I took a look at Unit Conversion Formatters but it seems that this is designed to convert for display only (not for storage).


texts: loading templates of region within page.tpl regardless of blocks being present

texts:
I came to this query while trying to create my own theme. Say i have my region named footertop, which is placed above the footer. Its going to contain only some html content and some site logos which are static atleast for now.

I don't have any blocks to assign to this region but still want it to appear and had created a template file named block-footertop.tpl. But to my understanding (from drupal docs) this region only appears if any block is assigned to footer top region and is meant to be that way. My page.tpl.php doesn't have any conditions placed for this region, merely

<?php print $footertop; ?>

I'd like to know if there's any way to 'include' the template within page.tpl.php like its done with smarty. Most of the search i'd done showed me results containing *hook_theme()* and seemed different than what I'm trying to achieve.

Why I'm trying to this is to save a big bunch of html markup from being in my page.tpl.php and sheer curiosity to understand drupal theming better.

Any suggestions/solutions to this novice drupal enthusiast would be greatly appreciated.

Thanks in advance!!


texts:
I have a custom menu MyMenu and I have four menu items.
What I want to do is to add the current uid as a parameter at the end of the link.

In D7 I could use menu_tokens module which is not available on D8.

I tried to create a routing file in my custom module.

So in my routing file MY_MODULE.routing.yml I added :

MY_MODYLE.my_applications_redirect:
  path: '/my-applications'
  defaults:
_controller: '\Drupal\MY_MODULE\Controller\MyApplicationController::redirect_to_my_applications'

And in MyApplicationController.php :

namespace Drupal\MY_MODULE\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
 * A controller that redirects to the my applications page.
 */
 class MyApplicationController extends ControllerBase {

  /**
   * {@inheritdoc}
   */
  public function redirect_to_my_applications() {

    global $base_url;
    $user = \Drupal::currentUser();
    $path = '/my-applications/'. $user->id();

    $response = new RedirectResponse($base_url . $path);
    $response->send();
  }

}

Also in the menu I have set the path to /my-applications.

Do I miss something?

PS. The "my-applications" page is a panel page.


texts:
I have a field collection called field_sections that has inside it it 2 fields:

field_section_title (just plain text field)
field_menu_item(field collection with 4 fields)

field_menu_item has 4 fields

 - field_item_title
 - field_menu_image
 - field_item_price
 - field_item_description

  I would like to build an array sections, and those sections are
  objects that contain menu_items, which are objects that contain
  menu_items.

I have tried something so far, but unfortunately I can only get the sections and not the nested menu_items and their values. For some reason in their place, only a number is contained instead of the actual field value.

How can I build those arrays?

ps:my apologies for the basic question, but I'm just now getting my hands dirty with PHP and this further complicates things for me.

This is what I did so far:

//prepare array
$sections;
$sectionsCounter = 0;

$node = node_load(8);
//Load sections field collection
$items = field_get_items('node', $node, 'field_section');
foreach ($items as $item) {

   $sectionItems;
   $sectionItemsCounter = 0;
   $fc = field_collection_field_get_entity($item);
   $sectionTitle = $fc->field_section_title["und"][0]["value"];
   //push item into array now
   $sections[$sectionsCounter]["sectionTitle"] = $sectionTitle;
   $sectionsCounter++;

}

I have only managed to get the title of each section so far and push it into an array as an object with property title

UPDATE:

Well ,it seems I somehow got it to work, but I'm worried this is not the best solution. Can someone please have a look and tell me if I'm doing this the correct way?

//Load sections field collection
  $sections;
  $sectionsCounter = 0;

  $node = node_load(8);
  $items = field_get_items('node', $node, 'field_section');
  foreach ($items as $item) {

     $sectionItems;
     $fc = field_collection_field_get_entity($item);
     $sectionTitle = $fc->field_section_title["und"][0]["value"];
     $sections[$sectionsCounter]["sectionTitle"] = $sectionTitle;
     $itemsField = $fc->field_menu_item["und"][0]["value"];

     $innerCounter = 0;
     for ($i=0; $i <sizeof($fc->field_menu_item["und"]); $i++) {

        $arr = $fc->field_menu_item["und"][$i]["value"];
        $innerArray = entity_load('field_collection_item', array($arr));
          foreach ($innerArray as $item) {
            $sections[$sectionsCounter]["sectionItem"+$i] = $item;
          }
        $innerCounter++;
     }

     $sectionsCounter++;
  }

I've managed to create 2 objects that each contain:

A section title
An object that holds all the fields that the 'inner' field collection of the section contains


texts: Unpublished content is displaying in entity referenced fields

texts: I am using entity reference to refer another content type. But in the list I am getting unpublished content also. Because I have given permission to view Unpublished content, but I don't want to show them here. So how can I restrict those content from displaying in Entity referred field value.


texts: User picture not showing, after moving from localhost to prodution

texts:
I have moved my site from localhost to the web hosting, and in the web hosting, the user picture have been lost and the users cannot upload new photos. But in the localhost everything was working nicely

When i inspect the "lost picture", i get this path: MY_SITE.com/sites/default/files/styles/thumbnail/public/pictures/MY_PICTURE-5-1375807631.jpg?itok=eQN27TLT

I'm getting crazy with this. Is there any sugestion? Thank you


texts: How to tell if my Drupal site is comprised from the SA-CORE-2018-002 -- 2018 March exploit?

texts:
Just released exploit: https://www.drupal.org/sa-core-2018-002 --- Drupal core - Highly critical - Remote Code Execution - SA-CORE-2018-002

How can I tell if someone used this exploit to hack my site?
What can they do with this exploit if executed properly?
I can't update my Drupal sites now, what is a good alternative to patch up this hole easily?


texts: How do I show only 3 of the latest posts for each term in a view?

texts:
With the help of another question: Show newest nodes for each taxonomy term in Views I have been able to create the view I require, except that it displays all posts for each term (grouped by term)? How do I limit each term to display only 3 of their latest posts.

e.g.

Term 1
 - Post 1
 - Post 2
 - Post 3

Term 2
 - Post 1
 - Post 2
 - Post 3

Term 3
 - Post 1
 - Post 2
 - Post 3


texts:
I am using Drupal 7 with the Metatag module along with the Page title module.

I have a requirement to build the title of a custom content type using some node fields and additional conditions that I can't reproduce using the tokens provided, so I have hooked to the page title API ( hook_page_title_alter(&$title)) to build my custom title only for one node type.

The function works and the page title is set. But the meta tags are wrong, they are not using the page title found in <TITLE> (under <HEAD>) but the node's title which I don't want to use.

How do I feed metatags module with my custom title ? I am out of ideas, so anything is appreciated.

As commented by someone you don't need the page_title module if you use metatags, but page_title provides an API with hooks to alter the page title, and that's what I am using and what I need to use, so maybe the question could be reformulated to "How do I alter the page title generated by metatags?"


texts:
Okay, this might seem noobish, and I doubt questions like this often get answered, but:

How do you create a simple Wizard in Open Atrium?

I am not really sure how the Wizard feature(?) in Open Atrium works. Haven't seen any tutorials or other documentation for how the heck this thing behaves, or can be created. So any example on this "thing", would be kindly accepted.


texts: How do I use Features to export a custom content type to a stand-alone module

texts:
This is a follow-up on, but not a duplicate of, Programmatically creating a content type with file field in a custom module.

As suggested by Tenken in a comment to the OP of that question, it is easy to do this by using the core FieldUI module to create the fields, and then then use Features to export the fields to a custom "Feature" module.

You can then install the "Feature" module as any other module that implements a custom content type, but you need to have Features installed for it to work.

I want to use the FieldUI and Features to create a custom content type module, but the module should be stand-alone (i.e. not depend on Features for (re)creation of the content type).

Is this doable? Or is Features a dead end in my use-case? I.e.: If I want a stand-alone module, I must create it from scratch.

And if it makes sense to use Features, what do I need to do in order to transform the "Features" module into a stand-alone one?

(I've searched for similar questions, but not found an answer that describes how you make the generated "Features" stand-alone.)


texts: I made a content type where I have used views to make my content into a block. But the content type's page shows two copies of the data. One from the content type, and another from the block made through views. I want the data that is shown through views, but I also want to keep the edit content tab for easy editing. I am not sure what other information I need to give to make the problem clearer.


texts: How display content from an uploaded file onto a form

texts:
I am using managed_file form element to upload a file on my custom form in Drupal 7, and I was wondering if its possible to process the file and display its contents on the form for nspection prior to submiting the form.

Something along these lines:

-User uploads a file, (its in binary format a the minute but just for simplicity suppose it a csv file.

-Process the input file and display the contents of the file to the user on the form so they can inspect the data.

-If the user is happy with the data procced with the form submission.

Is a custom file validator the best place to call my method for extracting the data from the file? and how do I then update the form to display a table containing the extracted data.

I appreceiate any ideas or pointers.

Thanks.

sample code:

<?php

  function custom_validator($file)
  {
      $errors = array();
      $destination = "public://SessionFiles/";
      $file->destination = file_destination($destination.$file->filename, FILE_EXISTS_REPLACE);

      $scriptFile = '/c:/wamp/www/sandbox/python/DatReader.py';
      exec('python '.$scriptFile. ' '.$filePath .' '.'2>&1' , $output, $return);

      if($return == 0) //script executed succesfully
      {
         return $output; // return the data from teh python script.
      }

      return array(); //script failed return empty array.
  }

  custom_module_form($form, $formState)
  {
      $form['dataFile'] = array
      (
          '#type'              => 'managed_file',
          '#title'             => t('Upload Data File'),
          '#upload_validators' => array
          (
            'file_validate_extensions' => array('dat'),
            'custom_validator'         => array(),
          ),
         '#upload_location'   => 'public://SessionFiles',
       );

       return $form;

  }


texts:
Is it possible to have a print/pdf link (using the print module) displayed on a views page?

I've got it displaying in a basic page type, but view is not a content type, so how do I select the option?


texts: Only ONE CSS File for Visitors (and more for Admins)

texts:
So I just started creating a theme for my first big drupal project, and instantly had to quietly cry in a corner, as I saw how many css files Commerce Kickstart 2 and Omega4 are serving by default.

My plan is to essentially reduce the number of CSS files served to only one, perhaps two (depending on the current page), for the minimum amount of http-requests, without having to manually exclude them all in the theme settings file (which would be an unreliable solution, as new CSS files may get added upon installment of a new module). In addition, exceptions will have to be handled depending on a user role; so visitors should really only get one or two css files, whereas admins shall be served with all CSS files, that are required for the control panel overlay, as well.

Thus my question: Is there a way for me to easily smack those fancy admin- and maintenance-related CSS files back in, only to be loaded for admins?

Basically I want regular visitors to only load my global.css file, whereas admins also get the CSS files of the basetheme as well as commerce_kickstart_menus.css. (For some reason, toolbar_megamenu.css already gets served to admins only.)

Any help or hints as how I could go about this would be super-appreciated!


texts: Tweets of articles from links get a generic image

texts: When I tweet the URL of an article on my Drupal 7 site, I get the correct summary, but the associated image is a generic icon -- not the image associated with the article. I've been trying to fix this via the Twitter Card and Metatag module in admin, but it's not going anywhere. Has anyone encountered and fixed this?


texts: Use a view to show multiple content types, but only show a field if it belongs to specific content type

texts:
I was wondering if the following was possible:

content type A and B have field X
create a view to show nodes of content type A and B
show only field X for nodes of content type B?


texts:
I'm running a D7 site and need some help with a view.

I've a 'Follow' Flag on every user profile which users can use to follow each other.

I'm trying to build a view where I want to see the list of users who have followed less than 5 other users.

Is this possible?


texts: How to set up permissions while using dso as PHP handler?

texts:
I'm having all kinds of troubles while setting up my site online. I can't upload new modules and if I try caching this is what I get:

Warning: file_put_contents(temporary://filedwZLkV) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1900 of /home/brighton/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://fileLbErlU) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1900 of /home/brighton/public_html/includes/file.inc).
The file could not be created.
Warning: file_put_contents(temporary://filehy4XmT) [function.file-put-contents]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data() (line 1900 of /home/brighton/public_html/includes/file.inc).
The file could not be created.
Notice: Undefined index: search_api_page_search_form_search in drupal_retrieve_form() (line 760 of /home/brighton/public_html/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'search_api_page_search_form_search' not found or invalid function name in drupal_retrieve_form() (line 795 of /home/brighton/public_html/includes/form.inc).

The problem is that I have to use dso with my LAMP stack, so there's a lot of things that belong to the user "nobody" (there's no www-data user), and I'm really not quite sure how I should handle this.

A few details about the site's structure and current permissions:

Site root:

drwxr-x--- 12 brighton nobody       4096 Sep 12 18:55 public_html/

sites/default:

drwxr-x---  3 brighton nobody 4096 Sep 12 18:48 default/

sites/default/files:

drwxrws--- 11 brighton nobody  4096 Sep 15 12:42 files/

Private file system path and temporary directory (../tmp/drupal/):

drwxrw-rw-  3 apache   apache   4096 Sep 12 19:50 drupal/


texts:
I can't install anything because of this error:

  [RuntimeException]
    Could not scan for classes inside "/app/vendor/symfony/serializer/src/" which does not appear to be a file nor a folder

and subsequently:

  Could not scan for classes inside "/app/vendor/symfony/yaml/src/" which does not appear to be a file nor a folder

I navigated to that directory and the src folder is indeed missing...

I'm using Lando and switch the PHP to 7.1. I tried deleting the vendor directory and rerunning lando composer update and lando composer install but get the same errors.


texts: How do you display fields created via the File Entity settings configuration?

texts: I'm using the File Entity module, and it lets me modify the configuration settings, adding a few fields to a file type, but I can't seem to figure out how to get the custom fields I created to show up in the add content screen. Only the Alt text and Title values show up. What am I missing?


texts: How do I link an image field to an pdf file

texts:
I have a challenge in linking my image to a pdf file. I have a content type with 2 fields, image field which will contain the cover picture and an attachment field which is file of type pdf.

In my view am trying to link an image to attachment so that when a user clicks on the image it open a pdf file.

In some instances where am just using description to link to a pdf file, this what I have put in my Global PHP(Description) output code in my view.
nid, 'filename.pdf');
?>
As soon as click on the description my pdf opens. works fine

But I need to do the same thing with my image, to just click on image then should open my pdf file. Any idea???


texts:
Hi i am newbie to Drupal, i want to search particular content type only, if any modules or ideas pleases share with some examples please.

Current search module searching whole website and returned results, but i want search option for particular content type only.

Kindly help me.


texts:
Im trying to set up Drush 8 with MAMP Pro.

Short version:

Ive got Drush working so that when I cd to my project root and enter a command like vendor/bin/drush en ban it works fine.

Ive followed these instructions to have a site local Drush. Im trying to make it so that I can just run drush en ban not the full path.
http://docs.drush.org/en/master/install/

Ive copied examples/drush.wrapper to my root and renamed the file to just drush. However when I run drush in the terminal it just returns -bash: drush: command not found. If I run vendor/bin/drush en ban again then now I get -bash: vendor/bin/drush: No such file or directory

More detail:

My .bash_profile has the following:

export PATH=/Applications/MAMP/bin/php/php7.0.15/bin:$PATH
export PATH=/Applications/MAMP/Library/bin/:$PATH

When I type in which php I get the following, which is the same as I can see in MAMP's UI, so I think its correct.
/Applications/MAMP/bin/php/php7.1.1/bin/php

If I run vendor/bin/drush status I get:

vendor/bin/drush status
 Drupal version                  :  8.2.7
 Site URI                        :  http://default
 Database driver                 :  mysql
 Database hostname               :  localhost
 Database port                   :  3306
 Database username               :  root
 Database name                   :  db_1
 Database                        :  Connected
 Drupal bootstrap                :  Successful
 Drupal user                     :
 Default theme                   :  bartik
 Administration theme            :  seven
 PHP executable                  :  /Applications/MAMP/bin/php/php7.0.15/bin/php
 PHP configuration               :  /Applications/MAMP/bin/php/php7.0.15/conf/php.ini
 PHP OS                          :  Darwin
 Drush script                    :  /Users/MYUSERNAME/Sites/PROJECTNAME/1/vendor/drush/drush/drush.php
 Drush version                   :  8.1.10
 Drush temp directory            :  /tmp
 Drush configuration             :
 Drush alias files               :
 Install profile                 :  standard
 Drupal root                     :  /Users/MYUSERNAME/Sites/PROJECTNAME/1
 Drupal Settings File            :  sites/default/settings.php
 Site path                       :  sites/default
 File directory path             :  sites/default/files
 Temporary file directory path   :  /Applications/MAMP/tmp/php
 Sync config path                :  sites/default/files/config_1j990namX0DnLC48TQyG6OJgFYvwOVORkxIedsS
                                    soksn8g72IgMtMkk2PZKCHybdHvB2IqLEGw/sync


texts:
I added some debugging statements (using dd()) which include a timestamp and $user->sid (after declaring $user as a global).  I tested it, of course, and everything worked great for me. Then a user reported getting some notices which said "Undefined property: stdClass::$sid ..."

I added a conditional to test to see if $user->sid is set before writing out the value, but I didn't think that it was possible for it to not be set!  I did some quick Google and drupal.stackexchange.com searches, but couldn't find any info on how this might be possible.

Anybody have any insight here?

TIA,
Lee


texts: How do I programmatically create a list of new users?

texts:
I'm trying to use the following drush script, but I keep getting errors. Currently, it is not properly setting the user role to Premium.

#!/user/bin/env drush
<?php
  $users = [
      "name" => "email",
      "name" => "email",
      "name" => "email",
      "name" => "email",
      "name" => "email",
      "name" => "email",
      "name" => "email",
      "name" => "email",
  ];
  foreach ($users as $key => $val) {
      drush_invoke("user-create", $val);
      drush_print("Created account for email " . $val);
      drush_set_option("password", $key);
      drush_invoke('user-password', $val);
      drush_print("Created password for email " . $val . " with password " . $key);
      drush_set_option("mail", $val);
      drush_invoke('user-add-role', "Premium members");
      drush_print("Added premium role to " . $val);
  }
?>

Is there a better way to achieve this?


texts: Add Emoticon at my Simplenews Newsletter's subject

texts:
I send newsletters from my Drupal 7 website using Simplenews. What I want is to add emoticons at the subject of the newsletter, like a Smiley or something like this.
Is it possible?


texts: PHPUnit testing a method that changes an entity field

texts:
Let's say I have an entity with certain fields and a method that does the following
public function changeEntityField(Entity $entity) {
  $entity->set('field_xyz', 20);
  $entity->save();
  return $entity;
}

I know how to mock an entity and set its field values via $entity->expects($this->any())->method('get')->with('field_xyz')->willReturn(10) etc. and pass it to the function to be tested.
What I don't get yet is how to test the function does really set the field_xyz to 20 ?
I tried
$entity = $this->getMockBuilder(Application::class)
  ->disableOriginalConstructor()
  ->getMock();
$field = $this->getMockBuilder(FieldItemListInterface::class)
      ->disableOriginalConstructor()
      ->getMock();
$field->expects($this->any())
      ->method('__get')
      ->with('value')
      ->willReturn(10);
$entity->expects($this->any())
  ->method('get')
  ->with('field_xyz')
  ->willReturn($field);
$result = $this->service->changeEntityField($entity);
$this->assertEqual($result->get('field_xyz')->value, 20);

but it returns 10. How do I mock the ->set() methods of the entity? Or do I have to work with real entities and not mocks in such cases?


texts: How to resolve the MySQL error Duplicate entry 'comment_publish_action' for key 'PRIMARY'?

texts:
I'm a beginner in Drupal. I want to import my database to my webserver and get this error when trying to do so:

  "#1062 - Duplicate entry 'comment_publish_action' for key 'PRIMARY'"

I don't know how to fix this error.

Here are more details about it:

  INSERT INTO actions (aid, type, callback, parameters,
  label) VALUES ('comment_publish_action', 'comment',
  'comment_publish_action', '', 'Publish comment'),
  ('comment_save_action', 'comment', 'comment_save_action', '', 'Save
  comment'), ('comment_unpublish_action', 'comment',
  'comment_unpublish_action', '', 'Unpublish comment'),
  ('node_make_sticky_action', 'node', 'node_make_sticky_action', '',
  'Make content sticky'), ('node_make_unsticky_action', 'node',
  'node_make_unsticky_action', '', 'Make content unsticky'),
  ('node_promote_action', 'node', 'node_promote_action', '', 'Promote
  content to front page'), ('node_publish_action', 'node',
  'node_publish_action', '', 'Publish content'), ('node_save_action',
  'node', 'node_save_action', '', 'Save content'),
  ('node_unpromote_action', 'node', 'node_unpromote_action', '', 'Remove
  content from front page'), ('node_unpublish_action', 'node',
  'node_unpublish_action', '', 'Unpub[...]


texts: How include oun TPL in /admin/structure/types/manage/

texts:
I need to show this form by my oun .tpl. But i didnt undestand how i can do this.
Can anybody help me?

the function work by url (/admin/structure/types/manage/type)
but it give me default form generator.

function admt_form_node_type_form_alter(&$form, &$form_state) {
  $default_value =TRUE;// auto_nodetitle_get_setting($form['#node_type']->type);

  $type = $form['#node_type'];
  $form['#theme'] = 'admt_form_theme_function';
  $form['admt'] = array(
    '#type' => 'fieldset',
    '#title' => t('Graffic User Interface'),
    '#weight' => 0,
    '#collapsible' => TRUE,
    '#collapsed' => false,
    '#group' => 'additional_settings',
    //'#theme' => 'admt_form_theme_function',
    '#attached' => array(
      'js' => array(drupal_get_path('module', 'menu') . '/menu.admin.js'),
    ),
  );

    if (isset($type) && $type->has_title) {
    $title = $type->title_label;
    }
    $fields = array();
    $arrFieldsType=array(
    "number"=>"textfield",
    "text_textfield"=>"textfield",
    "options_select"=>"select",
    "taxonomy_autocomplete"=>"textfield",
    "text_textarea_with_summary"=>"textare",
    "image_image"=>"file",
    "checkboxes",
    "radios"
    );
  $instances = field_info_instances('node', $type->type);
  $extra_fields = field_info_extra_fields('node', $type->type, 'form');

  // Fields.
  foreach ($instances as $name => $instance) {
    $form['admt'][$name] = array(
    '#type' => $arrFieldsType[$instance["widget"]["type"]],
    '#title' => t($instance["label"]),
    '#default_value' => array('value' => '...'),
    //'#options' => $type2,
     );
        if($arrFieldsType[$instance["widget"]["type"]]!="select") $form['admt'][$name]['#size']= '20';
  }

  // Non-field elements.
  foreach ($extra_fields as $name => $extra_field) {
    if(!empty($extra_field["type"]))
    $typ=$arrFieldsType[$extra_field["type"]];
    else
    $typ="textfield";
    $form['admt'][$name] = array(
    '#type' => $typ,
    '#size' => '20',
    '#title' => t($extra_field["label"]),
    '#default_value' => array('value' => '...'),
    '#description' =>  t($extra_field["description"]),
    //'#options' => $type2,

     );
  }
 // drupal_add_js('(function ($) { Drupal.menu_update_parent_list(); })(jQuery);', array('scope' => 'footer', 'type' => 'inline'));

}
function admt_theme($existing, $type, $theme, $path)
{
  return array(
    'mymodule_userinfo_form_theme_function' => array(
      'render element' => 'form',
      'arguments' => array('form' => NULL),
    ),
  );
}


texts: Select only if row not exists in joined table

texts:
I have a db_select that selects row from t_project_proposal_writer table only if in joined t_project_milestone table row with milestone_id 10 is found:

$query = db_select('t_project_proposal_writer', 'p')->fields('p');
$query->innerJoin('t_project_milestone', 'm', 'p.id=m.proposal_id');
$query->condition('p.initiative_nid', $node->nid)->condition('m.milestone_id', 10);

One project row can have 10 milestone rows. Now I need to do another query that selects only the rows from t_project_proposal_writer where milestone_id 10 not exists in joined t_project_milestone.

Is there any other possiblity to do that, instead of query all the projects and iterate throught them while checking if milestone 10 exists?


texts: Contextual Links not appearing in Panels

texts:
I use panels to display almost every page on my website. I display content type article as a panel, configured from

structure->content type->article->manage display

The contextual link cogwheel is not appearing on the full content type display rendered through panels, whereas it is displayed on the teaser view, rendered on the site home page, also rendered through panels as a panel page. What might be causing the error? Is there a workaround?


texts: Private files won't be saved anymore in their intended location? (D7)

texts:
I've got a D7 installation for some time now, with a content type that has a "private file" field.

It was working just fine up until now.

My files usually got uploaded like:
http://....com/system/files/curso/file.txt
And they get saved inside: .../files/private/Private - accessible only to group members/[nodeid]/file.txt

Now I've created a new node with an uploaded private file: demo.txt

When its downloaded it gets this path:
http://....com/system/files/curso/demo_1.txt

But I get "Not Found" when I click it because it gets saved in other location (?): .../files/private/curso/demo_1.txt

Notes

The _0, _1 etc are automatically added to the files when they are saved into the node.
I've tried accessing the file from its real location (.../files/private/curso/demo_1.txt) with no luck.
The "files" folder is directely inside public_html because the original setting was that way (the site comes from a D4.7, D5 and then  a D6 installation).
It worked just fine with other files up until now. I've not done anything special (like installing new modules), except creating a few new node types and rebuilding the permissions.

What could I do? (BTW, I've read this information, and sadly it didn't helped).

Update - Error Logs:

[Mon Mar 02 12:37:40 2015] [error] [client 181.28.74.188] client denied by server configuration: /home/sitio/public_html/files/private/curso/demo_1.txt
(I've found more info about this here)


texts: How to move the comment form to the top?

texts:
Per default in Drupal 8 the comment form is rendered below the comments. In Drupal 7 you could move the comment form from the bottom to the top by modifying the comment-wrapper.tpl.php.

Is there also a way in Drupal 8 to get this functionality?


texts: overriding template file of display suite layout applies on other pages

texts:
I created a display suite layout "tow column stacked" in manage user section, then I want to override that template, and make a new one in my theme templates folder,
the ds module suggest for me :

  ds-2col-stacked--user.tpl.php
  ds-2col-stacked--user-user.tpl.php

so I created ds-2col-stacked--user-user.tpl.php in my templates folder, but this template is overriding as well the registration page!

how can override with the correct name, to apply this new template only for user edit account page ("/user/%/edit") ?

Thanks in advance.


texts:
I am using the FAQ module in drupal7. My website has many pages which should have a FAQ of their own. So adding FAQ from "Add Content" adds and lists all the FAQs in different categories in the "faq-page". For example, I have two applications so i need dedicated faq page for application 1 and 2.

Is this possible using the FAQ module ?


texts: How to move installed modules from /sites/all/modules/* to /sites/all/contrib/modules/*

texts:
I have been searching for the answers to this question with no luck at all.
From what I observe in the database structure, the location to the modules are specified in the 'system' table.
The only solution I have is to write an SQL query to update the 'filename' column.

Is there a better/cleaner solution in solving this, for eg., a contrib module?


texts:
I'm trying to use #states in a unlimited field collection (using the field collection module).

I'm adding this functionality to a node add form so am altering form elements using hook_form_alter.

I can get it to work for the first item in the collection using the following code but it doesn't work for items added subsequently.

$form[$k]['field_employee_name']['#states'] = array(
    'visible' => array(
        ':input[name="field_witnesses[und][0][field_person_type][und]"]' => array('value' => 'Employee'),
    ),
);


texts: Custom Entity Not Showing in View Creation UI

texts:
I started learning Drupal 8 this week. I followed this guide to create a new entity, which I then made available through REST using the following tutorial: https://drupalize.me/blog/201401/introduction-restful-web-services-drupal-8

CRUD operations on my entity work just fine. I can also issue my REST requests without any issues. What I'm trying to do now is fetch a list of all my entities via REST. From my understanding, I should create a view for that, but my entity doesn't show up in the view creation UI, so I can't. What do I have to do to make my entity show up there?

I'm not sure what code I should post, so don't hesitate to tell me what code you need to see.


texts: Where should I be storing custom node-related data?

texts:
There are several types of data my website generates for every node. Node's popularity score, node's comment count obtained from a 3rd party API, etc... This data is set for every node.

In the past I've used to just add hidden fields to each node, i.e. field_popularity_score, field_comment_count, etc..., and had the fields updated on hook_cron; but I've ran into an issue. Each time those fields are updated, the node's revision date would change also.

Where should I be storing this data? I'd prefer to stay away from using the standard node fields, as it would break its purpose.

Update

Apparently, per this post, Drupal 5 used to allow storage of serialized data into $node->data.

Update

Interesting enough, Node object reference page lists $node->data as part of Drupal 7. I would love to hear if there is a way to use that field to store serialized data in Drupal 7.


texts: How can I remove the "The image was resized to fit within the maximum allowed dimensions..." message without hacking core?

texts:
By default, Drupal prints out a notification message that images exceeding the maximum dimensions were resized.  I want to disable this message.

The relevant line is located in file_validate_image_resolution():

  drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions)));

Obviously, the quick way to do this is to put two little slashes right before the line.  But I am trying to do this without hacking core.  I copied the entire function into MYMODULE_file_validate_image_resolution(), then commented the lines out, but this had no effect.  What's the right way to do this?


texts: Why is my property being rendered when I don't call render?

texts:
I have a string property, and HTML is getting rendered instead of a string, even though I don't call render where the property is being accessed.

Twig template:

{{ attach_library('mymodule/video') }}

{% if content.video_url|render %}
  <video>
    <source src="{{ content.video_url }}" type="video/mp4">
  </video>
{% endif %}

As you can see, I'm specifying src="{{ content.video_url }}", NOT src="{{ content.video_url|render }}". Still, the rendered HTML is:

<video>
  <source src="
video.mp4</video>
" type="video/mp4">

Why is drupal rendering HTML instead of a string?


texts: how to managed form '#type' => 'text_format' toolbar

texts:
I have a simple form:

$form['module']['name'] = array(
        '#type' => 'text_format',
        '#title' => t('Name'),
        '#description' => $this->t('Some notes'),
        '#required' => FALSE,
        '#default_value' => '',
        '#format' => 'full_html',
        '#allowed_formats' => array('full_html'),
    );

and it gives me:

Which is good, but then, i want to manage the toolbar to remove certain buttons (e.g. only allow bold, italic, and strikethrough and remove remaining)

Can this be achieved from my custom module?


texts: CSS or and JS aggregations all makes site slower!

texts:
It is well known among Drupalists that generally, Aggregation of CSS\JS files should hasten webpage loading times in Drupal... So why the opposite is true for my site this time?

PSI test score for my Drupal 7.37 site after No Aggregation whatsoever: 72/100
PSI test score with CSS aggregation only: 59/100
PSI test score with JS Aggregation only: 70/100
PSI test score with Both file types
aggregation: 67/100

Bottom line: the natural aggregation options do the opposite of their inherit aim --- They are slowing my site instead of hasting it! Any reasons you could suggest for such wired behavior? Thx.


texts: How to make a link type of a news automatically?

texts:
I made a content type what called news, and I have created a list(text) field type to grab the type of news and name it news_type and it's value is Sport, Health, Technology, Economic and others.

I want each of this type comes to a block as a link to all of that type news. Something like below:

and How to make each news type a link?

Some people say you should use View, How to use view for this?
Please describe step by step.


texts:
I need to customize the markup for certain fields in my view. In D6/Views 2 This was possible using the templates specified in Views admin under "Theme information," "Row style output." In D7/Views 3, however, these templates in Theme information come up as .tpl.php, --news.tpl.php, --default.tpl.php, --default.tpl.php, --block.tpl.php, --news--block.tpl.php and adding those templates does not change anything.

I had found an old issue on drupal.org from a previous version, which had been necro'ed to cover this, but I can't find it now. Is this broken, or am I missing something?


texts: How to check the Webform submission values in a twig template

texts:
I have an Webform with an option element, (option_one), with 6 options.

Below this are 2 option elements with 5 and 2 options.

These 2 option elements have a conditional statement to display if the correct option is selected on the, (option_one), option element.

Added email handlers to the form for the site admin and the submitter.

Using the default email format, all display as per the Webforms default email output, with the correct option element hidden as per the coditional statements.

Goal

Build my own twig template to enable me to theme the email using inline styles.

Below is the code used to check for the selected options.

UPDATE

Question simplified:

How to compare a Webform token with a given value in a twig 'if' statement?

{% if webform_token('[webform_submission:values:airports_to_radio]', webform_submission, [], options) == Heathrow %}

Don't want or need to go and build a submit handler via hook_form_alter()

{% if webform_token('[webform_submission:values:airports_to_radio]') == 'Heathrow' %}

{{ webform_token('[webform_submission:values:heathrow_terminals_to]', webform_submission) }}

{% endif %}

{% if webform_token('[webform_submission:values:airports_to_radio]') == 'Gatwick' %}

{{ webform_token('[webform_submission:values:gatwick_terminals_to]', webform_submission) }}

{% endif %}

This works to a point. Both sections of the twig template do not display, so i assume that the syntax is correct, but not using the correct comparison.

Any help to get the correct syntax for the {{ if }} statement would be great, or any links to information on the web would also be great.

Webform source code below.

airports:
  '#type': fieldset
  '#title': Airports
  airports_to_radios:
    '#type': radios_other
    '#title': Airports
    '#options':
      Heathrow: Heathrow
      Gatwick: Gatwick
      Stansted: Stansted
      Southend: Southend
      'London City': 'London City'
      Luton: Luton
    '#options_display': buttons
    '#other__option_label': Hotel
    '#other__title': Hotel
    '#other__placeholder': Hotel
  heathrow_terminals_to:
    '#type': radios
    '#title': 'Heathrow Terminals'
    '#options':
      'Terminal One': 'Terminal One'
      'Terminal Two': 'Terminal Two'
      'Terminal Three': 'Terminal Three'
      'Terminal Four': 'Terminal Four'
      'Terminal Five': 'Terminal Five'
    '#options_display': buttons
    '#states':
      visible:
        ':input[name="airports_to_radios[radios]"]':
          value: Heathrow
  gatwick_terminals_to:
    '#type': radios
    '#title': 'Gatwick Terminals'
    '#options':
      'South Terminal': 'South Terminal'
      'North Terminal': 'North Terminal'
    '#options_display': buttons
    '#states':
      visible:
        ':input[name="airports_to_radios[radios]"]':
          value: Gatwick
  customer_email:
    '#type': email
    '#title': 'Customer Email'
    '#default_value': test@localhost


texts: How to send to redirect to a user after creating a node and display a message?

texts:
I want to be able to re-direct a user after creating a node of a specific content type and then display a message.

How can I accomplish this? Is the best way by using rules modules or custom module ?

With a custom module, I do not know what hook I would have to use in order to trigger after content type is been publish.

I know that I can use the drupal_goto to redirect them + and used the  drupal_set_message to create a notification.

On the another hand, I know that using rules can be used to accomplish some of all this work.


texts: Comment template for specific comment type

texts:
How can I have a comment template (comment.html.twig) per comment type?

The Twig Template naming conventions documentation explains how I can get a comment template per node content type (comment--node-[type].html.twig), but it doesn’t mention comment types.

I have a node content type with multiple comment fields (one for each comment type), so filtering by node content type doesn’t help me.


texts: Email notification via private message module

texts:
I am using private message module to send an e-mail to all users. When I send mail, users can able to see the message in site only after logging in.

There is an email notification settings in private message module. What is the settings to send mail to user using private message?

Below screen shot shows the settings of email notification.


texts: Pass Exposed Filter in Url / Link to Views page with AJAX

texts:
I have a Views with page display of field sets on url

www.foobar.com/specialview

Contains a number of exposed filters with AJAX. - works great.

One of those fields I'm 'Rewrite Results' to a custom link.

That link is build with replacement patterns to form a url containing an argument for this same views page.

www.foobar.com/specialview/?tid_1={{ field_area__target_id }}

As a 'standard' link it works just fine and triggers the appropriate exposed filter, refreshes the page, updates url to drop the / to www.foobar.com/specialview?tid_1={{ field_area__target_id }}
That displays the active filter and results. - works great

However as soon as I add class use-ajax to the link (as per D8 Ajax API doc), the exposed filter is no longer actuated and the page results do not update, and obviously no page load. The exposed filters on the page still works via AJAX.

What am I missing to get AJAX working on my link on the same page, to the same page to trigger exposed filters in the url?


texts: 403 forbidden error when loading images in test server

texts:
Am working with drupal7.When images are loading below error is showing in my test site console:

GET sites/default/files/styles/slideshow_full/public/plans/30989/main-image/contemporary_house_plan_westbrook_30-065_front.jpg?itok=TkUdCJQ5 403 (Forbidden)

When I paste the above URL in browser it is showing that "You are not authorised to access this page" error.

I checked all the permissions and all has 777.
But the same functionality  is working with my local site.Can anyone give me a suggestion to solve this issue?


texts:
recentpost.file

name = recentpost
description = A list of node with thumbnail
package = Liu's custom
core = 7.x
version = 1.0
files[] = recentpost.module

recentpost.module

/**
 * @file
 * Add thumbnail to each node
 */

function recentpost_block_info(){
  $blocks['recentpost'] = array(
    'info' => t('Recentpost'),
    'status' => true,
    'weight' => 0,
  );
  return $blocks;
}

function recentpost_block_view($delta = '') {
  $block = array();
  $block['subject'] = t('Node with thumbnail');
  $block['content'] = 'ssssssssssssssss';
  return $block;
}

I've created a sample module from scratch and can activate it in admin->module, but when I go to structure->block, the block I've just created doesn't show in the list no matter how many times I've cleared the cache both from drupal and the IE. Can anyone help me sort it out.


texts:
Does commerce send an order notification email to site admin (site email) out of the box?

If not how do I do this?


texts: Can I update directly from 7.7 to 7.12?  Or do I have to do 7.7 to 7.8, 7.8 to 7.9, etc?

texts:
I just updated my Drupal website from 7.7 to 7.12, but there were a lot of issues when running update.php.
I was wondering if it is possible to update Drupal 7.7 directly to 7.12, or you have to get 7.8, 7.9, 7.10 and 7.11 before you can update to 7.12.


texts:
Right now I'm at "http://localhost:8080/drupal/xxxx/user/password" and I added an image inside a block like this "sites/default/files/background.jpg"

But I think is wrong because I'm at 2 paths "user/password" and it is not taken my images, in which way can I write the path to access to my images???


texts: Remove items from a menu based on node type efficiently

texts:
I am trying to remove items from a menu based on the type of node it links to.

I'm currently achieving this using hook_menu_link and menu_get_object. I'm running into problems because the size of the menu is 500+ items, resulting in 5000+ DB queries to generate the page.

If I remove the hook_menu_link function and show all menu items, the DB queries drop to around 700.

Here is the current code:

function amoss_menu_link(&$variables) {

  // Hide book sections from the menu;.
  if (isset($variables['element']['#original_link']['link_path'])) {
    if ($variables['element']['#original_link']['menu_name'] == 'book-toc-1') {
      if (book_modifications_is_book_section($variables['element']['#original_link']['link_path'])) {
        return '';
      }
    }
  }

  // Output a menu link.
  $element = $variables['element'];
  $sub_menu = '';

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }
  $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}

function book_modifications_is_book_section($link_path) {

  if (book_modifications_get_type_from_link_path($link_path) == 'book_section') {
    return TRUE;
  }

  return FALSE;
}

function book_modifications_get_type_from_link_path($link_path) {
  $node = menu_get_object('node', 1, $link_path);

  if (isset($node->type)) {
    return $node->type;
  }
  else {
    return '';
  }

}

I tried to use drupal_static in the book_modifications_get_type_from_link_path function, that killed the conditional checks.

I tried caching the results for each item with set_cache, but this was not successful either.

function book_modifications_get_type_from_link_path( $link_path ) {

    if ($cache = cache_get('book_modifications_'. $link_path )) {
        $type = $cache->data;
    }
    else {
        // Do your expensive calculations here, and populate $my_data
        // with the correct stuff..
        $node = menu_get_object('node', 1, $link_path);
        $type = isset( $node->type ) ? $node->type : '';
        // dpm('miss');
        cache_set('book_modifications_'. $link_path, $type, 'CACHE_TEMPORARY');
    }

        // dpm($type);
    return $type;
}

I appreciate any suggestions for making this slow operation faster.


texts:
When I create a new content type, I want to prefill a link field following this format :

/my/specific/link?node_id=<CURRENT_NODE_ID>

Is it possible to access the node id before his creation? Or a specific id to refer to this new content type??

[EDIT]

More details :
I want to add a content type, which is a job offer. In this content type, there is a Link field, that refer to a web form to apply to the job offer. So I need to prefill the link field, with the node ID to know the job you are applying for.


texts: How do I set the default value for results?

texts:
I'm on Drupal 9 and I have an AJAX view with a page display and an exposed filter block and a single filter exposed, "Search: Fulltext search".
The Search API module is configured to search inside 3 different content types: products, articles and authors.
I've also configured a facet to filter on the content type, using a widget type "links", that let filter one content type at time.
So, initially, the search page shows the results of all the three content types.
After users filter a content type, they can switch only to another one and never return to the no content type chosen situation.
What I need to do is that the results are listed by default with one specific content type. If that content type yield no results, the following content type should be used as filter.
If there are no result, just no result should be shown.
In other words, the no content type chosen situation should be never available.
I've tried to force the filter on content type, if missing, using hook_views_pre_view(), but it doesn't seem to work.
Actually, I've no idea if it is the correct approach or I have to work on different hook\somewhere else.
How do I solve this issue?
This is the hook code.
function my_module_views_pre_view(\Drupal\views\ViewExecutable $view, $display_id, array &$args) {
  if ($view->id() === 'search' && $display_id === 'page_1') {
    $active_filters = $view->getExposedInput();
    if (isset($active_filters["search_api_fulltext"]) && !empty($active_filters["search_api_fulltext"])) {
      if (!isset($active_filters["f"])) {
        $active_filters["f"] = ['content_type:product'];
      }
      else {
        $content_type_filter_exists = FALSE;
        foreach ($active_filters["f"] as $facet_filter) {
          $filter_array = explode(':', $facet_filter);
          if ($filter_array[0] === 'content_type') {
            $content_type_filter_exists = TRUE;
            break;
          }
        }
        if (!$content_type_filter_exists) {
          $active_filters["f"] = array_merge($active_filters["f"], ['content_type:product']);
        }
      }
      $view->setExposedInput($active_filters);
    }
  }
  //$view->exposed_raw_input = array_merge($active_filters, (array) $view->exposed_raw_input);
}


texts: I have followed all of the tutorials for implementing a Instagram Feed / Block.  I have the correct client id and client information as requested, however my block doesnt show up when i enable it.  Is there an issue with the Instagram Block?


texts: Using hook_form_alter() to add the "None" value in the select list of a required field

texts:
When a field is required, Drupal removes the default "-None-" value.  However, also for a required field, "-None-" is very valuable as it requires the user to make a deliberate selection (put the first value on the select list as default doesn't force a sloppy user to make a selection).

I need to:

Have "-None-" as default value in the select list of a required field
Not accept "-None-" as field value when the form is submitted

How can I achieve this with hook_form_alter()?


texts:
I am using Drupal 7 and need to make the installer work through a proxy.

I can access the installation through my proxy at https://my.proxy/install.php?profile=myprofile&locale=en, but the JS and CSS files fails to load, Error code(404).

Which files do I need to modify to fix the installation page through the proxy?


texts: How to handle large select lists in content types?

texts:
I need to add a city field for a content type in D7. I'm getting it from a federal census table and it's going to be around 35K+ records. Any thoughts on filtering this list down by state and/or county? Without some kind of filtering, I'm afraid I'll bring Drupal to it's knees. BTW, I can't just use a taxonomy list because I need to key the list on a city ID. I also will have county ID info. So, I really need to filter the counties list to just those for the state the user has selected, then the cities by that county.

Here's the general structure:
User selects
   State ->  County-> ->Cities.

I tried looking at the references module but the reference field I created didn't seem to be filterable.

Thanks for any assistance!


texts: missing cet_enable field in product type settings (Commerce Event Ticket)

texts:
I have installed the Commerce Event Ticket module along with any requirements and have enabled it. I see the following under column description in  admin/modules:

  Allows tickets (with unique barcodes) to be generated for Commerce purchases.

  Version: 7.x-1.0-beta3

  Requires: Entity API (enabled), Commerce (enabled), System (enabled), Rules
  (enabled), Entity tokens (enabled), Product (enabled), Price (enabled), Customer (enabled), Address Field (enabled), Chaos tools (enabled), Line Item (enabled), Order (enabled), Commerce UI (enabled), Checkout (enabled), Cart (enabled), Product Pricing (enabled), Product Reference (enabled), Options (enabled), Field (enabled), Field SQL storage (enabled), Views (enabled), Order UI (enabled), Field UI (enabled), Product UI (enabled), Customer UI (enabled), Views Bulk Operations (enabled)

  Required by: Commerce Event Ticket PDF (disabled), Commerce Event Ticket Mail (disabled), Commerce Event Ticket Services (disabled)

Now, when I add a new product type (commerce/products/types/add) or go to Manage Fields of an existing product type, I do not get an existing field cet_enable. The list of available existing fields in the list box only contains:

<select class="field-select form-select" id="edit-fields-add-existing-field-field-name" name="fields[_add_existing_field][field_name]">
<option value="" selected="selected">- Select an existing field -</option>
<option value="field_link_to_page">Boolean: field_link_to_page (Link to page)</option>
<option value="field_date">Date: field_date (Date)</option>
<option value="field_eventdate">Date: field_eventdate (Date)</option>
<option value="field_price">Float: field_price (Price)</option>
<option value="field_image">Image: field_image (Image)</option>
<option value="field_img">Image: field_img (Image Gallery)</option>
<option value="field_myimage">Image: field_myimage (MyImage)</option>
<option value="uc_catalog_image">Image: uc_catalog_image (Image)</option>
<option value="uc_product_image">Image: uc_product_image (Image)</option>
<option value="field_table_description">Long text: field_table_description (Event Description)</option>
<option value="field_product_reference">Product reference: field_product_reference (Product reference)</option>
<option value="field_tags">Term reference: field_tags (Tags)</option>
<option value="taxonomy_catalog">Term reference: taxonomy_catalog (Catalog)</option>
<option value="field_external_link">Text: field_external_link (External link (leave empty for no link or use abov...</option></select>

How do I get access to the cet_enable field?
This is after a core update to 7.34

I've filed a bug with the module but am also interested in how I can troubleshoot this best myself???
Thanks for hints and tips!


texts:
This is my custom form with three fields,

Image :

CODE :

function planet_extension_form($form,&$form_submit){
$form['url']=array(
'#title' => 'URL',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter the URL'),
'#attributes' =>array('placeholder' => t('www.example.com')),
);
$form['title']=array(
'#title' => 'Title',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter the Title'),
'#attributes' =>array('placeholder' => t('Title'))
);
$form['email']=array(
'#title' => 'email',
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 35,
'#description' => t('Enter you valid email'),
'#attributes' =>array('placeholder' => t('example@example.com'))
);
$form['submit']=array(
'#type' =>'submit',
'#value' => 'Submit',
);

return $form;
}

//email validation
function planet_extension_form_validate($form, &$form_state) {
  if (!valid_email_address($form_state['values']['email'])) {
    form_set_error('email', t('That e-mail address is not valid.'));
  }
}

Just like email validation I want to validate the if the link submitted is RSS feed link, in my custom module.

Thank you


texts:
I have a little issue that How to create file->node relations use relations modules?

In my case:
   I need to create music(mp3) and album relations. After i check some information and said that music(mp3) and album is file->node relations.

But, i don't know that how to do this relations.

when i create a relation type, which bundles need to selected?


texts: Why is my custom module is not listed with the drush command pm-projectinfo?

texts:
If you have drush >= 8 you can use drush pm-projectinfo to show a report of available projects and their extensions. If you use drush pm-projectinfo devel you should see the information about the devel module something like this:

 Name             :  Devel (devel)
 Type             :  module
 Version          :  7.x-1.3
 Status           :  1
 Extensions       :  devel
                     devel_generate
                     devel_node_access
 Drush Commands   :  devel-download
                     devel-reinstall
                     fn-hook
                     fn-view
                     devel-token
 Datestamp        :  1338940281
 Path             :  sites/all/modules/development/devel

I come from creating a custom module named my_custom_module, but when I use drush pm-projectinfo my_custom_module the output is:

 [warning] my_custom_module was not found.

It's very weird because I know that my module works fine, I use it every day, but the command doesn't work.

How can I solve this? Is it a problem with drush or is it a problem with my custom module?


texts: Hyperlinking mutiple file types in content body

texts:
I am designing a website, in which the content of body has several hyperlinks. Following is the sample body-

  This app is now available for android as well, which can be downloaded
  from Google Play. Here you can see a screenshot of this app.
  Some more description about this app goes here. Blah blah blah. A
  manual in PDF format has been attached to the website for getting
  started into this app.

I am using CKEditor with IMCE to upload all these files in server. I have manually created two sub-directories inside upload folder to keep my pdf and image files separate. Below is the screenshot of it-

While uploading pdf file, I select pdf sub-directory. However, inside IMCE profile configurations i.e. admin/config/media/imce/profile/edit/1, the directory path for upload has been given to parent directory. Below is the screenshot of it-

Now, when I try to access these sub-directories from browser, it displays error. Below is the screenshot of it-

Please help me to eliminate this error, also suggest a better way to handle multiple file type while using them as hyper linking.


texts: Automatically Generate PDF from Webform Submission

texts:
First off, this is under Drupal 7.  I'm looking to have the server save a PDF of the submitted webform when a user submits it or updates it (overwriting the old one on update).  So far I've had no success with fill2pdf, views pdf, or entity print modules in getting this accomplished.

I do have the Print module working where I can click a link and download the PDF, but that's only if I take the action.

I figure the easiest way at this point would just be to have a Rules action execute some custom PHP code using the PDF that the Print module is generating.

I'm just not sure what that code would look like.  Basically, upon submission, the Rule would Execute Custom PHP code.  That code would user the PDF generated by the URL (www.example.com/printpdf/[nid]/submission[sid]) and would save that file to a location on the server (going to that URL would save it on the user's local machine) that I would like to use some tokens from the webform for (private files/year/username/node title.pdf).  Preferrably this would all be done in the background so the user wouldn't see it, but if that's not possible redirect the user after saving the webform.

Anyone know how I can accomplish this?  Thanks!


texts:
After creating a vertical tab in my installation profile I keep getting these notices:

Notice: Undefined property: stdClass::$collapsible in field_group_pre_render_tab()

and

Notice: Undefined property: stdClass::$collapsed in field_group_pre_render_tab()

Here is the code I use to make a vertical tab in my installation profile:

$verticalTab = new stdClass();
$verticalTab->disabled = FALSE;
$verticalTab->identifier = 'group_attachments|node|foo|form';
$verticalTab->group_name = 'group_attachments';
$verticalTab->entity_type = 'node';
$verticalTab->bundle = 'foo';
$verticalTab->mode = 'form';
$verticalTab->label = 'Attachments';
$verticalTab->children = array( 1 => 'attachment');
$verticalTab->format_type = 'tab';
$verticalTab->weight = '0';

So am I missing something? or has this notice got nothing to do with the vertical tab and do I have to look elsewhere?

Any help to fix this notice would be appreciated.


texts: Search through a specific field - Drupal 7

texts:
Is it possible with Drupal to create a seperate search field to search in a custom field for a specific content type?

For example I have a text field in a content type with the name keywords. I gave some important keywords for that specific node.

What I want is that a user can search through these words with a custom search field, that is displayed on a specific page.

I know I could use something like exposed filters in views, but it is not working in my case. The reason is the nodes are having a relationship with a taxonomy list. The nodes are showing based on the taxonomy term ID in the URL.

For example, my taxonomy list called 'Jobs'. The terms in the list are
'sanitary', 'interior' and 'garden'.

When I'm on the page with the sanitair, there is a search field. If I search in this field it should take a look for all the nodes not only the nodes that are related with the 'sanitair' term. If I used exposed filters the filter is only searching on the current term, so only the kind of jobs for 'sanitair' are showing up.

Is there a way to do this with or without views and is it also possible to create this search field in a block, so I can use it on different places?

Thanks!


texts: How we can change the Select option into Autocomplete

texts:
I have one search index view for content type, here there are two term reference fields called, category and location.

I added those two term reference fields in that view exposed filter as select options. But i have one stuff here, if i change select options to Autocomplete filter means i couldn't see the view results, just blank page is coming.

So i needs to make those Select options to Autocomplete in hook_form_alter.

Please help me to solve this stuff.


texts:
I have a taxonomy attached to my nodes. The taxonomy has an extra image field attached to it. I can find the taxonomy title field at:

$content['field_news_outlet'][0]['#title']

but I can't seem to find the image field I attached to this taxonomy.

If I check with kpr() or dpm():

$term=taxonomy_term_load($tid);
$value=field_get_items('taxonomy_term',$term,'field_news_outlet_logo');

I can see the field name there but the image uri doesn't seem to appear anywhere in there. The only image uri I can find is the one for the site's logo.


texts: Views & colorbox trigger, make the colorbox image adapt to screen size

texts:
When I use a colorbox-trigger to open a colorbox, I have to specify the  width  and height of the overlay - unlike in a regular colorbox image field, where it adapts nicely to the screen size.
Is there any way to get such a feature in views?


texts: node/add/[content-type] redirects to front-page

texts:
I have 6 content types set up on my site: Article, Artefact, Basic Page, Link, Persona, Quote. All the rest work, but the link to add Quote just redirects to front-page, and I can think of nothing that can cause this behaviour.

node/add/quote -> [front-page]

I've tried clearing cache, running cron, deleting and regenerating paths/clean URLs site-wide. I've also tried all sorts of ways to access the URL including typing by hand into the address bar, but all have led to front-page.

I'd be super-grateful if this can be resolved.


texts: How to show translated taxonomy terms in a view?

texts:
I have used the Views module to create a view of taxonomy terms.

The taxonomy terms are translated in the Greek language also (apart from English), using the typical i18n modules.

But when I switch the language to Greek (while visiting the site), still the English taxonomy terms are appearing (and not the terms in Greek).

How can I solve this?


texts: How to set the title of a modal window in Drupal 7

texts:
I am using the following code to create a new page, which is rendered as a modal window by using a link with the ctools modal attributes:

$items['mymodule/%ctools_js'] = array(
    'page callback' => 'mymodule_callback',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
);

Notice that the type is MENU_CALLBACK. I would like to set a title to the page, because the full page is accessed by Googe via mymodule/nojs/ctools_js, and it displays no title. I have tried with the following two added first lines of code, but it does not do anything. Also with drupal_set_title in the callback function it didn't work.

 $items['mymodule/%ctools_js'] = array(
   'title' => 'some title, please! ',
   'title callback' => 'mymodule_title_callback',
   'page callback' => 'mymodule_callback',
   'page arguments' => array(1),
   'access callback' => TRUE,
   'type' => MENU_CALLBACK,
 );

I think it is an obvious question, but I don't manage to make it work. I am not sure if this is because of the type (ajax) menu page or whatever other reason.


texts: How to prevent a site from ever using experimental core modules?

texts:
Quote from Experimental modules in Drupal 8:

  Drupal 8 core introduces the concept of experimental modules. These are modules that are provided with Drupal core for testing purposes, but that are not yet fully supported. Experimental modules are included in the Core (Experimental) package on the Extend page of a Drupal site (/admin/modules).

I do understand what "testing purposes" means, and I'm aware of best practices like having a Dev / Staging / QA / Prod configuration.

But when using Drupal 8 in a Prod environment, I'm looking for a way to ensure to a site owner something like "You can be 100% that there is no way that any of these experimental modules can ever be enabled in the prod version of your site.". Imagine it's about a business critical Drupal site where "testing in production" is not ever allowed.

So what options do I have in Drupal, apart from hacking core (which is not an option), to be 100% sure of this? And so that:

It applies for "everybody" (any user), so even user/1 should not be able to do so if (s)he'd be tempted to do so.
It doesn't matter if you're using the Admin UI, Drush, Console or anything similar

Update

There are some D8 core issues about these experimental modules, which IMO are either related, or contains some inspiring comments for finding a possible solution (work around?):

Remove experimental modules from core (or treat them like first class modules).
[meta] No definition of "Experimental" & not nearly enough warning, with proposed solutions detailed in these related issues:

Experimental modules should have their own version numbers.
Use a confirmation form when enabling experimental modules.
Provide a link to the experimental module policy in the status report warning.
Warn about experimental modules on their help pages.


texts:
I have a custom almost empty module where I'm tring to insert a js file using hook_libraries_info(). But when I load the home I don't see my script inserted. It works when I use a simple drupal_add_js.
What I'm doing wrong? I've seen other examples like masonry and nivo-slider and those are similar. Do I need to init somehow? I'm new at module development, so probably is something simple.

DETAILS
Libraries module is enabled:
-  Libraries    7.x-2.1

The location of the library folder is this:
- sites/all/libraries/test/test.js

test.module

<?php
//drupal_add_js('sites/all/libraries/test/test.js'); when uncommented it works

/**
 * Implements hook_libraries_info().
 */
function test_libraries_info() {  // it never works
  $libraries['test'] = array(
    'name' => 'Test',
    'vendor url' => 'http://www.example.com/',
    'download url' => 'http://www.example.com/',
    'files' => array(
      'js' => array(
        'test.js',
      ),
    ),

  );
  return $libraries;
}


texts:
I'm using the Message module to notify users when someone reacted on their nodes. I'm now trying to theme the messages, which are displayed in a view, called 'Message'.

I'd like to link a message to the content that's commented on. In other words: when a user clicks a message, he/she should be linked to the corresponding node's page. I don't simply want the message text to be a link, but the whole message (i.e. also including the other fields) should function as some kind of 'button'.

I think the easiest way to do this is to create a views-view-unformatted--message.tpl.php file and use

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

The problem is that I don't know how to define $url. I can store the needed nid in the message and add it hidden to the view, but I can't find a way to grab that information.

How can I do that?


texts: Apply a promition only on a product variation

texts:
I have a Drupal Commerce product with two variations.

Variation A - 18 euro - SKU 123
Variation B - 30 euro - SKU 234

Is it possible to apply a promotion only on Variation B?

I am using Drupal Commerce 8.x-2.4.


texts: Webform File Upload Error: POST truncated

texts:
We have a simple Webform which contains 2 components, a standard file upload and a text field allowing the user to provide a description.

We are getting the following error from time to time:

POST truncated to 1 input vars. PHP max_input_vars is 2000. Increase
max_input_vars.

The file is successfully uploaded, but sometimes this error causes problems with an additional submit handler We've added. This tends to happen with larger files, but with that being said the last failure was with a 5Mb file, but we've successfully received 6Mb files without a problem so I don't think it's a file size problem.


texts: What is the value of $page['content'] in custom front page?

texts:
I'm a Drupal noob and inherited a Drupal website to maintain. The site has a custom theme, which includes a "page--front.tpl.php" that Drupal loads as the front page. Within this script, there is the following call:

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

This call used to display homepage-view.tpl.php (found under themes//), but I upgraded some modules and changed some settings in an attempt to fix some problems and now it appears to be showing all nodes, (there is a pager for /node?page=X in the section rendered by that print statement).

My guess is that $page['content'] is returning /node. Either /node pointed to homepage--view.tpl.php before or $page['content'] returned the value of homepage--view.tpl.php. Either way, how can I get the old behavior back?

Thanks in advance.


texts: Update warning: "Some of the pending updates cannot be applied because their dependencies were not met." Followed by "No pending updates."

texts:
I inherited a site from a previous webmaster (who doesn't seem to have known what he what doing) last month and I have been trying to fix it up since then, but one pesky update issue won't go away. Whenever I run update.php, it goes through halfway and then stops with the following messages:

✓ Verify requirements(done)
✓ Overview(done)
▶ Review updates(active)

Warning message

Some of the pending updates cannot be applied because their dependencies were not met.

Status message

No pending updates.

• Front page
• Administration pages

I've been getting this error message for some time now whenever I run update. Some searching revealed that uninstalling and reinstalling the affected module might fix the error, but I can't figure out where it is coming from, or which module could be causing it. Is there any way to find out which module is causing this error without uninstalling and re-installing every single module on the site?


texts: How do I combine title and body as a filter programmatically?

texts:
Attached upon the existing exposed filter, this code enables title and body to be separately selected and to be searched separately but it needs the addition of 'all' option. I have difficulty joining title and body or adding an additional field to the query array or the add_where() line to bring out the result. Is there a way to solve this?

function combine_search_views_query_alter(&$view, &$query) {
if ($view->name == 'news' || $view->name == 'announcement' || $view->name == 'investment') {
    $conditions = &$query->where[1]['conditions'];

if (!empty($view->exposed_input['search_box']) && $view->exposed_input['search_within'] == 'all') {
}
if (!empty($view->exposed_input['search_box']) && $view->exposed_input['search_within'] == 'title') {
// Add title filter condition if title is selected
    $query->where[1]['conditions'][] = array(
      'field' => 'node.title',
      'value' => '%' . $view->exposed_input['search_box'] . '%',
      'operator' => 'LIKE',
      );
}
if (!empty($view->exposed_input['search_box']) && $view->exposed_input['search_within'] == 'body') {
// Create join with field_data_body table.
// source:
// https://api.drupal.org/api/views/includes!handlers.inc/function/views_join%3a%3aconstruct/
// https://www.drupal.org/node/2049051#comment-7784967
    $join = new views_join;
    $extra = array();
    $extra[] = array(
      'table' => 'field_data_body',
      'field' => 'entity_type',
      'value' => 'node',
      'operator' => '=',
      );
    $extra[] = array(
      'table' => 'field_data_body',
      'field' => 'deleted',
      'value' => '0',
      'operator' => '=',
      );
    $join->construct('field_data_body', 'node', 'nid', 'entity_id', $extra);
// Add join to query; 'node' is the left table name
    $view->query->add_relationship('field_data_body',$join,'node');
// Add fields from table (or where clause, or whatever)
    $view->query->add_field('field_data_body','entity_id');
// Add body filter condition if body is selected
    $query->where[1]['conditions'][] = array(
      'field' => 'field_data_body.body_value',
      'value' => '%' . $view->exposed_input['search_box'] . '%',
      'operator' => 'LIKE',
      );
}


texts: I created a site that allows people to create user accounts, login and communicate with other users, or view certain content. The site is completely finished accept for one thing. I am worried that users are going to get confused, or not know about all of the features that are on the site, so what I wanted to do, was to create a walk through tutorial of the site. I noticed there is a module for Drupal 6 that looks like it does almost exactly what I am trying to do, but I can't seem to find anything similar for Drupal 7, and I was wondering if anyone else has had any better luck. Also, I am I don't want the tutorial there permanently. I want it only there for the first few times that the user logs in, and then after that, to simply have a link saying "take site tour" on the bottom. Does anyone know of a module that can do that?


texts:
How can I get the list of the folders inside public:// (or sites/default/files) location?

I have to show all the folder names to users, so that they can choose the subdirectory where they prefer to upload their documents.

I tried with the following code, but it returns the path together the folder name.

$directories = glob($somePath . '/*' , GLOB_ONLYDIR);

The value returned from my code is similar to the following one.

    [0] => sites/default/files//folder_name
    [1] => sites/default/files//new1
    [2] => sites/default/files//newfolder


texts: Block not displayed on translated views page

texts:
I'm having an issue where my menu block doesn't appear on certain pages in a different language.

I have my main navigation shown in a menu block and it appears on my news view at mysite.com/consumers/news/year/2015 and articles at /consumers/news/article-title

The problems is there is content in other languages and the block does not appear on /fr/consumers/news/year/2015 nor /fr/consumers/news/test-fr-article

The block is not restricted to any users, roles, languages or content types. The visibility filter is set to Only the listed pages

consumers*
fr/consumers*

but it just doesn't show up on those specific French pages for some reason.


texts: Drupal site menu overlay stuck in Chrome Browser when scrolling down

texts:
I noticed a strange behavior in my drupal Portal when using Chrome. There is an overlay at the top of the page. In Chrome, that overlay gets “stuck” on the page and you can’t easily get rid of it, and it starts constantly flickering. If I refresh its fine and when I scroll down the problem appears again.

Any help or suggestions are appreciated. Thank you.

Please find the attached screenshot here:

enter code here

.fixed#header {
    position: fixed;
    top: 0;
    left: 0;
    padding: 18px 0;
    width: 100%;
    background-color: #fff;
    background-color: rgba(255,255,255,.95);
    -webkit-box-shadow: 0 2px 3px rgba(0,0,0,.2);
    -moz-box-shadow: 0 2px 3px rgba(0,0,0,.2);
    box-shadow: 0 2px 3px rgba(0,0,0,.2);
    transform: translateZ(0);
}
style.css?onmqdt:859

header {

z-index: 99;
padding-top: 40px;
background-color: #fff;

}


texts: Enable CSS files in Omega 3 sub theme with Drush?

texts:
Is it possible to enable CSS files in an Omega 3 sub theme with Drush?

Im working locally and regularly importing the latest database from live. I have a build script that I run to clear cache, enable modules im using etc. However im manually enabling the CSS files in my theme each time. Can this be added to the build script?


texts:
I've installed the pathauto module. I have a content type article. When I'm trying to create an article, the path is created automatically in the form content/article-title, that is fine.

However, I want to pass some dummy values via url like content/article-title/value1, content/article-title/value2. So now I have multiple aliases for the url.  I will create some functionality using this dummy value.

If I try to access node/10/value1, I can access the page. But I want to access with path alias like content/article-title/value1.

How can I access a page using content/article-title/value1, content/article-title/value1 and content/article-title?

I don't need to create multiple path alias for url. But I need to access page using above urls.

Is it possible?

Answer:

Eventually, I got the solution for this. Please refer http://www.phponwebsites.com/2016/08/drupal-7-pathauto-multiple-url-alias.html


texts: What complications are there if I switch Mysql to MariaDB? Any Drush issues?

texts: I have a heavy Mysql drupal 7 site and I was thinking about switching Mysql over to Mariadb, but I wasn't sure what issues I would run into. From what I'm reading Mariadb seems to be just a drop in replacement for Mysql and there doesn't seem much to fiddle with. I was wondering if Mariadb would affect drush commands?


texts: Infinite Redirect Loop with PURL and spaces_og

texts:
I created a calendar feature for organic groups, and tried to enable it in a group with spaces_og.  The page refreshes saying changes have been saved but the feature is still disabled.  In the logs, there is a message that purl prevented a redirect loop.

I realize spaces is still in dev with d7.  Is this a known issue?  Did I do something wrong when creating my feature, or is there a better way to create features for use in organic groups?


texts: How to get value from field added in user settings

texts: I am writing a module that performs a redirect based on what value was in a custom field called "field_account_type" that was added in user settings. How do I store this value in a variable within hook_user_login()?


texts: Find out which fields to modify on drupal view for a module

texts:
I would like to implement a hook on a view that grabs the fields that would be displayed and modifies one of the slightly before displaying it.  However, I am stuck at the first part which is just finding out how to view/see the fields that I can manipulated.  Based on a couple of other post I have read it seems like I should use the parseurl_views_pre_render which seems to make sense.  But, I don't even only how to see what the data looks like.

Any pointers or help would be greatly appreciated.

Thanks,
Derek


texts: How to group view by field and display row results below?

texts:
We have a content type Basic Page that is supposed to be grouped by a taxonomy term field Page Type that has the following values below in a view.

How can we setup the view so that the view will display the Page Type in one group and the results in another group? Is this even possible without a hook_preprocess_hook() or custom twig template?

View Setup:

Display: Block (`block_1')
Format: Unformatted
Format Setting: Grouping field nr. 1: Page Type, User rendered output to group rows = true
Show: fields
Show Settings: Inline fields --> Page Type
Fields: Page Type, Title, field_description
Filter Criteria: Published = true, Content type = Basic Page
Sort Criteria: Page Type (asc)

Page Type Values:

Blog
Press Release
Video
Document

Current results:

 Blog

 Page Title1

 Continually negotiate bleeding-edge materials through installed.

 Blog

 Page Title2

 Collaboratively disseminate global customer service for..

 Blog

 Page Title3

 Continually evolve enterprise-wide total linkage through..

 Press Release

 Page Title4

 Energistically productize competitive sources after standards..

 Video

 Page Title5

Professionally implement principle-centered portals without efficient..

 Video

 Page Title6

 Uniquely fabricate high-quality testing procedures with..

Desired results:

 Blog

 Press Release

 Video

 Page Title1

 Continually negotiate bleeding-edge materials through installed.

 Page Title2

 Collaboratively disseminate global customer service for..

 Page Title3

 Continually evolve enterprise-wide total linkage through..

 Page Title4

 Energistically productize competitive sources after standards..

 Page Title5

Professionally implement principle-centered portals without efficient..

 Page Title6

 Uniquely fabricate high-quality testing procedures with..


texts: Admin page not being created with hook_menu

texts:
I created an admin page with hook_menu but the page is not showing.  This is on a fresh Drupal 7.23 install.

function my_module_permission() {
  return array(
    'administer my_module settings' => array(
      'title' => t('Administer My Module Settings'),
      'description' => t('Change settings for My Module.'),
    ),
    'initiate my_module migration' => array(
      'title' => t('Run the My Module function'),
      'description' => t('Initiate the My Module function.'),
    ),
  );
}

function my_module_admin() {
  $form = array();

  $form['my_module_xml_file'] = array(
    '#type' => 'textfield',
    '#title' => t('Local file location'),
    '#default_value' => variable_get('my_module_xml_file'),
    '#description' => t('The path to the XML file to import.'),
  );

  return system_settings_form($form);
}

function my_module_menu() {
  $items = array();

  $items['admin/config/development/my-module'] = array(
    'title' => 'My module migrate settings',
    'description' => 'Change settings for My Module',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('my_module_admin'),
    'access arguments' => array('administer my_module settings'),
    'access callback' => TRUE,
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;

}


texts: Get views contextual filter's argument value in thousand

texts:
I have a Civicrm set up in Drupal 7. I am showing Civicrm data using two different views.

In one of the view I have set contextual filter to get the contact IDs. From another view I am passing contact IDs as the contextual argument.

Now the issue is, the filter is not working for those IDs which are in thousand. For e.g. 1,223.

Further, when i used the Views php module to pass php value to remove that comma, it is creating Ajax internal server error.

Below is the code, I used in views php field.

<?php echo str_replace(',', '', $row->contact_id); ?>

I have checked below link, but that is also not working in this case

Thousands separator (comma) in term id

Please suggest a solution which will work without any ajax issue.