texts: perform action if user is not logged in for 24 hours

texts:
I wrote this script using poor man's cron to send an email in 24 hours if a user has not logged in during that amount of time. It works but I can't figure out why after 24 hours passes the email sends, but then it starts sending again every hour.

function dreamcharts_cron() {
      $now = time();
      $result = db_query("SELECT u.uid, u.mail, u.access
                      FROM {users} u
                      INNER JOIN {users_roles} ur ON ur.uid = u.uid
                      WHERE ur.rid = 4 AND u.uid NOT IN (0,1)");
      $i = 0;
      while($user = db_fetch_object($result)) {
        if ($user->access + 86400 < $now) {

         // drupal_set_message('<pre>' . print_r($user->mail, 1) . '</pre>');
               $message = array(
            'to' => $user->mail,
            'subject' => 'you have not logged in in 24 hours',
            'body' => t('Please log into your Account Today', array('@title' => $title)),
            'headers' => array(t('From') => variable_get('site_mail', ini_get('sendmail_from'))),
               );
              drupal_mail_send($message);
          $i++;

      }
      }
      }


texts: How to group by referenced node in Views GeoJSON?

texts:
Also posted at http://drupal.org/node/1984446

My site has a Building content type, each node of which describes a building on my university campus. The content type includes a Geofield, with a point centered on each building. I also have a Construction content type, each node of which describes a construction or renovation item that might occur in a building or buildings. This includes a Node reference field, which can reference unlimited Building nodes.

I want to output a JSON document describing all construction nodes occurring on campus, grouped by building, and with the coordinates of the building in each group. I originally tried Views Datasource to accomplish this, but it doesn't seem to support grouping by field. Views GeoJSON appears to support grouping on fields, but the nodes aren't actually grouping.

My view currently lists all published Construction nodes, and includes the title and body fields of each node. I also have a relationship for the referenced Building nodes, and I'm including the Geofield from the referenced buildings through that relationship.

My output is like:

{
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [
          -122.48572389942,
          48.73781161338
        ]
      },
      "properties" : {
        "name" : "Wilson Becoming Skyscraper",
        "description" : "
Wilson will be the tallest EVAR!!!
\n",
        "field_affected_buildings" : 1703, // References same building node as the node below, but the non-rendered output is 1703 here and 1720 below
        "field_affected_buildings_rendered" : "Wilson Library"
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [
          -122.48572389942,
          48.73781161338
        ]
      },
      "properties" : {
        "name" : "Energy Services Performance Contract (ESCO) - Wilson Library",
        "description" : "

This project was initiated In order to advance Western’s sustainability goals and reduce our carbon footprint. The project will implement 38 separate facility improvement measures in various academic and auxiliary buildings identified by an energy audit of Western's campus.

",
        "field_affected_buildings" : 1720, // This node references the exact same building as the first node, but this non-rendered output is 1720 instead of 1703. What's up with that? If I render as Node ID, I get the same result in both nodes.
        "field_affected_buildings_rendered" : "Wilson Library"
      }
    }
  ]
}

Note that the two points are identical, because each alert references the same building. What I want is more like:

{
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [
          -122.48572389942,
          48.73781161338
        ]
      },
      "properties" : {
        "name" : "Wilson Library",
        "description" :
            "
Wilson Becoming Skyscraper
\n

Wilson will be the tallest EVAR!!!
\n

Energy Services Performance Contract (ESCO) - Wilson Library
\n

This project was initiated In order to advance Western’s sustainability goals and reduce our carbon footprint. The project will implement 38 separate facility improvement measures in various academic and auxiliary buildings identified by an energy audit of Western's campus.

",
      }
    }
  ]
}


texts: How do I create a landing page that can go to page--front?

texts:
I have two pages, the intro page (page--intro.tpl.php) and the front page (page--front.tpl.php). When you type worldovercomers.church, the front page loads.

How can I set it so when the user visits the website the intro page loads instead (worldovercomers.church/intro)?

I also want to include a link that when clicked goes to the main site (page--front). How can this be achieved?

Please note that I'm a Drupal novice.


texts: How do I compare two strings in a template file?

texts:
The template file I am using contains the following code.

foo is '{{ foo }}'
item.url is '{{ item.url }}'
{% if item.url == foo %}
  equal
{% endif %}

I was expecting this code to output foo is 'test' item.url is 'test' equal, but instead it outputs foo is 'test' item.url is 'test'; the equal part doesn't appear.

The following code works.

{% if 'test' == 'test' %}

This code doesn't work.

{% if item.url == 'test' %}

Why doesn't the code I am using work?


texts: Unable to use pathauto aliases for taxonomy terms in conjunction with views pages

texts:
I'm trying to set up pathauto aliases for a number of vocabularies to work alongside corresponding view pages. However, in doing so, I'm running into a 404s ("The requested page could not be found") when visiting the view's page path on the frontend. I suspect this is due to a conflict (and likely my misunderstanding of the relationship) between the views page paths and the taxonomy term path aliases. Note that I'm going to have a number of unique layouts and field sets for the various vocabularies, which is why I'm trying to create unique view pages and paths rather than the default taxonomy/term/% page.
An example taxonomy alias pattern is recipes/mealtime/[term:name].
Its corresponding view page path is recipes/mealtime/%, and it's configured with the appropriate relationship (taxonomy field on the node) and contextual filter (term name with validation on the appropriate vocabulary). When I use the view configuration to preview with a particular term, I get the expected results.
The issue, however, is that when I visit a path on the frontend, e.g. /recipes/mealtime/lunch, I get a 404. Note that I've ensured that the path aliases have been generated.
What is the proper way to accomplish what I've described?
Many thanks in advance.


texts: Display multiple parent Terms of hierarchical Taxonomy

texts:
I'm running a Drupal7 installation and have a view where I want to list all parent terms for the chosen child terms of a node. I tried the solution described for this Question but can't make it work like I want to display multiple parent terms as well.

For a taxonomy like

parent1
-child1.1
-child1.2
parent2
-child2.1
-child2.2

and 2 Nodes with the first having child1.1, child1.2, child2.1 and the second having child2.2 selected the view should display

Node1Title
parent1 parent2

Node2Title
parent2

I'm grateful for any hints.


texts: Can I use view to filter by fields in referenced node?

texts:
I have 2 node types: Project and Designer.
I have a third node type Contribute with a body that explain the contribute and a field node reference with maximum 2 values that "links" the designer to the project that he contribute.
I can reuse Contribute to link 2 Projects, or 2 Designers, but I can't do this:

In the Designer page I want 2 blocks: one containing the Contribute nodes that link that designer with some Project; one containing the Contribute nodes that link that designer to other Designer s.

With Views I can only create one single block listing all Contribute nodes that links the current node (from URL) to another node, I want to filter from the type or the tags of the nodes referenced in the field.

Thank you.


texts: How to properly alter response from Solr Search Module

texts:
I'm working on Drupal Version 7.22 and I'm trying to modify the results coming from Solr using the hook provided by the Solr Search Module.

The specific hook can be found here: http://drupalcontrib.org/api/drupal/contributions!search_api_solr!search_api_solr.api.php/function/hook_search_api_solr_search_results_alter/7

Here's how I implemented it from the module:

/**
 * Implements hook_search_api_solr_search_results_alter().
 */
function zen_search_api_solr_search_results_alter(array &$results, SearchApiQueryInterface $query, Apache_Solr_Response $response){

  $locations = array();

  $rest = $results['results'];
  foreach($rest as $r){

    $place = $r['fields']['field_business_name'];
    $postal_code =  urlencode($r['fields']['field_business_address:postal_code']);

    $api = 'http://maps.googleapis.com/maps/api/geocode/json?address=' .  $postal_code . '&sensor=false';
    $api_results = file_get_contents($api);
        $data = json_decode($api_results, true);

        if($data['status'] == 'OK'){
            $location = $data['results'][0]['geometry']['location'];

            $locations[] = array(
                'place' => $place,
                'lat' => $location['lat'],
                'lng' => $location['lng']
            );
        }

  }

    $data = array('zen' => array('locations' => $locations));
    drupal_add_js($data, 'setting');

}

So basically what I'm trying to do here is to add the coordinates that I get from the Google  maps Geo-coding API using drupal_add_js.

But I'm getting the following error:

  Recoverable fatal error: Argument 3 passed to
  zen_search_api_solr_search_results_alter() must be an
  instance of Apache_Solr_Response, instance of stdClass given

Any ideas what's wrong here?


texts: How to change the default term path "taxonomy/term/[tid]"

texts:
Am using drupal 7 for my project.

Here am facing for custom url change.

My website url is www.example.com/plans/1. Above url need to change as www.example.com/plan-name.

Pls suggest to me to fix the issue.


texts:
I'm using this code in my batch job:

<?php

function my_module_csv_import() {

  $folder = "csv";
  $files = scandir($folder);

  // define batch array structure
  // NOTE: minimal parameters defined to simplify code
  $batch = array(
    'title' => t('Reading File'),
    'operations' => array(
      array(
        '_my_module_batch_read', array($files_array),
        ),
        ),
        'finished' => '_my_module_batch_finished',
        );

        // set batch
        batch_set($batch);

        // process batch
        batch_process('');

        return '';

}

function _my_module_batch_read($files, &$context) {

  variable_set('site_offline', '1');

  // define batch limit
  $batch_limit = 500000;

  // assume the batch process has not completed
  $context['finished'] = 0;

  foreach($files as $csv_file_path) {

    // open the file for reading
    $file_handle = fopen($csv_file_path, 'r');

    if ($file_handle){
      // check if file pointer position exists in the sandbox, and jump to location in file
      if ($context['sandbox']['file_pointer_position']) {
        fseek($file_handle, $context['sandbox']['file_pointer_position']);
      }

      // loop through the file and stop at batch limit
      for ($i = 0; $i < $batch_limit; $i++) {

        // get file line as csv
        $csv_line = fgetcsv($file_handle);

        // NOTE: at this point, do what ever you'd like with the CSV array data!
        if (is_array($csv_line) && isset($csv_line[0]) && isset($csv_line[1])) {
          // DO STUFF
        } else {
          dpm("PROBLEM READING LINES");
        }

        // retain current file pointer position
        $context['sandbox']['file_pointer_position'] = ftell($file_handle);

        // check for EOF
        if (feof($file_handle)) {
          // complete the batch process
          $context['finished'] = 1;

          // end loop
          break;
        }
      }
    }
  }

  $context['finished'] = 1;

}
?>

it works fine, but sometimes it breaks.
The $csv_line results to have PROBLEM READING LINES and I get
 warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument.
I can't figure out how this could be possible, since the csv is correct.
Can anyone point me in some solution?


texts:
I use the Webform module to get user information, and I want to use some Webform fields in a view; for example, I want to show only some of the fields  (e.g. name and e-mail), and expose a filter for the user's email.

How do I create it?


texts:
I am using views along with solr search api to display search results. Within results I need to add filters so I have used views exposed filter for the indexed fields. Now that I have exposed filter I am trying to reset all views exposed filters every time when someone tries to search something in the search field.

How do I achieve this?

I am using Search: Fulltext search (exposed) exposed filter to search for keywords using views.


texts: Default statistics module. Count views of only published nodes when administration users see it

texts:
I need to change default functionality of statistics module.

I want to count views of only published nodes by administration users too. I can't find any hook for this.

Now if administration user see unpublished node, counter is increased.

Is this possible without hacking a core?


texts: duplicate entry on using commerce_product_ui_product_type_save()?

texts:
Reference to the code https://www.drupal.org/node/1059624#comment-4083864

 $product_type = commerce_product_ui_product_type_new();

  $product_type['type'] = 'prestation';
  $product_type['name'] = t('Prestation');
  $product_type['description'] = t('A basic prestation.');
  $product_type['is_new'] = TRUE;

  commerce_product_ui_product_type_save($product_type, FALSE);

When I execute the folllowing code given above I get a

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry 'prestation' for key 'PRIMARY': INSERT INTO
  {commerce_product_type} (type, name, description, help, revision)
  VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] =>
  abcs_new15 [:db_insert_placeholder_1] => abcs new15
  [:db_insert_placeholder_2] => abcs new15 [:db_insert_placeholder_3] =>
  [:db_insert_placeholder_4] => 1 ) in drupal_write_record() (line 7239
  of


texts: Where to add CSS and Javascript directives so they are inserted into the header?

texts:
I am attempting to make use of a jQuery script that will enable a "slider" or "slideshow" on my Drupal 7 front page. The instructions for the jQuery plugin (called FlexSlider) say to insert the following items into the header of the page where I want to use the plugin.

<!-- Place somewhere in the <head> of your document -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">`</script>
<script src="jquery.flexslider.js"></script>

The problem is I don't know where in my template file I place these directives. I am using a custom front page for Drupal so I have a template file named page--front.tpl.php. Do the directives go in there or some other location?


texts: Is it possible to use search api indexs together?

texts:
I'm trying to create a search page for forum topics. Forum topics however are both posts and the comments attached to them, unlike other content the comments and actually posts are just as important to search.

I have an index of all forum posts and one of all forum comments. I'd like to be able to have both searchable from one page. Maybe even if it's possible then I'd like to have one index that handles all of them. But if that is not possible then is it possible to combine two index's in search api into one page search?

I'm not finding anything on this so far, but will keep looking. If I find something before I get an answer I'll post it here.


texts: Instalation throws 502 gateway error while connecting an external oracle database server

texts:
I need to install Drupal 7.34 on nginx web server with oracle 12 as database.

Oracle is listing in DB list. But after submitting the DB and server details, it fails. I am posting the error that I got while submitting the DB data.

[error] 963#0: *56 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: <ip>, server: , request: "POST /install.php?profile=standard&locale=en HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "<ip>", referrer: "http://<ip>/install.php?profile=standard&locale=en"


texts: Cannot Disable User Programmatically With user_cancel()

texts:
I want to disable user using user_cancel method.

//A function that disables a user.
function myid_admin_disable_user(){
    try{
        $edit = array(
            'user_cancel_notify' => true,
        );

        $method = 'user_cancel_block';
        //5 is the user id of the account I want to disable.
        user_cancel($edit, 5, $method);
        echo true;
    }catch(Exception $e){
        echo false;
    }
}

After running the function above, I can still use the account which is supposed to be disabled. Why? Whats wrong in my code above?


texts: create link for URL-based text field in content type

texts:
Drupal 7 question: In my Events content type, I have a text field called RSVP URL. On the event page, it currently displays as

RSVP URL: http://example.com

However, I would like it to be a link, displaying like so:

RSVP URL: http://example.com

I'm not seeing a way to do this, except perhaps via adding the Link module?, but I'm a newbie who's never even installed a module before, and I'm wondering if there's another built-in way. Thanks.


texts:
I am developing a custom module and I want to write debugging output to a log file so I can monitor it in real time, and not wait to navigate to watchdog.

I was using file_save_data() to write to the public file system, but quickly noticed that it was making log1.txt, log2.txt, log3.txt, etc. I want all my log messages to go into the same file. I looked at the documentation, and saw that the only flags that exist are FILE_EXISTS_REPLACE, FILE_EXISTS_RENAME, and FILE_EXISTS_ERROR. Sadly for me, no FILE_EXISTS_APPEND.

What is the drupal way to append data to a file on the file system? Or should I just use native php functions?


texts: Get node data from entity reference field

texts:
I have an entity reference field to a content type blog. I referenced a specific blog, but when I render that field in twig using {{ content.field_blog }}. I want to get the autor name and time when that blog was created - not the blog's name by default. Field is in paragraph.
I would like to do this using twig, so without any preprocesses.

How can I do that?


texts: Creating a new content type places random options on the content type page

texts:
I've created a new content type with multiple radio buttons.

Like this:

  1) Is this your first survey?
      o yes   o no
      2) Is the color yellow?
      o yes   o no
      3) Tomorrow is friday?
      o yes   o no

But when I go to the content type page I see this:

  1) Is this your first survey?
      o yes   o no
      > Authoring information
      2) Is the color yellow?
      o yes   o no
      3) Tomorrow is friday?
      o yes   o no
      > Publishing options

The "Authoring Information" and "Publishing options" just appear randomly, and they don't exist in the "manage fields" area. Where are these options coming from?


texts: Import Data with Commas into Term Reference Field

texts:
I'm having some difficulties to use feeds to import data that with commas.

I have a content type named device, and device has a field named features. features is supposed to be checkbox type which allows users to select multiple options from the provided list like A, B, C, D and the field type is term reference

I'm using feeds to map features column from a csv file to the features of device. When I do the import, instead of importing A, B, C, D separately, it created a new option as A, B, C, D altogether.

Is there anyway to separate them?

Thanks


texts:
My company has taken maintenance of a Drupal website where there are some modules that have been specifically developed for this site.

I have to answer to a question that most software do: how can we do "software testing" and "regression testing" with Drupal?


texts: How to change "add to comment" in comment form?

texts: When CCK was not in core, as in Drupal 6, and you selected a node type for comments on other node types, the comment form would say the name of the content type instead of comment. In this case, I want the comment form to say 'Add New Review' instead of 'Add New Comment'. Does anyone know how to do this through a module or configuration?


texts: unable to migrate site from one server to another

texts:
I have to migrate as site from one server to another. I exported the databaseusing MySqladmin which I also used to import the db on the new server, I copied all files over but I keep getting errors like:
Fatal error: require_once(): Failed opening required '/home/quaaout/public_html/drupal-7.43/sites/all/modules/rules/modules/events.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/quaaout/public_html/drupal-7.43/sites/all/modules/rules/rules.module on line 9

so I tried loading the latest drupal 7 core 7.43 but I get exactly the same. I then tried to erase that one module rules but I got the error for the next, I deleted and the same error would popup for modules rules, apps, contentanalysis,kwresearch (which I deleted one after the other) but after the last one I stopped and thought there must be another way to get rid of this error, but how? Please advise!
Thanks!

EDIT1

And then since I updated my db version, I tried to call update.php but that won't work i.e. the server returns nothing, I get an empty page in firefox and Chrome says: The  page isn’t working

EDIT2

What I also tried is: wget --ftp-user=USER --ftp-password=PASS -r ftp://ftp.myolddomain.com/ . to download the complete site the new host but I still get Fatal error: require_once(): Failed opening required '/home/quaaout/public_html/ftp.quaaoutlodge.com/sites/all/modules/rules/modules/events.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/quaaout/public_html/ftp.quaaoutlodge.com/sites/all/modules/rules/rules.module on line 9 when trying to access the page through the new domain...

EDIT 3

Okay, seems like the initial wget command didn not catch all the files and I had to re-copy the sites/all/modules/ and sites/all/themes. Seems like I've caught everything now. I'm not sure why this would not have worked initially.
Manoj Bisht, please return and add your comment as answer to get the credit you deserve, after all, I only started checking for the files within the modules & themes directories after you told me to...


texts:
I'm using the Facebook connect module to give the users the possibility to log in in my website with their Facebook account. The configuration of the module is good, but when I click on "Log in to NameSite with Facebook account" I get this error message:

  Fatal error: Call to a member function getLoginUrl() on a non-object in fbconnect.pages.inc on line 230

I am using Drupal 7.


texts: how to make URL aliases of nodes created via form include node title of original page?

texts:
Say I have a content type called "X", and every node of Content type "X" has a form that will create content type "Y"

How do I go about setting up the URL alias of content type "Y" so it will be something along the lines of "www.drupal.com/(Node title of X)/(Node title of Y).com

Thanks for any help!


texts: How to use Subtitles/Captions with MediaElement.js module

texts: Would anyone have some direction to upload subtitles/captions using the MediaElement.JS module?


texts: Internationalization -- impact on other modules?

texts: I installed the internationalization module because the site I'm developing is in a different language, but I can no longer index the site in Drupal's search engine, and Tagadelic isn't working either. I'm assuming all of these issues are somehow related but I'm actually not entirely sure... is there anything specific I need to do when I install the internationalization module to ensure other modules keep working are compatible with other languages?


texts: How to programmatically know a required select list has no value on node add/edit form page?

texts: For a required field using select list widget, if there is no options, the field will show only one "-Select one-"  value on the node add/edit form page. So, how to know that by coding?


texts: Custom service returns "401 (Unauthorized : Missing required argument merchant_id)"

texts:
I'm trying to call a custom service module, but it shows 401.

resource:

$resources =  array(
    'get_contacts' => array(
      'operations' => array(
        'index' => array(
          'help' => 'Get customers and their contacts',
          'file' => array('type' => 'inc', 'module' => 'sync_contacts', 'name' => 'resources/sync_contacts.resource'),
          'callback' => '_get_customer_contacts',
          'args' => array(
            array(
              'name' => 'merchant_id',
              'type' => 'int',
              'description' => t('Get customers and their contacts by merchant_id.'),
              'source' => array('data' => 'merchant_id'),
              'optional' => FALSE,
            ),
          ),
          'access callback file' => array(
            'type' => 'inc',
            'module' => 'drupalgap',
            'name' => 'drupalgap.resource',
          ),
          'access callback' => '_sync_contacts_access',
          'access arguments' => array('view'),
          'access arguments append' => TRUE,
        ),
      ),
    ),
  );

Service function:

function sync_contacts_get_customers_list(options) {
  try {
    options.method = 'GET';
    options.path = 'get_contacts.json';//'.json' removed and tested also
    options.service = 'sync_contacts';
    options.resource = 'get_contacts';

    Drupal.services.call(options);
  }
  catch (error) {
    console.log( error);
  }
}

Service function call:

try {
    var my_args = {
        merchant_id: 1
    };
    sync_contacts_get_customers_list({
      data: JSON.stringify(my_args),
      success: function(result) {
        drupalgap_alert("SUCCESSSS");
        $("#contactList").append(JSON.stringify(result, null, 2));
      }
    });
  } catch (error) { console.log(error); }

POSTMAN:

This is how I used the custom service. when I execute it, it shows "401 (Unauthorized : Missing required argument merchant_id)".

How can I fix this issue?

SOLUTION: Used Tyler's resource in his answer below and service call modified as below(changed GET to POST and path modified accordingly).

Note: To test, in POSTMAN also we have to call with POST and pass the merchant_id as Raw ie. {"merchant_id": 1}

function sync_contacts_get_customers_list(options) {
   try {
     options.method = 'POST';
     options.path = 'sync_contacts_resources/get_contacts';
     options.service = 'sync_contacts';
     options.resource = 'get_contacts';

     Drupal.services.call(options);
  }
  catch (error) {
    console.log( error);
  }
}


texts: Send email to webform submissions when new content is created

texts:
I have a webform on my site, which collects names and email addresses, for the purposes of receiving content updates. When a new piece of content of a specific content type is added, I want to be able to send the email addresses collected in that webform a message, letting them know that new content has been added.

I've been able to set up rules to send a notification to one specific email address. However, I am struggling with sending to the email values collected in the webform.

I've added the Webform Rules module, and have PHP Filter turned on. However, I'm unable to send. Any help, or PHP code to accomplish what I'm looking to accomplish would be greatly appreciated!

Thanks in advance!!


texts: How to treat users as Anonymous in Confidential Groups?

texts:
Here is my problem.

Mark an Organic Group as Confidential Group while creating it.
Users will be asked with a question saying would you like to be Anonymous while joining Confidential Group.
If user opted for Anonymous then all the content and activity inside group will be shown as Anonymous user as Author in front end but who posted details will be tracked in back end with user details. So, Technically Content Author is author of the node, but Author field should be shown as anonymous in front end !

This will be useful in Sensitive Groups where user identity should be hidden.

Any hooks or out of the box modules or solutions for above three problems ?


texts: twig problem, how to override base templates?

texts:
I have installed Bootstrap and the Radix theme, and created a sub-theme, which is all working OK. But I am unable to get some of my twig files to override the base theme twig files...

The file themes/custom/mytheme/templates/page/page.html.twig contains:
{% embed '@radix/navbar/navbar.twig' with {

I would like to create a navbar.twig in my subtheme and use that instead of the standard radix one. Changes I make to themes/contrib/radix/src/components/navbar/navbar.twig will show up on my site (as this is what the embed refers to), but changes to themes/custom/mytheme/src/components/navbar/navbar.twig do not.

How can I change that embed line so that it includes the subtheme twig rather than the base? It's some kind of twig namespace? I have not been able to figure out where it is defined.


texts: Clean way of receiving image_dimensions after applying image_style

texts:
I'm quite a Drupal-Newbie and am wondering what would be the best way to receive the dimensions of an image after applying some styles.

I have the URI of the image before the style and absolute URL after applying the style with image_style_url


texts:
I am using bootstrap 3.6 sub-theme/cdn, I've added scripts[] = js/custom.js and I can see it in the source code of the page.

But... javascript is not working.
I copied some javascript code modules to test and from my custom.js and still does not work.

how I can run my code javascript in my sub?


texts:
Is it possible for an application (e.g. a Java Web app) to authenticate against the Drupal users table?  I know they use an SHA512 encryption, but I am wondering if there is any way to expose this service outside of Drupal

Perhaps use hook_auth within Drupal, but expose that hook externally somehow?


texts:
I recently switched to drupal_composer to manage my dependencies and updates. And so far I can really see the benefit of this work method, and highly encourage everyone to switch.

However, I tried installing the module Simple Oauth, but composer can't find it.

$ composer require "drupal/simple_oauth:^2.0-alpha4"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package drupal/simple_oauth could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

When browsing composer, nothing is found either.

$ composer browse drupal/simple_oauth
Package drupal/simple_oauth not found
Invalid or missing repository URL for drupal/simple_oauth

Is this due to the alpha release not being published or something?


texts: Blocks placed in content region appear in wrong positions

texts: Is there something I need to know about the way drupal handles blocks in the content region? I have a very bare bones omega subtheme with a single page promoted to front and two blocks in the content region positioned after the main content 'block' - but they show up before the main content.


texts: Can I use KernelEvents::EXCEPTION to make exceptions for my own code?

texts:
I've written code for a custom module in my .MODULE file that looks like this.

function cookie_authentication_node_access(NodeInterface $node, $op, AccountInterface $account) {
  if ($account->isAnonymous() && $node->gettype() == 'page') {
    return AccessResult::forbidden()->cachePerPermissions();
  }

return AccessResult::neutral();

}

Basically, using an EventSubscriber, I want to create an exception for my own rule I made above (letting anonymous users access a certain page)...

Would the 'EXCEPTION' KernelEvent be the right path, or is it only for real uncaught exceptions?


texts:
Is there a way to disable the past dates in the date pop-up while using the date combo form api? Specifically, I have a date type field in a content type, on which I want to do this.

Help appreciated...


texts: How to set the breadcrumb for view defined pages

texts:
I have created a page using views 3 like this

node/%/classroom

How can I set the breadcrumb and title for this page.

I tried to set using views menu option but restricts me to use normal menu for path with %.

Thanks in advance for your help.

Umar


texts: The Video module for Drupal 6 allows for video files uploaded via ftp to be played.  Does this module's Drupal 7 version have this feature?  If not what is the work around for large files?


texts:
Is there any way to replace image/icon for a particular node output ?

A simple Example:

I am getting input from user sucn as
"is your car running in petrol or diesel ?" if he selects the diesel then in node output instead of displaying diesel it should display the Diesel icon which i provide.

Is there any module for that because i have several input like this..Thanks


texts: Remove user entities on module uninstall

texts:
I am using the following code to delete all the nodes and clean up on uninstall of my custom module. How can I do the same thing for my user entity?

    function wl_project_uninstall() {
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(
    ':type' => 'wl_project'
  ));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row->nid;
  }
  node_delete_multiple($nids);
  foreach (array_keys(_wl_project_fields()) as $field) {
    field_delete_field($field);
  }
  node_type_delete('project');
  // Purge all field information
  // http://api.drupal.org/api/function/field_purge_batch/7
  field_purge_batch(1000);
}


texts: Where to write a jquery script for a registration form page which created using webform module in Drupal 7?

texts:
I have created a registration form page using the webform module. The registration form page contains personal info and billing info groups with fisrtname, lastname, email, age fields and a check box saying "billing info same as personal info". Where should I write a jQuery script to put all the personal info in billing info fields when the check box is checked?

I have created a js folder/check_box.js file in the bartik theme folder which i am using
then made changes in bartik.info file as scripts[]=js/check_box.js
then added drupal_add_js in template.php
cleared all caches

but still I cannot execute my script which I have written for check box or the fields.

$("#checkbox_id").change(function() {
  if(this.checked){
    alert("checked");
    });
})(jQuery);

This is my code to check whether its working or not. Is it correct? If not please help me with the code.


texts:
I want to set create a language in PHP code (for example, using a hook_update_n implementation) so I can deploy and automate it.

How?


texts: How to view blocks with Text Overlay on hover?

texts:
I'm working on a Drupal 7 site and I want to achieve similar thing (view blocks with Text Overlay on hover) shown here. http://ibakatv.com/ under the following blocks (sub sections):
Basically I would like to show text upon mouse hover just like what is shown on the above website.

MOVIE TRAILERS
TRENDING MOVIES ..
LATEST MOVIES etc etc

Also, can someone help how to achieve those view blocks with the navigation as listed above? Do you know this was done? I looked at BX Slider, but I'm unable to achieve it.


texts: Add custom operator for condition() in search_api

texts:
I am trying to implement hook_search_api_multi_query_alter but it seems 'IN' operator does not work here. I have to check condition on array. Any pointers for start building custom operator.

function my_module_search_api_multi_query_alter(SearchApiMultiQueryInterface $query) {
$indexes = $query->getIndexes();
dpm($query->getFields());
if (isset($indexes['solr_content_index_dev'])) {
  $query->condition('solr_content_index_dev:nid', array(2918, 2367), 'IN');

}
}


texts:
I have a site that has a 404 being reported as "sites/default/files/css/," - yes, a css file with the name comma ","

I have no idea what is causing this 404.  The watchdog shows the referring URL can be almost any page on the site but going there and viewing the page source does not turn anything up.  It is intermittant and not created on every page request.

Has anyone seen this before? Anyone know what causes it?

I am using Drupal 7.14

Kind regards,

John


texts: How to get specific fields in the login form

texts:
I'm trying to customize the login form. I added this to my template.php

function neptune_theme() {
  $items = array();
  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'neptune') ,
    'template' => 'user-login',
    'preprocess functions' => array(
       'neptune_preprocess_user_login'
    ),
  );
  return $items;
}

and this is my user-login.tpl.php

<?php print render($intro_text); ?>

  <?php print drupal_render_children($form) ?>

    Create an Account | Forgot Password

I wanna know how to show the username, password and submit fields separately in the user-login.tpl.php file. I want to put the links for "Create an account" and "Forgot your password" before the Submit button.

I want to show something like

|Username                 |

|Password                 |

Create an Account | Forgot your password

|Submit|

Thank You. I hope it makes sense. :)


texts:
I am dynamically rendering a table in a Drupal 8 module. While creating my renderable array I noticed that I can define my table as a '#theme' => 'table' or as '#type' => 'table'.

$variables['test_table'] = [
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array('class'=>array('my-table')),
    '#header_columns' => 4,
];

vs:

$variables['test_table'] = [
    '#type' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array('class'=>array('my-table')),
    '#header_columns' => 4,
];

Both of these options seem to output the same thing.

My question is this: Why can I use either '#theme' => 'table' or '#type' => 'table' when defining a table renderable array and is there any difference between how Drupal will render these differently.


texts: If logged in, My Account/Log Out are missing, how can i fix?

texts:
I have a Drupal Commerce website in development and there is a problem with the User Login  block.

If logged in, it is missing the 'My Account / Log Out' links. But if logged out, is shows the standard links, 'Username/Pass fields, Create New Account, Request New Password' links.

I  have no idea how to fix. can someone please clue me in where to start? This was a PSD to Drupal job so maybe the problem lies in one of the Template files? like Regions.tpl ?

On a standard Drupal install this hasn't been an issue.


texts: Render node fields and labels in node template

texts:
I'm familiar with the Drupal 8 theming API, including hook_preprocess_HOOK(), as well as all of the theme template suggestions available when Twig debug is enabled.

However, what I would love to be able to do is to control all of the individual fields and optional labels for a node, inside the node--tool--full.html.twig template. (My content type machine name is tool.)

I also know that I can simply leave out the call to {{ content }} in the Twig template and call fields individually like this.

{{content.body}}
{{content.field_application_purpose}}
{{content.field_application_uses}}

And of course, if I want complete control over a field, including rendered markup (for example, field_application_uses), I can create another template (field--node--field-application-uses--tool.html.twig) and then wrap the field and its label in any markup I'd like.

So far so good.

But how can I control all of this from within the node template, in this case node--tool--full.html.twig?

My node is translatable, including the field label.

What I'd like to do, instead of having to create field templates for every field on the node/content type/bundle, is something like this.

  ...

{{ node.field-application_purpose.label}}

{{ node.field-application_purpose.value }}

{{ node.field_application_uses.label}}

{{ node.field_application_uses.value }}

  ...

The above template snippet works for the value, but not for the label, and I spent hours trying to work out where to get the label.

In field--node--field-application-uses--tool.html.twig, the label is available as a variable, but how can I retrieve this at the node template level?

I'd ideally like to keep all of the fields and their markup in a single template, the node template, as opposed to having to create a template for each field.


texts: D8: Why updated paragraph content does not lead to an updated translation?

texts:
I created a content type made up with a long-text field and a multivalue paragraph field. I create some content adding several paragraphs to the same node, then I choose "Translate" and everything is fine the first time I do this: all original paragraphs appear ready to be translated.

However when I update the original language node adding new paragraphs, these new paragraphs do not appear when editing the translation and I'm forced to delete the latter and create a new translation. Why is this happening?


texts: multilingual language site (Drupal) entity reference

texts: I am working on multilingual language site (Drupal) I would like to get data depends on language can I know how to write query using Entity Reference ?


texts: How to I style the Superfish accordion menu to have bars?

texts: I would like to show my super fish menu with bars as shown in the picture (when in mobile responsive mode), but at the moment i can only get the word "Menu". The menu functions perfectly, i just wanted to add the bars. Can anyone advise?


texts: How to create a button that creates an article with a specific tag?

texts:
I'm administrating a public site and there's some other guys who add content, too. We have a page with articles with a certain tag (let's call it theTag) which has an address like the-site.com/taxonomy/term/41. Now, since other users are not advanced ones (and for general convenience) I'd like to create a button which:

adds an article (opens the the-site.com/node/add/article or the corresponding overlay) with pre-set theTag
also I'd like the "is shown on the main page" flag (not sure about the exact name, it's "Помещено на главную страницу" in Russian) unset, so that the article is show only on the the-site.com/taxonomy/term/41 page, not on the main one
the button should obviously be shown only to those who can edit

How to implement that? It sounds like a common feature, but googling didn't help. Since I'm totally new to Drupal internals, I'd appreciate any partial suggestions if you think I'm asking for too much.

PS may be there's some params that I can use in the the-site.com/node/add/article url (like, say, the-site.com/node/add/article?tag=theTag) so that the corresponding tag is pre-set in the new article form?


texts: hook_form_alter setting select list #options key allow attributes per option

texts:
I have a select list that I am populating $form['field_my_field']['und']['#options'] in a hook_form_alter.

I was wondering what a good way to set a data attribute per each option would be. I've thought about adding some inline javascript to add it after it's rendered, but I want to do this with PHP and preferably within the hook_form_alter.

Is this possible?


texts: How to bulk assign existing content to a group created with the Group module?

texts:
The Group module is an alternative for Organic Groups. One of the features it offers is that you can assign nodes to a Group.

Question: how to bulk-assign a set of existing nodes to a specific group, using site building techniques only (not programmatically, which appears to be a possible alternative also)?


texts:
I have an application using domain access and am looking to reuse a set of subscriber roles across domains, assigning them on login.

I was hoping to use hook_user_load to add the additional roles.

I have some code like this:

/**
 * Implements hook_user_load()
 *
 * Dynamically assign configured roles based on active domain and subscription
 */
function EXAMPLE_user_load($users) {

  // Process each account once per request
  $processed_uids = &drupal_static(__FUNCTION__, array());
  // Get defined roles
  $roles = user_roles(TRUE);

  // Process accounts
  foreach ($users as $uid => $account) {
    $grant_rids = array();
    if(!in_array($uid, $processed_uids)){
      // Code to get grant role ids here...
      // ...
      // ...
      // Grant subscriber roles
      if(!empty($grant_rids)){
        foreach($grant_rids as $rid){
          // Matching role exists and not already assigned
          if(!empty($roles[$rid]) && !array_key_exists($rid, $users[$uid]->roles)){
            $users[$uid]->roles[$rid] = $roles[$rid];
          }
        }
      }
      $processed_uids[] = $uid;
    }
  }
}

Using this approach, the roles do get added, and I can see them in the $users array after processing.

However the user logging in, despite running through hook_user_load doesn't appear to have those roles "set" ( i.e aren't authenticated as having that role )

Maybe some kind of cache issue?

Does anyone have any ideas about what needs changing above or how to assign user roles dynamically as the user logs in, or as the user is loaded?

UPDATE:

Well, it turns out, you can actually alter user roles in hook_user_load.

My issue was caused by a ctools bug I discovered in my debug travels whereby the current logged in user context didn't fully load the user entity, and thus the access checks for the Panel page access were failing. It also needed a drupal_static_reset('user_access') to reset the static user_access permission check cache. Patch posted here http://drupal.org/node/2010124

After that, the dynamic role assignment appears to be working fine.

UPDATE 2

I wrote too soon, still having problems...

Will update when resolved.

UPDATE 3

OK, the remaining issues were related to ctools context caching.
I ended up writing my own ctools access plugin to ensure the logged in user context is checked uncached on each access request. After that, all appears well again.


texts: How to style answers from the Answers module to make them look as in the demo site?

texts:
The voting element of the Answers module does not look as in the following screenshot:

What should I do to make them appear as in the screenshot?


texts: How can I use 'xx time ago' as date format?

texts:
How can I use 'xx time ago' for date format in Drupal 8 nodes ?

I want to replace "xx time ago" with {{ date }} in node.

In Drupal 7 it worked with this code :

<?php
 print format_interval(time()-$node->created);
?>


texts: Hiding Superfish Dropdown on Specific Menu Item

texts:
I am working on a Drupal site that has a series of about 2 dozen articles. I have a page called "News" which lists the title/teaser for each article. I would like the menu item "News" to be active as the parent of each article node, but I would like to disable the dropdown menu (No need to have dozens of articles in a dropdown). I am using Superfish and have the dropdown enabled for all other menu items. Is there any way to disable it for a single menu item? Perhaps I need a different menu module?

Any help would be greatly appreciated. Many thanks!

susanhouser

EDIT

Here is a screenshot to help illustrate:

http://screencast.com/t/3eyDuK0w

EDIT02

I ended up coming across a solution that fit my need (See answer below). Instead of setting News as the parent menu item for each article (I was doing this to generate the class "active-trail"), I used the plugin described in my answer. Thanks for all of the help!


texts: How do I install the commerceguys libraries?

texts:
While installing Drupal Commerce 8.x-2.x-dev on Drupal 8.0.0-rc4, I'm greeted by the announcements.

Commerce Price requires the commerceguys/intl library.
Commerce Tax requires the commerceguys/tax library.
Address requires the commerceguys/addressing library.

How do I that? It's probably so obvious that I'm overlooking it.


texts: Only show view/block on nodes with certain field value when using "Content: Has taxonomy term ID"

texts:
I've set up a view of related content that has a block display and 2 contextual filters:

"Content: ID" with "Exclude"
"Content: Has taxonomy term ID" with
"Load default filter from node page, that's good for related taxonomy
blocks".

The block is configured to display only on nodes of a certain content type.

Now, I only want to show the view/block on nodes where a field has a certain value. How?

My question is similar to this one. But the accepted answer — adding the field under Filter Criteria — doesn't work here, because the filter applies to the related nodes rather than the current node.

Is there a way to solve this just by modifying the view? (It seems like the sort of thing a view could do.) Or is it necessary to use a contrib module — Context or Entity Field Condition — to hide the block?


texts: Any downside when using block_content as custom content entities?

texts:
Background:
For a tourism project I need to integrate volatile data from external sources (like snow reports for ski ressorts or movies and their showtimes). This data should not be accessible by its own URL, they are always referenced/viewed from (mulitple) other traditional nodes (like a ski ressort node or a cinema node). Except for their ephemerality and the missing frontend URL they should work like any other node without revisions.

At first I thought I should create my own custom content entities.

But Custom content blocks seem to offer all I need (bundle-able, field-able, no own URL, multiple parents [rules out Paragraphs], integrate well with other modules like Views or Migrate, permissions,...) - for free without any custom coding (except I need to create/change some Admin UI views). There are going to be thousands of those data entries, and they will be updated frequently. But I do not intend to use them as blocks in the traditional Drupal way (placing them in regions).

Question:
Is there any downside when I "misuse" Custom content blocks as custom content entities in a large scale? The only downside I found is that those entries will massively clutter the block placement config window, but this seems acceptable.


texts: Drupal 7 aliases for a certain content type producing 404

texts:
I've got a custom content type ("charity listing").  Nodes in this content type should have the automatic alias charities/view/[name-of-charity].  They do indeed have this alias, when I try to edit a node the alias is there.  However, typing the URL alias into the browser gives me a 404 error.

I have tried re-generating all the automatic URL aliases.  Still doesn't work.

Help much appreciated!


texts: Get only some fields with EntityFieldQuery?

texts:
Drupal 7 has very promising ORM-like system of queries with EntityFieldQuery.

Currently, I understand how to make selection of nodes, but the result doesn't contain any specific information, like fileds, I'm looking for.

$query = new EntityFieldQuery();
$entities = $query->entityCondition('entity_type', 'node')
                        ->entityCondition('bundle', 'event')
                        ->propertyCondition('status', 1)
                        ->fieldCondition('field_date', 'value', array('2011-03-01', '2011-03-31'), 'BETWEEN')
                        ->fieldOrderBy('field_date', 'value', 'ASC')
                        ->execute();

So we need to load entire data of nodes, if we would like to get only values of one field, for example 'field_date' in current example.

$nodes = entity_load('node', array_keys($entities['node']));

If there is a way to get the value of fields, instead to load full data of all nodes, as it provokes some memory overload.

$nodesFieldDates = ???


texts: Can the themeing and render api be accessed independently?

texts: Are there de-coupled versions of the form rendering and theming APIs that can be used outside of the Drupal framework?


texts: How can I hide a field when creating a node, but displaying it when editing a mode?


texts:
I am attempting to add a signature field with validation to a webform.  The validation fields show up, the signature field seems to be there (cursor changes to +) but no field for signature is there.

Esign's documentation says to "
    Did you set the field to display?
    Does your CSS allow the field to display?
"
I'm suspecting that one of these may be my issue.  However, I have no idea where to set the field to display.  I should note that I added the esign field by adding the field in "form components" and not "form builder" as the field esign did not show up in the "form builder" tab.

Any help would be most welcome!

This is for Drupal 7.


texts: How do I use Views Global Filter with Geofield 2.x Exposed Proximity Filter?

texts: I am trying to set it up so that a views global filter  https://drupal.org/project/global_filter can set the distance and city for the proximity filter for Geofield? What are the steps to do this?


texts: Select the right pathauto alias for a node

texts:
I'm working on a drupal 8 project, I need to access the content type X nodes via two aliases depending on some conditions, for this I've created two Pathauto patterns using Pathauto contrib module:

path_1 --> /local/[node:title]

path_2 --> /global/[node:title]

path_1 & path_2 are supposed the machine name of those two patterns.

What are those two patterns? actually what I want to do is check if a node of type X has the checkbox field 'global' checked so use /global/[node:title] as alias for this node else use /local/[node:title].

Which hook should I implements for selecting/altering a pathauto pattern for a node? And can I use those aliases as a route for a controller?


texts: How can I add multiple conditions for the same field taxonomy term in views query?

texts:
I make some query for views filter for nodes. Use in hook_views_query_alter.

$definition = [
   'table' => 'node__field_characs',
   'field' => 'field_characs_target_id',
   'left_table' => 'taxonomy_index',
   'left_field' => 'tid',
   'operator' => '='
];
$join = \Drupal::service('plugin.manager.views.join')->createInstance('standard', $definition);
$rel = $query->addRelationship('node__field_characs', $join, 'taxonomy_index');
$query->addTable('node__field_characs', $rel, $join, 'node__field_characs');

I add array of conditions.

$q_and = db_and();
foreach($ch_id as $key => $val_array){
   $q_and->condition('node__field_characs.field_characs_target_id', $val_array, 'IN');
}
$query->addWhere(0, $q_and);

But if array $ch_id have more then 1 elements, it works wrong. It does not show any nodes.

A similar problem is described here Perform a query with an entity field condition with multiple values. But how can this be applied in this case?


texts: How to create paragraph of particular type using JSONAPI?

texts:
I am able to GET the data using endpoint "site_url/jsonapi/paragraph/text". But I am not able to create a new paragraph of type text. Its always giving me error "403 forbidden". I have tried all drupal permissions also i am using simple oauth and i am using admin token to POST.

Endpont :- site_url/jsonapi/paragraph/text
Request Type :- POST
Post Body :- {

"data": {
    "type": "paragraph--text",
    "attributes": {
        "field_text": {
            "value": "
ദുബായ് ∙ സാമ്പത്തിക അച്ചടക്കമില്ലാത്തവർക്കു കുരുക്കായി ക്രെഡിറ്റ് കാർഡുകൾ. കൃത്യമായി പണം തിരച്ചടയ്ക്കാതെ കുടിശിക പെരുകി കുടുക്കിലാകുന്നവരിൽ മലയാളികളുമേറെ. ബാധ്യത കൂടി ചിലർ വിട്ടുവീഴ്ചയ്ക്കായി ബാങ്കിനെ സമീപിക്കുമ്പോൾ മറ്റു ചിലർ രാജ്യത്തുനിന്നു മുങ്ങും. ഒരു കാർഡിന്റെ ബാധ്യത തീർക്കാൻ മറ്റൊരു ബാങ്കിൽ നിന്നുകൂടി ക്രെഡിറ്റ് കാർഡ് എടുത്ത് രണ്ടും തിരിച്ചടയ്ക്കാത്തവരുമുണ്ട്.
\r\n",
            "format": "basic_html",
            "processed": "
ദുബായ് ∙ സാമ്പത്തിക അച്ചടക്കമില്ലാത്തവർക്കു കുരുക്കായി ക്രെഡിറ്റ് കാർഡുകൾ. കൃത്യമായി പണം തിരച്ചടയ്ക്കാതെ കുടിശിക പെരുകി കുടുക്കിലാകുന്നവരിൽ മലയാളികളുമേറെ. ബാധ്യത കൂടി ചിലർ വിട്ടുവീഴ്ചയ്ക്കായി ബാങ്കിനെ സമീപിക്കുമ്പോൾ മറ്റു ചിലർ രാജ്യത്തുനിന്നു മുങ്ങും. ഒരു കാർഡിന്റെ ബാധ്യത തീർക്കാൻ മറ്റൊരു ബാങ്കിൽ നിന്നുകൂടി ക്രെഡിറ്റ് കാർഡ് എടുത്ത് രണ്ടും തിരിച്ചടയ്ക്കാത്തവരുമുണ്ട്.
"
        }
    },
    "relationships": {
        "paragraph_type": {
            "data": {
                "type": "paragraphs_type--paragraphs_type",
                "id": "6692c53b-f2f3-4a52-a18f-e59d94be3c88"
            }
        }
    }
}
}

This is always giving me 403 forbidden error. Am i doing anything wrong ?


texts: print out multiple values of a taxonomy field

texts:
In a taxonomy I have some fields for the terms. To print out 1 of these fields in a node.tpl I found this code:

<?php $term=taxonomy_term_load($node->field_hotel_tx_atmosphere['und'][0]['tid']);
$result=field_view_field('taxonomy_term',$term,'field_tx_headline','text');
print render($result); ?>

But this way I get only the first value - there are multiple terms selected.

How can I get all selected terms printed out?


texts:
I am using print module. I am also using devel module. In print.tpl.php file, I see a php code that prints the content as print $content. I don't want to print the entire content. I think content is an array. How can I print manually some fields from the content variable using the devel module or in php?

Thanks.
D

1.

  print render($content['field_machine_name']);

Get this error:
 Fatal error: Only variables can be passed by reference in /..sites/all/modules/print/print.tpl.php on line 100

  php  print $content['field_machine_name'];

I get left error only (<)

3.

  print $fields['field_vehicle_options']->content;

I get completely blank

I am using bartik 7.22.

themes > bartik > template.php

Added the below function.

function bartik_preprocess_print(&$vars, $hook) {

// Global node.
$node = $vars['node'];

// Create a var and render using field_view_value
$vars['test'] = field_view_value('node', $node, 'field_price', $node->field_price[$node->language][0]);

}

themes > bartik > template > print.tpl.php

I added:
print render($test);

I went to my page
http://bettylist.com/ac/node/12 > clicked printer friendly link >
I did not see the value of variable.

In print.tpl.php, what works:

print $content; //I GET CONTENT IN PRINT PAGE
print dsm($title); // I GET VALUE OF TITLE IN PRINT PAGE

Please advise.
Thanks,
D

It worked. I have added one more variable as below:

function bartik_preprocess_print(&$vars, $hook) {

// Global node.
$node = $vars['node'];

// Create a var and render using field_view_value
$vars['price'] = field_view_value('node', $node, 'field_price', $node->field_price[$node->language][0]);

// Create a var and render using field_view_value
$vars['vehicleOption1'] = field_view_value('node', $node, 'field_vehicle_option_1', $node->field_vehicle_option_1[$node->language][0]);

}

In print.tpl.php, I added

print render($test);
print render($vehicleOption1);

But I am only getting the value of the last variable $vars'vehicleOption1'.

Please advise.


texts:
I'm working on a Drupal 7 site with a prominent flexslider paragraph rotating images.  The image files sizes appear to improve quite a bit if I convert them to .webp format. My problem is that I cannot select and upload a .webp image into the paragraph.

I have gone into the Structure/paragraph bundles, selected the paragraph, manage field, and edited the Image field adding webp to the list of other image formats in the "allowed file extensions" field (currently "png, webp, jpg, gif"). Save, and double check to confirm webp in the list.

Now, when I head back to add content, select to add the new flexslider paragraph, the Image field shows all the acceptable parameters (max file size, max image dimensions, allowed file types) below the Image selection field, except webp is not listed as an allowed file type... the list it shows is "png jpg gif".

As a test, if I remove gif from the structure/paragraph bundle/manage field panel, then gif would also be removed from the add content/paragraph bundle/allowed file type list, so I'm on the right track there. But I don't understand why webp is being ignored?

Also, as another test, I used the Ckeditor IMCE to upload and select the .webp formatted image and display it in the body section. This worked as expected.


texts:
I'm using drupal table drag functionality for displaying a group of taxonomy terms and content types. Code is obtained from drupal examples.

Need to find out how to use load more functionality. My aim is to display 3 childrens of a parent. Then after clicking load more button, next set of siblings will be displayed.

Tried to use ajax_command_after in load more callback, but don't know how to use theme() to load the next set of siblings.

Please help if anyone knows. Im not using any views here..

My load more button is,

    'load_more' => array(
        '#type' => 'button',
            '#submit' => array('load_more_submit'),
            '#value' => 'Load More',
            '#name' => $item->id,
        '#ajax' => array(
           'callback' => '_ajax_load_more',
           'event' => 'click',
           'method' => 'append'),
        ),


texts:
I'm attempting to programmatically create test users in Drupal 8 via  hook_update_n(). I have an array of user attributes I'm using to create users.

I've got three fields added to the User entity that add term references to existing vocabularies that have been populated with terms. Two of these fields store a single term reference, while the third can store multiple term references.

I've retrieved the term object using this code.

    $term = \Drupal::entityTypeManager()
        ->getStorage('taxonomy_term')
        ->loadByProperties(['name' => $user['bu'], 'vid' =>
    'tx_business_unit']);

I'm trying to add a term reference to my user field, called "user_bu".

I've attempted to use the solution given on Programmatically update an entity reference field, but it doesn't work for me.

Everything else on my user record is being populated without issue.


texts: How to display a profile form using profile2 module

texts:
Profile2 is a module that uses entities to create profiles that are separate from the user account.

From within my module, I want to be able to display a form to edit the profile entities. Possibly using drupal_get_form or maybe Profile2's API or any other method.

What is the best way to go about this?


texts: How can i query the chosen shipping rate of a given order using Rules in Drupal Commerce?

texts: In the checkout process, I need to add the subtotal of an order (which I have access to) with the customer-chosen shipping service amount. I can't seem to access the shipping service amount that was selected by the user. How can I access this?


texts:
I have a field 1 Name and another field 2 Year and have it sorted in Views first by Name and second by Year. If Year is empty I want it to be placed last under each letter. So lets say I have 5 James in my list and 4 of them have a Year and the one without Year to appear last in the list of those names but before Jane.

I've installed Rules and Views Rules but I don't know how use Rules for this kind of thing. Any suggestions?


texts: Total number of published comments from the logged in user

texts:
On our Drupal 6 site we are looking at setting up this rule for comments:

1) If you don't have an approved (i.e. published) comment then your comment goes into the moderation queue

2) If you have an approved comment, then your comment is published straightaway

Is it best to use Rules in Drupal? How can we check how many published comments a user has? Custom PHP code perhaps?

Any help appreciated!


texts:
I have a node type called "competition". I can get a form for it like so:

$values = array('type' => 'competition');
$node = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->create($values);

$form = \Drupal::entityTypeManager()
  ->getFormObject('node', 'default')
  ->setEntity($node);
$form = \Drupal::formBuilder()->getForm($form);

In a controller it's easy enough to return $form and it will be rendered. But I want to do other things with this form so I need it back as HTML. How can I turn $form into fully rendered html?


texts: Using Feeds Importer to Import YouTube video uploads (API 3.0)

texts:
Here is my scenario:

I am using Feeds module, Google Auth module, and Media module. I am trying to import a list of recently uploaded videos to a specific channel (maintained by me) using the above.

While this is fairly simple in YouTube API 2.0, I'm having a very difficult time trying to figure out how to do this with 3.0.

Since 2.0 is deprecated, the methods for that is not working (obviously), and I've tried authenticating my API (already done), putting in the info into Google Auth module (already done), and using the example codes to generate a URL to put into Feeds importer (already done but not working).

I keep getting a 200 OK with the example code on Google's API -- using the channel function, but 400 (forbidden) when putting it into Feed importer, so I know there is a permissions issue somewhere, but I can't figure out where.

I also don't know for sure if this method is the correct method to do this.

Any help or suggestions would be great. I'm at my wits end about this and I feel like I'm just missing some important piece but can't see it at all.


texts: How to disable the number that the Email Registration module puts on peoples username on registration

texts: I'm working with the email registration module and everywhere I look it says that it just uses everything before the @ sign for the username. However it adds and underscore and some number to every username. I'm not very familiar with php so if someone could tell me to disable this it would be much appreciated.


texts: How can I set a custom form's element after a managed_file ajax callback?

texts:
Scenario:
I have a custom form whose first step is to upload a file using a managed_file field element.
Then, after this manged file is uploaded I want to rebuild the form using information from the managed file and display new form elements that should only exist after the managed file is uploaded.
I have struggled with this for days and cannot get a working solution. The first problem is that the managed_file already has an ajax callback so I can't seem to add my own to populate and/or return field elements after the file is successfully uploaded.
I've gone as far as overriding the managed_file type with a custom form field type but I can't seem to be able to return actual form elements AND an ajax response (one of the other). Code example of my override below.
In short, how can I repopulate a custom field after a managed file uploaded is completed and add new fields dependent on the file that was uploaded?
/**
 * My Managed File Element.
 *
 * @FormElement("my_managed_file")
 */
class MyManagedFile extends ManagedFile {

  /**
   * {@inheritdoc}
   */
  public static function uploadAjaxCallback(&$form, FormStateInterface &$form_state, Request $request) {

    $response = parent::uploadAjaxCallback($form, $form_state, $request);

    return $response;

  }

}


texts: Iterate through user custom fields in twig

texts:
I'm trying to iterate through a user reference field using twig. I'm able to get the username, but not any of the custom fields that I made for users such as "First Name" and "Last Name".

{% for item in items %}
  {{ kint(item.content['#options']) }}
  {{ item.content['#title'] }}
{% endfor %}

I'm trying to get the email address as well, but I can't figure out how to get these values.

I thought it would be something like:

{{ item.content['#options'].entity.mail }}

When I do that, the entire site crashes and I get errors. Am I doing something wrong?


texts:
I've been searching but didn't find much.

Is there any module or way to send emails with Drupal, but using different email accounts?

For example, I have a site which will have 3 different email accounts to send email.
User A creates a node, the user will receive an email from the email account 1.
User B takes an action, he or she will receive an email from the email account 2.
Etc.

To sum up:

Is there any module to hold different email accounts in one drupal site and send email with them?

I've seen some modules to hold different email accounts for the users, but not for the site.

Thanks in advance.


texts:
I would like create a webform and add to content type. so when user create node, webform automatially add to node (webform is same for per node of content type).

is this feasible with webform 3?


texts: how to reference a field in a field collection in a page.tpl file

texts:
I have added a field to the basic page content type (a field collection field, to be exact). I want to be able to pull out the content of each field and display it in different format. How can I do this? Which variable contains this data? I am using an override of page.tpl.php.

EDIT:
I did try dpm($node) and I see the field collection field. However this is the structure I see - field_call_to_action['und'][0]['value']  which is equal to 231. I still don't see the actual values of the fields in the field collection.


texts: What does -1 signify in system.schema_version?

texts:
The Drupal 7 {system} table has a schema_version column. Its default value is -1 as indicated by the DESCRIBE system; MySQL command.

Sometimes an update function won't run if the module's schema_version is -1.  For instance, I have site that migrated from Drupal 6 to Drupal 7 quite some time ago.  Recently I found that a database column that should have been introduced by honeypot_update_7100() never ran.  I'm not sure whether or not the version of honeypot at the time of the migration contained that function.  After changing the schema_version to 0, update.php ran that update and the missing column was introduced.  See PDOException Column not found: 1054 Unknown column 'hostname' for similar stories.

Is -1 treated specially?  Do all -1's potentially need to change to 0 for their update functions to run?


texts: Import won't import content in CCK image fields

texts:
I am using the Node Export module to migrate thousands of nodes from a Drupal 5 site to a Drupal 6 site, and it is working really nicely except for one thing: It systematically fails to import my CCK image field and I get the following error message.

  Unknown error occurred attempting to import file: [path to file]

Does anyone know how to resolve this issue?


texts: How do I programmatically delete an order?

texts:
My head is about to pop. I'm trying to figure out how to delete commerce orders programmatically. I created a rest export with the order IDs I want to delete. I've parsed that and put the IDs into an array. Now I want to loop through that array and delete the orders.

json parsing, and retrieving order_id work fine.

I'm so close but I can't figure out how to properly reference commerce_order_delete or commerce_cart_commerce_order_delete?

function afc_custom_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
          if ($entity->id() == 803) {
            $url = 'my url';
            $jsonString = file_get_contents($url);
            $jsonDecoded = json_decode($jsonString, true);
            $object = new stdClass();
            foreach($jsonDecoded as $row){
            if ($row['order_id'] == 121) {
                $object->order_id = $row['order_id'];
                // $order = \Drupal::entityTypeManager()->getStorage('commerce_order')->load($row['order_id']);
                commerce_cart_commerce_order_delete($object);
            }

            }
          }
    }

Error:

TypeError: Argument 1 passed to commerce_cart_commerce_order_delete() must be an instance of Drupal\commerce_order\Entity\OrderInterface, instance of stdClass given,

UPDATE #2
New Code

use Drupal\commerce_order\Entity\OrderInterface;

  if ($entity->id() == 803) {
    $url = 'https://myurl.com/pull-ghosts';
    $jsonString = file_get_contents($url);
    $jsonDecoded = json_decode($jsonString, true);

    $object = new OrderInterface;

    foreach($jsonDecoded as $row){
      if ($row['order_id'] == 121) {
        $object->setOrderNumber($row['order_id']);
        commerce_cart_commerce_order_delete($object);
        print 'deleted';
      }
    }
  }

SAME ERROR:

error: Cannot instantiate interface Drupal\commerce_order\Entity\OrderInterface in afc_custom_node_view()


texts: Any recommendation of i18n-savvy nice menus?

texts:
Which of the nice menu modules at this point are i18n-savvy? I've tried Superfish and OM Maximenu with no success, and I'm wondering if I'm doing things wrong or the menus don't understand current language selection.

I'd be grateful for any feedback from people who run this kind of menu on multilingual sites.


texts:
Trying to install Drupal 8 using drush.

drush dl drupal --drupal-project-rename=example
cd example

So far, so good.

However, when I get to this part:

drush site-install standard --db-url='mysql://root:my+Password@localhost/db_name' --site-name=Example

I've also tried:

drush site-install standard --db-url='mysql://root:my+Password@127.0.0.1/db_name' --site-name=Example

But I get the following error:

  Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [1045] Access denied for user root@localhost (using
      password: YES) Is the database server running? Does the database exist or does the database user have sufficient privileges to create the
      database? Have you entered the correct database name? Have you entered the correct username and password? Have you entered the correct database hostname?

All of the answers are "Yes," so the install should work. Is it something wrong with my syntax? I have other Drupal sites on this server that I've installed manually, it's just the Drush install I can't get to work. What am I doing wrong?


texts: Map data to a View Reference field using Migrate

texts:
I'm trying to map data in a migration to a View Reference field (here called field_sci_view_to_use) in my Content Type.

I have assigned the View ID a default value in the field configuration as that will be a constant per Content Type.

However, when attempting to map the argument value string, it is never picked up.

I attempted using the following code:

$this->addFieldMapping('field_sci_view_to_use:arguments', 'pdbid')
     ->description(t('The default value to use as contextual filter for the view'));

I have examined the internals of the View Reference module and found that arguments contains two sub elements - php_arguments and dsv_arguments. Is it possible to chain these together so that the addFieldMapping 1st argument is "field_sci_view_to_use:arguments:dsv_arguments"? If not, what is the correct syntax here?


texts:
In Drupal 8, for the Comment entity, I want to validate an integer field (stored as field_nieuwe_waarde_value).
In each comment posted for a node, it needs to be greater than the value for the previous comment.

The code doesn't give any errors, but the validation doesn't work.

use Drupal\Core\Form\FormStateInterface;

       /**
        * Implements hook_form_alter().
        */

       function waarde_validatie_form_alter(&$form, $form_state, $form_id) {
         if ($form_id == 'comment_waarde_van_dit_voorwerp__form'){
           $form['#validate'][] = 'start_drupal_waarde_voorwerp_form_validate';
         }
       }

       /**
        * Validation form for the waarde_voorwerp form.
        *
        * Check if the value is > then the last submitted value
        */
       function start_drupal_waarde_voorwerp_form_validate($form, FormStateInterface &$form_state) {
         // Look for the just submitted value.
         $nieuwste_waarde = $form_state->getValue('field_nieuwe_waarde');
         // Look for all early submitted values.
         $alle_waarden = $form_state->getUserInput('field_nieuwe_waarde');
         // Search for the last submitted value.
         $laatste_bod = end($alle_waarden);
         if ($nieuwste_waarde <= $laatste_waarde) {
           $form_state->setErrorByName( t('Gelieve hoger dan'), $laatste_waarde, t('in te stellen'));
         }
       }


texts: Side-by-side contact form and GMap using panels

texts:
I need a "contact us" page which has a contact form and google map side by side.
Thus, I enabled the core "Contact" module and installed GMap module. I also installed
Panels module and ctools module to create a page with two columns layout.

I successfully added the contact form into the left column of the panel page, but I failed to add the map into the right column. I thought I can easily add a gmap block into the column, but I could not find any block provided by the GMap module.

How can I do that ? Can I create a block which displays the map by using views.
I don't want to write custom codes.


texts:
I've been having problems to update modules through the admin feature.

I tried googling a lot about this issue but I always get other kind of module update issue but if this is answered elsewhere, please point me to it.

I don't recall how this started, I think around Drupal 7.18/7.19

What happens is that I get a daily email (from the cron) saying there are updates available. I go to ../admin/reports/updates/update, check all modules, update them all successfully. Then Drupal offers me to run updates in maintenance mode but when I click continue I get back to .../admin/update/ready with the site in maintenance mode activated. I retry and get back to the same page.

I run update.php and get "no pending update". Then I go to status report and all the modules appear updated but after a cron run, all the modules "go back" to the old version.

All this still happens after updating to 7.20

Any ideas?


texts: How to make custom end user text in a form available for editing for a e.g. editor role?

texts:
Within a form build in a custom module trough the form api I'm using pieces of text (eula, help, hints) of which some of them need to be editable by my client (editor role).

For example:

$form['eula'] = array(
  '#type' => 'radios',
  '#title' => t('This text need to be editable. I agree to be bound by bla bla bla.'),
  '#options' => array('Ja'=>'Ja / Yes'),
  '#required' => TRUE,
);

I want to facilitate a central point where those text strings (like #title) can be edited and a way I can retrieve them in this custom module.

What's best practice for this scenario to do so?
Create a content type for this or perhaps use variable_set/get?

Basically I want one location where my client can edit all those text strings.
To use a content type for this and node_load() everytime feels a bit too much.

Thanks in advance


texts: How to implement a secure video streaming website?

texts:
I want to create a secure Video streaming website where people need to pay to play videos and they should not be able to download directly the video.
What are the possible solution to achieve this? I know there is a flowplayer secure streaming plugin http://flowplayer.org/plugins/streaming/secure.html but is this enough?

Thanks


texts: What does features_exclude mean in a features info file?

texts:
I found this line in the *.info file of one of my feature modules.

features_exclude[field_base][field_block] = field_block

I did find a number of drupal.org issues dealing with this, but no documentation about the intended purpose.

The context of my example does not really matter; I am asking about the general meaning and implications of the features_exclude key.


texts: How do I change cardinality (delta) of nodes?

texts:
I have a content type, this content type has a Field Collection with cardinality(delta) value 1.

I want to alter it dynamically, when the node add form is rendered.
Each node add form has it different cardinality(delta) value.

Please any one help me to solve it in Drupal 7.


texts:
I'm building a site for a school, with several content types:

A Class holds the general info about a class: description, tuition, etc. One field in the Class type is an Entity Reference for an Instructor.
An Instructor is the teacher of a Class.

When adding a new Class, the user will add an Instructor using the Entity Reference field (as an "autocomplete" widget). However, I also want the list of Instructors to link to the Classes each one teaches. How do I do this without having to enter the data on both the Class page and the Instructors page?


texts: How do I add a taxonomy vocabulary to more than one menus with the taxonomy menu module?

texts:
I'd like to have two different menus based on the same taxonomy vocabulary, but the taxonomy menu module only lets me choose one menu to add the terms to.

Can I somehow add the same terms to more than one menu?


texts: drush sql-sync fails with PHP Fatal Error

texts:
drush sql-sync @devyau @stageyau returns:

  Unable to load class Drupal\Driver\Database\Drush
   PHP Fatal error:  Call to a member function dump() on a
  non-object in
  /root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc on line
  275

Drush command terminated abnormally due to an unrecoverable error.

  Error: Call to a member function dump() on a non-object in
  /root/.composer/vendor/drush/drush/commands/sql/sql.drush.inc, line
  275


texts: I am trying to develop a site with a listing for Merits and each one has a different set of requirements to be completed.  I would like to have someone that is a guest/not logged into just see a readonly version of the page and then when they log in they can see how far they are into completing it as well as seeing other users progress.  Is there a module for this already?


texts: D7 cron - Ajax getting cached by Varnish?

texts:
Somehow it never occurred to me that D7's cron is really a "poorman's cron" until I came across this previous question.

The Ajax added to a user's page requests shouldn't impact the load time of the page.
However, Google's "Page Speed" is measuring the browser load times and it can inflate your numbers. For example, I came across a request that took 80 seconds and it was reported in "Google Analytics - Site Speed".

Since I'm running Varnish isn't there also a chance that pages with the Ajax get cached an then each subsequent page requests will run cron? That would explain the "Attempting to re-run cron while it is already running." error messages I'm often seeing.

I now switched to an external cron service (can't setup crontab on Pantheon).


texts:
So I am looking at creating a website in Drupal (In the past I have used PHP and in the past few years, Symfony), however, I can not work out the workflows when it comes to approval for content.

The way the organisation will work is there will be a large number of people that will need to be able to create and edit content pages, but should not be able to publish them. Then one of the admins will look at the page and fix up any code required and make the page a bit neater, and then publish.

The first thing is, I need to know how to make a role where the user can add (not sure if adding will be required yet) and edit a page, but not publish it.

The second thing is when a page is edited and the checkbox for publishing is not selected, it unpublishes the page! That really should not be the case, it should just stay at the current revision and the saved page should just be a newer revision awaiting publishing.

I am running tests on the opensourcecms servers at the moment (with their 24hr testing system), so can not upload my own modules to the server.


texts:
I have a header in a view that should be visible only if there are no values in the exposed filters. So, once the user enters any value in any filter and sends the form, this header should not be visible. And the same for a footer in other views.

How to unset or hide a view header / footer when an exposed filter is being applied?


texts: How to show the number og members views members views

texts:
How do you show the number of members in a group using views please?

I had a look at this post bu unfortunately the relationship have changed in drupal og 7.2

How to show the count of members that belong to a group?

Many thanks for your help


texts: How to get id of selected entity in an "entity_autocomplete" form element?

texts:
I have a form element of "entity_autocomplete" type.
Also I have an ajax callback of the element.
Here is its code.

$form['autocomplete_places'] = [
            '#type' => 'entity_autocomplete',
            '#target_type' => 'node',
            '#selection_settings' => [
                'target_bundles' => ['place'],
            ],
            '#ajax' => [
                'callback' => '::autocompleteGetPlaces',
                'event' => 'autocompleteselect',
            ]
        ];

public function autocompleteGetPlaces(array &$form, FormStateInterface $form_state){
        $ajax_responce = new AjaxResponse();
/// some code here
        return $ajax_responce;
    }

Unfortunately, I can't find out how to get the id of selected entity inside the ajax callback function. For example, in my case, it would be id of a node of "place" type.

I tried to debug it, but couldn't find information about it in $form_state.

Could you clarify me, how to do it ?


texts: how to dynamically set query parameter on menu item

texts:
Hello I am a very experienced web dev who is brand new to Drupal and learning to build my first site in it.

I have a very simple site I am converting from pure code (html, css, jquery, angular, bootstrap, php) to drupal so that I can add a CMS backend to the site. On this site I need to track what ad campaign sent the user to the site to be stored with the users information later after they submit their email to be contacted again.

This is how it works currently on the non-drupal site: User clicks on a link on an 3rd party site that directs them to my-site.com/get-eBook.html?campaign=google. On get-eBook.html there is a menu item for /ebook-register.php, I use some PHP to grab the value of campaign from the URL and if it is not null I update the menu item to /ebook-register.php?campaign=google in order to pass the value along to the register page where it is used in a SQL statement and captured in the DB with the users email address.

Now I'm not sure how to accomplish the same thing in Drupal. I have my theme set up, I have two pages created (get-ebook and ebook-register) and I have my menu set up with the link to ebook-register. I however have no idea how I can grab the value of campaign on the get-ebook page and add that value onto the desired menu item being returned by the drupal core so that the value of campaign will be preserved when the user navigated from get-ebook to ebook-register.

Any ideas on how I can allow the menu to be maintained via the Drupal backend but still have the ability to dynamically add query parameters to the items after they're returned from the core?


texts: Contextual links for nodes displayed via views

texts:
When you create a node or a block you get a contextual link icon in top right of the item when hovering and etc. It is easy to edit content like that and etc.

When you create a view page and display multiple nodes via it, there are no contextual links hovering on those items and the only way to edit those is via Content.

I.e. I have a Panels page. It has a node at the top area of the page and it has that hovering icon for contextual links and it is easy to edit that node while viewing this panels page.

And then at the bottom area there's is a view which shows some grid-listed nodes too and none of those nodes has access to contextual links.

So is this possible somehow to add contextual links to nodes shown via Views?


texts:
I'm trying to "clone" all nodes of a certain taxonomy term and assign them a new taxonomy term so they can function as sections of my site.

I'm making a site where i should put all of the information of a group of careers, something like: Contact, procedures, mission, syllabus, etc. (each on a page).

The thing is: the site should host like 16 different campuses, and about 150 careers. I'm using campus as a taxonomy term so i can group all careers of a campus, and i'm using another term to group every page of a certain career.

I don't want to create EVERY page of all of the careers, and i'm thinking there should be a way to duplicate a blank set of pages of a career and do a "batch duplicate".

I would appreciate any information that can point me in the right direction.

Thanks in advance.


texts: How to display one of Drupal's default forms

texts:
I have a module that i want to use to display a modified version of one of Drupal 7's default forms. The form ID is user_profile_form and it is the form used to edit a user's account information.

So this is the structure of my module:

hook_menu with a page callback to a function --> user_exe_edit() -->
function user_exe_edit() calls drupal_get_form(input_simple_form) -->
function input_simple_form($form, &$form_submit)

Now I need the function input_simple_form to return the Drupal form with id "'user_profile_form".

How do I do that?


texts:
I have created a Panels Page but can't find out how and where to put the class for the title?
Right now it uses the core Page Title CSS but I wan't every Panels Page Title to be unique.

Edit: I've noticed that this is the way for all my panels. I can't seem to be able to set a CSS Class to Pane Titles at all.


texts: what is '#access' => $admin in this code

texts:
im want to 3 radio buttons and user select a one save it in data base and i use following code but it gives error like this

Notice: Undefined variable: admin in ounces_to_ml_form() (line 44 of C:\xampp\htdocs\drupal7\sites\all\modules\ounces_to_ml\ounces_to_ml.module).
Notice: Undefined variable: admin in ounces_to_ml_form() (line 54 of C:\xampp\htdocs\drupal7\sites\all\modules\ounces_to_ml\ounces_to_ml.module).
Notice: Undefined variable: admin in ounces_to_ml_form() (line 64 of C:\xampp\htdocs\drupal7\sites\all\modules\ounces_to_ml\ounces_to_ml.module).

$active = array(0 => t('Closed'), 1 => t('Active'));

$form['settings']['active'] = array(
    '#type' => 'radio',
    '#title' => t('every time'),
    '#default_value' => isset($node->active) ? $node->active : 1,
    '#options' => $active,
    '#description' => t('Instantly: Emailed every time a donor submits a donation'),
    '#access' => $admin,
  );
//////////////////////
//////radio 02 /////////
$form['settings']['active1'] = array(
    '#type' => 'radio',
    '#title' => t('once a day'),
    '#default_value' => isset($node->active) ? $node->active : 1,
    '#options' => $active,
    '#description' => t(' Email once a day'),
    '#access' => $admin,
  );
//////////////////////
//////radio 03 /////////
$form['settings']['active2'] = array(
    '#type' => 'radio',
    '#title' => t('at given time'),
    '#default_value' => isset($node->active) ? $node->active : 1,
    '#options' => $active,
    '#description' => t('Email a day'),
    '#access' => $admin,
  );
//////////////////////

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('save'),
  );

return $form;

i want to know what is the error and what is mean by  '#access' => $admin code line


texts: Text field formatter with link to the entity?

texts:
I have a text field that I use to store an entity title.
It is not the "native" entity title, but just a field named field_title.

Now I want to display this text field as a link to the entity (e.g. product/123).
(I am working with Display Suite here, but the question is not limited to that)

I know I could simply create a custom formatter for this. But isn't there an easier way? I think I even did this once, just can't remember.

I also found the Field Value Link Formatter module , but this doesn't seem to be it.

EDIT: There are some known solutions like DS custom fields, or Custom Formatters, or hook_field_formatter_info() in a custom module, or node template override, or field template override, or the awesome hook_ds_field_theme_functions_info().

However: This seems such a recurring use case that I consider to write a new (reusable) module and publish it. So, I am looking for a solution so easy that it invalidates the desire to write a new module :) I think I saw something like this once, just can't remember.


texts: How can I use an URL (being a field content) as a contextual filter in views?

texts:
I'm working on an academic wiki containing two types of pages: an 'Author page' and an 'Article page'. I am trying to create a block view displaying all the articles written by an author into her corresponding page. The view selects the 'Article pages' using a content type filter and I tried to use contextual filters to select the articles written by a particular author.

The difficult part is that the 'Author page' and the 'Article page' do not share a similar field for the author's name. However, when creating an 'Article page', the user has to enter all participating authors and the URLs corresponding to their respective page in the wiki.

So what I would like to do is to use the last component of this URL (the node ID of the 'Author page') and compare it to the node ID of the page the user is looking at. If the IDs match, the view displays selected fields from the 'Article pages' which have written by the author the user is looking at. But so far I have been unsuccessful in doing so, any hint on how I could perform this functionality?

I'm new using Drupal (and site building actually), so I apologize if my question lacks clarity or details.

Thanks in advance for your help!

Igor


texts:
I have created sitemap page using sitemap module to include some menu for displaying on sitemap page. Now I am unable to translate menu titles, while all the links are translated.
Also I added the translation for menu title from Edit-Menu-> Translate.


texts: Correct way to render a modules output through a template?

texts:
I usually do exclusively functionality on a site, and as such I'm familiar with php and Drupals APIs, but I'm mostly lost in the theming layers.

I find myself with these pieces of code, that "work", but doesn't look quite right to me.

// ------ Actual USE of #theme -------
$block->content = array(
  '#theme' => 'MODULE_more_information',
  'dataA' => $dataA,
  'dataB' => $dataB,
  'dataC' => $dataC,
);
return $block;

// ------ hook_theme to attach the #theme to a template -------
function HOOK_theme($existing, $type, $theme, $path) {
  $base = array(
    'render element' => 'element',
    'path' => drupal_get_path('module', 'HOOK') . '/templates',
  );
  $theme = array(
    'MODULE_more_information' => array(
      'template' => 'MODULE-more-information',
    ) + $base,
  );
  return $theme;
}

// ------ Actual template -------
<?php
extract($element);
?>

<?php print $dataA ?>

<?php print $dataB ?>

<?php print $dataC ?>

What gives me the idea that something is amiss is that the author manually runs extract(), which I've never seen a template do before.

Canonical examples of how to do this "right"?


texts:
The site becomes painfully slow at times and when I look into "Recent Log Mesaages" logs such as this is frequently found.

The Location shows:

http://example.com/sites/default/files/styles/featured/public/field/image/DPL_1.jpg?itok=JJwFY0A5

The log's Type is "page not found" and occurrence is multiple times every hour. I think this is the reason that is making the site very slow at times.
How to fix it ?


texts: How to programmatically add menu for content type?

texts: E.g. article has main menu as default, I want to add (and remove) second menu as available to article content type in my unit tests, how can I do it?


texts: How Can I do a content type with a 1:n field inside?

texts:
I'm a bit lost about how Drupal manage content.

For example, I want to create a new content type called Game. When I create a "Game" I want to introduce "Platform" and "Release date".

For example:

Title: Sonic the Hedgehog.Description: Whatever.
Released on:
Platform: Mega Drive Date: 23 june 1991
Platform: Arcade Date: 1991
Platform: Nintendo Switch Date: 2018

I want both platform and date to be keys for sorting games, so clearly platform might be a "vocabulary" in taxonomy?...I'n not really sure. How would be your take on this?


texts:
I want to show a list of links to the 5 latest news on my homepage.

I learned that I can install the Views module to make a snapshot of a content type. I also use EVA to create a EVA field from the view and attach it to my homepage content type.

Then I can intercept the value of the view in my homepage_preprocess_node but the problem is that the value is a long string containing the whole list wrapped with html.

This is bad...

I want to have full control of the html. I tried different options but couldn't find a clean, basic, barebone option.

I am expecting a value that is an array of 5 objects so I can loop throught them and generate what ever html I see fit. The object would contain the field I asked (title) and a url to get to the news page.

Of course I can remove the html tags and rebuild the array from that long string but I don't want to do that if there is a better solution. I will use that view on the "press room" page also, so I don't want to have to duplicate code in two different preprocess_node functions

Nothing is simple in Drupal...

I wanted to add "EVA" as a tag for this question but it's not available.