texts: How do I use field_view_field() to print a user profile picture?

texts:
I'm trying to print a user profile's picture in a block that gets displayed on a node page. I have the nodes author be loaded as in the following code:

<?php
$node = menu_get_object('node');
$user = user_load($node->uid);
?>

This is the code I have come up with for the block:

Meet the author

  <?php print drupal_render(field_view_field('user', $user, 'picture', 'user-pic-style'));?>

This isn't working and doesn't print anything.
I want the user's picture be loaded if users have one, or the default user picture if they don't.
I have other custom user fields that are printing just fine using the field_view_field(), so I am wondering why I am not having luck.


texts: Debugging panels visibility rule with custom access check plugin

texts:
I created a ctools access plugin for use with visibility rules in panels. When I click to add the rule, my rule "Site Installation Profile" shows in the list. I click it and click continue and my form for input of the profile name shows. I enter the name and click save only to get an AJAX error message that says the service is unavailable. If I cancel and try to edit the content of the panel, I get an error page. The error page simply says "Error" with no stack trace information. I've put in break points in my access plugin to try to debug with xdebug but it's not catching anywhere where the error is occurring and I'm not sure where to look.
Here is the plugin:

$plugin = array(
  'title' => t('Site Installation Profile'),
  'description' => t('Installation profile value check'),
  'callback' => 'llnl_form_alterations_site_profile_ctools_access_check',
  'default' => array(
    'profile' => '',
    'negate' => 0,
  ),
  'settings form' => 'llnl_form_alterations_site_profile_ctools_access_settings',
  'summary' => 'llnl_form_alterations_site_profile_ctools_access_summary',
  'all contexts' => TRUE,
);

/**
 * Actual access check.
 */
function llnl_form_alterations_site_profile_ctools_access_check($conf, $context) {
  $profile_ck = $conf['profile'];
  $profile = drupal_get_profile();
  if ($profile == $profile_ck) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}

/**
 * Provide a config form.
 */
function llnl_form_alterations_site_profile_ctools_access_settings($form, &$form_state, $conf) {
  $form['settings']['profile'] = array(
    '#type' => 'textfield',
    '#title' => t('Installation Profile'),
    '#default_value' => $conf['profile'],
    '#required' => TRUE,
  );
  return $form;
}

/**
 * Provide a summary description.
 */
function llnl_form_alterations_site_profile_ctools_access_summary($conf, $context) {
  $profile = $conf['profile'];
  return t('Show if "@profile" is site installation profile', $profile);
}


texts: Drupal Commerce: Get selected payment method programmatically

texts:
Is there any way to get programmatically the selected (by customer) payment method from the $order_wrapper variable in Drupal Commerce?

$order_wrapper = entity_metadata_wrapper('commerce_order', $order);


texts: What's the difference between landing pages and panel pages?

texts:
I'm trying to create pages (like 'Questions', 'Tags'... on top of this website). I thought the best way to do this is to use the Panels module. The Panels module has two types of pages: landing pages and panel pages.

What's the difference between them and which one's the best to create static pages?


texts: Problem with programmatically creating a redirect

texts:
Background

Client has Event webforms hosted externally by a marketing automation service, leading to an unusual situation: a node of Event content type should have its summary displayed in certain Views on the client site, but navigating directly to the node address should result in a 301 redirect to the offsite form.

Client can achieve this manually by using the Redirect module:

/admin/config/search/redirect/add?redirect=node/1234

... and then entering the node path in the From field and the offsite destination in the To field. (Yes, this is exactly backwards, but it kind of works.) However, they would like to automate this process.

I tried to do this with Rules:

Events:

After saving new content of type Event
After updating existing content of type Event

Conditions:

NOT Data value is empty (Parameter: Data to check: [node:field-external-url])

Actions:

Page redirect (Parameter: URL: [node:field-external-url])

Unfortunately, this does not modify the Page Redirect settings on the node by adding an entry to the redirect table in the database.

Instead, it fires a one-time system event and redirects the site administrator to the desired URL at the moment that the Event content node is created or updated. Subsequent visits to the node URL do not redirect site visitors; instead, they see the node at that URL.

So, I'm trying a different approach, with a small custom_event_redirect module:

/**
 * Implements hook_form_alter().
 */
function custom_event_redirect_form_alter(&$form, &$form_state, $form_id) {
  // add submit handler only to Event content forms
  if ($form_id === 'event_node_form') {
    array_unshift($form['#submit'], 'custom_event_redirect_search_form_submit');
  }
}

/**
 * Drupal FAPI submit handler implementation
 */
function custom_event_redirect_search_form_submit(array $form, array &$form_state) {
  if (!empty($form['field_external_url']['und'][0]['value']['#default_value'])) {
    //create redirect programmatically

  }
}

Is it possible to use the Redirect API to fire off a redirect_edit_form_submit() when the event_node_form is submitted?

This is such an edge case. Google results are skewed heavily toward drupal_goto() redirects after form submission -- but if that was what I wanted, I could have used Rules.

I don't want to fire off a one-time redirect on form submission; I want to add an entry to the redirect table on form submission.

¯\_(ツ)_/¯


texts: Custom preprocess_function does not fetch translated value of the content type

texts:
Drupal 7.34 core
Using custom theme from Themebrain TB Sirate
Multilingual setup works properly
Content type has both English and Russian values

English Language mode: When open/viewing a node, page-title display content type that is "Article" (English)

Russian Language mode: When open/viewing a node, page-title display content type that is "Article" (still English, must be Russian)

Question how to display Russian value of content type.

Here code from preprocess_funcion.inc of the custom theme

/**
 * @file
 * Override of theme_preprocess_...
 */

function tb_sirate_preprocess_html(&$vars) {
  $current_skin = theme_get_setting('skin');
  if (isset($_COOKIE['nucleus_skin'])) {
    $current_skin = $_COOKIE['nucleus_skin'];
  }
  $vars['classes_array'][] = !empty($current_skin) ? (" " . $current_skin . "-skin") : "";
}

/**
 * Override or insert variables into the page template.
 *
 * @param array $vars
 *   An array of variables to pass to the theme template.
 */
function tb_sirate_preprocess_page(&$vars) {
  if (isset($vars['node'])) {
    if ($vars['node']->type != 'page') {
      $result = db_select('node_type', NULL, array('fetch' => PDO::FETCH_ASSOC))
        ->fields('node_type', array('name'))
        ->condition('type', $vars['node']->type)
        ->execute();
      foreach ($result as $item) {
        $vars['title'] = $item['name'];
      }
    }
  }
}

/**
 * Override or insert variables into the node template.
 *
 * @param array $vars
 *   An array of variables to pass to the theme template.
 */
function tb_sirate_preprocess_node(&$vars) {
  $vars['page'] = ($vars['type'] == 'page') ? TRUE : FALSE;
}

It seems to me that problem is here

    function tb_sirate_preprocess_page(&$vars) {
  if (isset($vars['node'])) {
    if ($vars['node']->type != 'page') {
      $result = db_select('node_type', NULL, array('fetch' => PDO::FETCH_ASSOC))
        ->fields('node_type', array('name'))
        ->condition('type', $vars['node']->type)
        ->execute();
      foreach ($result as $item) {
        $vars['title'] = $item['name'];
      }
    }
  }
}

What can I do to pull Russian value of the content type from DB?

Thanks in advance for any help!


texts:
I'm using this code in a for loop to push items to an array but it doesn't add to the array, just overwrites it each time I think:

drupal_add_js(array('THINGS' => array('ONE' => array('VAR' => $var_one), 'TWO' => array('VAR' => $var_two), 'THREE' => array( 'VAR' => $var_three))), 'setting');

So this is what I end up with:

"THINGS":{"ONE":{"VAR":"blah blah blah"},"TWO":{"VAR":"blah blah blah two"},"THREE":{"VAR":"blah blah blah three"}}

When what I want is this:

"THINGS":{"ONE":{"VAR":"blah blah blah", "VAR":"blah blah blah one"},"TWO":{"VAR":"blah blah blah two","VAR":"blah blah blah two two"},"THREE":{"VAR":"blah blah blah three","VAR":"blah blah blah three three"}}

So I guess my question is, how do I print objects within objects using this method, or would it be easier to just push the variables with javascript within a script tag?

Any ideas? Am I doing this right?


texts:
I'm trying to add a sub-menu under administration, for example:

Management:

  ......
  Content
  Structure
  ......
  My test (sub menu under administration)

      My view 1 (a view that I created)
      My view 2 (another view that I created)

Under structure-> menu, I see that I can create a new menu and add link to existing menues, but I cannot understand how can I add a sub menu to Management.
Note: I'm using Drupal 7.

Edit:
I added a link (My test) under management (Like in @Clive's answer) with path admin/test
under My Test I created another link with path admin/test/form-view-test-3 and also gave that path to the view.

When I click on My menu I what to see a list of subcategories, in my case Some view.
Instead Test 3 (The View) appears as overlay tab and I see the list of admin menus.


texts: How do I execute code before update the content?

texts:
How do I execute code before updating nodes?

I am looking for a hook to use in a custom module.

I have created a content type. What I need to do is execute a hook before updating any content. I want to keep the history of every content, so I want to execute some code before updating, which will compare previous and currently update record. If there is any change, I want to insert it in another table.

I also want to show that history on the content detail page.


texts: How to call fields individually like this in Twig template?

texts:
I'm familiar with the Drupal 8 theming API,as well as all of the theme template suggestions available when Twig debug is enabled. I have created content type named (machine name) events .For overriding node.html.twig I have made node--events.html.twig . In this (node--events.html.twig) file I am trying to get individual values like below:
{{content.body}}
But it returns null . I have also tried {{ node.field_machine_name.value }} but It is not working for all the fields .


texts: How to create the slideshow as the background slideshow using drupal 7?

texts: We are currently developing a single page responsive site in drupal 7.In our home page we tried implementing slideshow through view slideshow module (drupal 7). The slideshow is working perfectly fine. I want to know how to create a background slideshow using views slideshow?


texts: I need to be able to include block in the content of a node. I use display suite to accomplish this, but just wondering if is there something like block_field?


texts: Calendar widget translate problem on Drupal 7

texts:
I am experiencing issues with the translation of the Date/calendar Widget for Drupal 7 and I wonder if there is a solution for this problem without mixing with the source code for the date/calendar module, or if maybe I am missing some point here.

Here are the initials for the week days in the little calendar in English:

M - Monday
T - Tuesday
W - Wednesday
T - Thursday
F - Friday
S - Saturday
S - Sunday

In Portuguese, the same week days are:

S - Segunda-feira
T - Terça-feira
Q - Quarta-feira
Q - Quinta-feira
S - Sexta-feira
S - Sábado
D - Domingo

The problem is that when I translate the 'T' (Thursday) to 'Q' (corresponding to "Quinta-feira"), both days starting with a 'T' in English are translated as 'Q' in Portuguese. Both Tuesday and Thursday are shown with a 'Q' on top, and that of course is plain wrong for displaying the calendar in Portuguese.

Is there some built-in localization/translation feature for the calendar that doesn't use the Drupal translation tool that does not seem to work in this case?

Thank you.


texts: How to set "Entity has Field" when the Rules Event is unrelated to the entity?

texts:
In Rules, I am trying to update/calculate a field in the User's account upon completion of a commerce payment.

The condition data selector obviously only wants to populate commerce related fields, since my Event is "After saving new payment".

How can I define my custom field in the Rules Conditions?

My attempts to set the user or current-user entity has field are unsuccessful. But I know this must be simple.


texts: Page rendered correctly but display errors

texts:
Page was rendered correctly but it display the following error message:

Strict warning: Only variables should be passed by reference in include() (line 31 of C:\xampp\htdocs\mysite\sites\all\themes\mytheme\templates\page.tpl.php).

I have a image field name field_header_image and I want to used the image as the header background image in my page.tpl.php. here is my code

<div id="hero-container" class="hero-container" style="background:linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), url('<?php echo render(file_create_url($node->field_header_image['und'][0]['uri'])); ?>');">

It display correctly and I can use the field image as my header background but it display the above error. Is there a better way to get rid of this error without using a module.


texts: How to access library version details in JavaScript

texts:
I have a theme with library file looks like this:

global:
  version: 1.0.0
  js:
    js/global.js: {}

global.js has some functionality specific to version 1.0.0.

Is there anyway to get this version number? Is it available in JS?


texts: Create custom front page without adding content

texts:
I am trying to create a custom welcome front page, it should contain two parts (left block and right block).

Each block has a background image (editor can upload), a logo (1 logo for each block), a description text...

Creating a new content type, is not a good idea in my opinion, because I don't like editors to add as much as they want nodes of that content type, so it should be only one content the editor can edit it each time he want to edit the background or logo...

I am thinking of creating a new setting form for this specific front page content containing those fields in a custom module. In this case, can I use picture module to make the background load a responsive image and not the default one uploaded by the editor ?

Thanks in advance.


texts: Why won't my custom content field update on save/edit?

texts:
I am building a custom content type programmatically within my module. Everything appears as I thought it would on the "Add Content" page, but whenever I create a new piece of content or edit the created content the data from the field is not being saved. When I go back into the content nothing is there.

What am I missing? Is there a better approach? I wanted to keep the scope of this module inside of the related "Add Content" page because it needs to be able to follow the Drupal Workbench workflow.

On .install:

function header_maker_enable(){
  $contentType = "brand_header";
  $readableType = "Brand Header";
  $type = node_type_load($contentType);

  //Verify that the content type has not already been created once for this module
  if(!$type){
    $type = array(
      'type' => $contentType,
      'name' => t($readableType),
      'base' => 'node_content',
      'description' => t("Test"),
      'custom' => 1,
      'modified' => 1,
      'locked' => 0,
    );

   $type = node_type_set_defaults($type);

   //Creating Custom Test Field
   $field = array(
    'field_name' => 'brand_header_config',
    'type' => 'text',
    'entity_types' => array('node'),
  );
  $field = field_create_field($field);
  $instance = array(
    'field_name' => 'brand_header_config',
    'entity_type' => 'node',
    'bundle' => 'brand_header',
    'label' => t('Test Field'),
    'widget' => array('type' => 'text_textfield'),
  );
  $instance = field_create_instance($instance);

  node_type_save($type);
}

}

Here is my .module file. Something a bit more tricky is going on here with some JS. Basically I am rendering a UI to create some JSON. That JSON is then being added to the input field that was created on install in real time.

function header_maker_form_brand_header_node_form_alter(&$form, $form_state, $form_id){
  if ($form_id == 'brand_header_node_form') {
  $form['header_maker_ui'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
  );
  $form['header_maker_render'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
  );

$order = array(
'header_maker_render',
'brand_header_node_form',
'brand_header_config'
  );

  foreach ($order as $key => $field) {
// Set/Reset the field's
// weight to the array key value
// from our order array.
$form[$field]['#weight'] = $key;
  }
  }
  return $form;
  }

function header_maker_preprocess_page(&$vars, $hook){
  if(isset($vars['page']['content']['system_main']['#form_id'])){
$formid = $vars['page']['content']['system_main']['#form_id'];
if($formid == "brand_header_node_form"){
  drupal_add_css(drupal_get_path('module', 'header_maker'). '/css/brand-header-form.css', array('group' => CSS_THEME, 'every_page' => FALSE));
  drupal_add_js(drupal_get_path('module', 'header_maker') . '/js/header_maker.js');
}
}
}


texts: Omega theme, global css and the lack of grid at global.css

texts:
It seems that I misunderstood one major feature of the Omega theme. From what I see, the mobile-first basic css file  - global.css - ignores the grid layout altogether and stacks elements one over another. Am I correct, or am I missing something? Does that mean that all the zones and regions will be rendered in a top-down manner with no width control?

I feel that my question is quite vague; I'd be most grateful links towards some relevant documentation and how-tos regarding the pure global.css design. I feel that most of the docs concentrate on structure of the zones& regions, while there's little sugestions as to how to make global.css work good by itself.
Thanks for your attention


texts: Can you export and import templates for multi-site use?

texts: Is there a way to take a form built on one site, save it as a template, and use it on another site? Currently all themes and modules are shared so I assumed the Webform Tempaltes would be available on all 3 sites but they are not. Is there a way to do this? This is running on Drupal 8 btw.


texts: Create a field programatically with let me to introduce two values

texts:
I don't want to use field_collection ;) I'll be easy.

I want to build a module that create a a field that let me to save two values at the same time, name and date.

I'd like to have both in the same table, but I don't find any article that explain how to make/define it.

It will be a field with two fields to fill in a node.

Any idea?

Thanks.


texts: Interface 'DatabaseStatementInterface' not found - Commerce Kickstart Installation

texts:
I am trying to set up Commerce Kickstart distribution on a machine with following config:

Apache 2.2.5
PHP 5.5.5
MySQL 5.1.71
Oracle 11g

I see the welcome page at http://example.com/install.php?profile=commerce_kickstart but as soon as I click on I accept, the next page is a white screen.

I am seeing the following in the error logs:

[Thu Feb 27 03:18:18 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.5.5 configured -- resuming normal operations
[Thu Feb 27 03:18:29 2014] [error] [client 10.16.194.146] PHP Fatal error:  Interface 'DatabaseStatementInterface' not found in /var/www/html/includes/database/prefetch.inc on line 22, referer: http://example.com/install.php?profile=commerce_kickstart
[Thu Feb 27 03:24:51 2014] [error] [client 10.16.194.146] PHP Fatal error:  Interface 'DatabaseStatementInterface' not found in /var/www/html/includes/database/prefetch.inc on line 22, referer: http://example.com/install.php?profile=commerce_kickstart
[Thu Feb 27 03:24:52 2014] [error] [client 10.16.194.146] File does not exist: /var/www/html/favicon.ico
[Thu Feb 27 03:24:52 2014] [error] [client 10.16.194.146] File does not exist: /var/www/html/favicon.ico
[Thu Feb 27 03:26:42 2014] [error] [client 10.16.194.146] script '/var/www/html/install.php' not found or unable to stat, referer: http://example.com/install.php?profile=commerce_kickstart
[Thu Feb 27 03:26:46 2014] [error] [client 10.16.194.146] Directory index forbidden by Options directive: /var/www/html/

PHP Info shows that MySQL is configured.

Can anybody point to what the problem may be?


texts: Calculate Database Field Value and Send to Views as New Field

texts:
I have a database field which stores a timestamp. This timestamp is sent to a custom views provider via hook_views_data(). This timestamp field is created as a date field to utilize the date format options from views.

$data['module']['timestamp'] = [
  'title' => t('Timestamp'),
  'help' => t('Timestamp from module'),
  'field' => [
    'id' => 'date',
  ],
  'sort' => [
    'id' => 'date',
  ],
  'filter' => [
    'id' => 'date',
  ],
];

In another views field (but with the same DB field), I would like to get the raw field value and run it through something like:

if (field_value > (time() - 800))

This is a custom module and would prefer not to have any more dependencies. Can this be achieved with hook_views_data() or hook_views_pre_render() or such?

I know there is a contributed module https://www.drupal.org/project/computed_field, but again hoping there is a way in those hooks, or in the view...

The DB table is created with hook_install() and the desired timestamp field output after check would be markup. Happy if it is just sent as markup to the views field.

I've figured how to access the field values with hook_views_pre_render() as such:

function hook_views_pre_render(&$view) {
  $result = $view->result;
  foreach ($result as $key => $row) {
    kpr($result[$key]->field_name);
    if ($result[$key]->timestamp > (time() - 800)) {
      // Can I do anything here?
    }
    else {
      //
    }
  }
}

Unfortunately, that is not the most important piece of the puzzle. And it is not possible to just add $data['module']['key'] to my hook_views_data() as this requires the unique DB field to exist.

In my use case, I'd be happy if I could rewrite the original timestamp field and append this markup to it.


texts: How to print Global:view using php code in drupal view?

texts:
I have two views called contents where I am displaying Albums and videos, another view is photos count where I am displaying photos count of specific album. I have included "photos count" view into the "contents" view using Global:view now i want to print the included view using php code only if the content type is "ALBUM". I have written below code which is not working. What's wrong with my code?

$result="";
$nid=$row->nid;
$result=count(views_get_view_result('album_count','panel_pane_3 ', $nid));

$node = node_load($nid);
$type = $node->type;
if($type=="album")
{
  print "Total Number of Photos : ".$row->view;
}


texts: How to create custom search filter for entity list

texts:
I want to make my entity list/table searchable, but the docs are not helping. I created custom module that generates

My table:

I have entity Event and it has NAME variable. The result i want to get is like in domain/admin/people - Search by name


texts:
I have an use-case where a large associative array is getting generated while saving a node. The array is for a specific content type. I want to save the array along with the node.

While saving all the values of an array to different fields is not practical; Should I parse the array and save it as a string to a certain field so that I can get the array back while fetching?

If so, which one would be better : serialize or json_encode.

While I heard serialize is not reliable all the time, json_encode's purpose is not the same what I am going to use.

Briefly, I want to store a dynamic associative array against a node.

Any suggestion?


texts: Importing pages with different node ids to the live site

texts:
We have a site in drupal 6.

It's placed in 2 different server with separate databases. One is used for staging and the one is used for live.

We have created a new language section and imported the data with xliff tool to the staging. We have completed the modifications in staging and now we need to push them to live.

But the thing is that the node id's are different in staging and live, and also some pages contains view , block and nodes.

And also I must say that I am a newbie in drupal.

I would appreciate if someone could show me a way to import this new language pages to the live site without using xliff.

Thanks in advance


texts: How to theme help text of field groups in node form

texts: I put some HTML tags in the help text of field groups in node form but HTML tags are automatically removed after saved the change. It seems that also there is no selection list of input format for help text. Is there any way to theme it?


texts: Combine multivalue field rows with copy of same multvalue field

texts:
Having a list of pdfs using pdfpreview for image-preview I want to add an additional formatted text-field to this ouput.
That's why I've created a copy of this field with a different formatter (e.g. rendered entity).
As this is a multivalue field I want to combine the values means having the new text-field underneath every preview-picture instead of having all preview pictures first and all rendered entities afterwards.


texts:
I'm inserting values using user_save(). I have used this, but it is returning the wrong values.

SELECT LAST_INSERT_ID() FROM <table name>

How can I get the ID of the last record user_save()inserted?


texts: Expand sub-menus on hover in a menu block

texts:
I need to show menus expanded in the sidebar. I used the menu blocks to show the submenus. But now the problems is when I hover on the parent menu initially it is not showing the submenus which was appearing before.
And also submenus is expanded only when click the parent menu which then lists all the submenus with expanded.

Please tell me how to show the submenus on hover in menu blocks when the submenus are not expanded


texts: Adding a taxonomy drop down to drupal search

texts: I am trying to add a drop-down containing taxonomy terms to my site's basic search. I have created a taxonomy term category and used search auto-complete module for providing auto-complete search functionality. Can anyone suggest me how to add taxonomy drop-down besides the search button on the search block and relate the drop-down selection with search text.


texts: Is there a limit on the size or number of conditions in Webform 7.4.12?

texts:
I have been using Webform with Conditions for a year or more and the Conditions work fine on small forms.  Indeed I have several other small working forms using conditionals live on the site at the moment and these work as designed and expected both for Administrator and Authenticated Users alike.

But in the case of a much larger Form (essentially a similar Form with more of the same as the ones that work), it works fine in development for the Administrator, but few or none of the Conditionals work for Authenticated Users.

In desperation:

deleted all the Data in the Form AND
the Field definitions in the Webform AND
all the Conditionals AND
then re-created them all afresh.

This took 4-5 hours again without any success.

I now seem to have exhausted my testing regime on the Form setup itself trying to resolve the problem.

This is weird because the form works correctly for Administrator but not Authenticated Users, so this leads me to believe that there is a limit somewhere in the Webform code that limits the extent of a large number of Conditionals for Authenticated Users, but not Administrators?  Because it is not a basic permissions setup issue, because it works correctly with small forms.

Can anybody throw any light on this please?


texts:
I have an Entity Reference Field attached to a Content Type.
This field references Views, and has a field format of Entity ID

When I am logged in, the field appears fine, however it does not appear when I am logged out, it does not even display template tags when debug is turned on, so it seems it is getting skipped all together.

Other Entity Reference fields appear fine when logged out (taxonomy, webform etc), and if I use the views_embed_view function, it appears fine.

There are also no field level permissions set.

This did used to work, but somewhere along the line there must have been an update that causes this issue.

Im on 8.5.6 and the latest version of the entity module.

Thanks.


texts:
I am using the services module. When I call domain.com/json/node/3 is it possible to ask for a specific view mode of the node ?

Something like this ?

domain.com/json/node/teaser/3

Thanks!


texts:
I'm not a drupal developer and have very little experience using it, but I've been given a report for a site which says that on a page containing a form the form_build_id is a blind sql injection threat.

From what I've researched the form_build_id is used to cache a particular build of the form.

Does that mean form_build_id value is stored in the DB?

Here is the true payload as an example

form_build_id=form-U_SzHrwRwu2gzwSHtjxrteopmMjv7DHL9Kct1PePW1s%20or%204%3D4%20-- %20

False payload

form_build_id=form-U_SzHrwRwu2gzwSHtjxrteopmMjv7DHL9Kct1PePW1s%20and%204%3D3%20-- %20

the site is running on drupal 7.37 and has this patch applied https://www.drupal.org/SA-CORE-2014-005 (by checking line 739 of database.inc)

Thoughts on solving this or maybe it's a false positive?


texts:
For development I use a local Drupal 7 installation on Xampp under Windows 10. I use Visual Studio Code as IDE and want to debug my PHP code with it. I tried to set that up but can not quite get it working. This is my configuration:

Xampp installation path: c:\xampp
PHP: c:\xampp\php (version PHP 7.3.17 64bit)
Drupal files: c:\xampp\htdocs

php.ini additions:
[XDebug]
zend_extension = "c:\xampp\php\ext\php_xdebug-2.9.6-7.3-vc15-x86_64.dll"
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
xdebug.remote_cookie_expire_time = 36000

VS Code launch config:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "runtimeExecutable": "c:\\xampp\\php\\php.exe",
            "pathMappings": {
              "c:\\xampp\\htdocs": "${workspaceFolder}"
            },
            "xdebugSettings": {
              "show_hidden": 1
            }
          }
    ]
}

I downloaded the correct xdebug DLL and put it in:
c:\xampp\php\ext\php_xdebug-2.9.6-7.3-vc15-x86_64.dll
In my Chrome browser I installed the "XDebug Helper" extension.
In VS Code I installed the XDebug extension and set a few breakpoints in my code.

Then I open my Drupal site in Chrome and hit debug in the XDebug Browser extension.
The breakouts don't get deactivated as "unbound" but the debugger does not stop at any of them either.
What am I missing?


texts: How can I change the items order in a pulldown list of filter in views?

texts:
Hello Drupal community.

I have a question about Views.
I have a “People” view with a role filter and the pulldown list for this filter look like this:

Administrator
Editor
Approver

I would like to know if it is possible to change the order of items in the pulldown list to make it look, for example, like this:

Administrator
Approver
Editor

Thank you.


texts:
I'm building on Commerce Kickstart 2. The problem is that for shipping it displays only flat price, there is no tax amount calculated seperately.

Is it possible to shipping like:

Express shipping subtotal 10€
Shipping tax 23% 1,23€
Total: 11,23€

Or show shipping as line item so that shipping tax is calculated to product taxes amount?


texts: Is there any SIMPLE way to hide errors ONLY for anonymous users?

texts:
In almost all the times I searched for literature about disabling system errors\bad-notifications ONLY for anonymous/non-admin users, the result was large-scale discussions with seemingly pretty different answers involving honorable code changes. But me, I have yet to acquire serious knowledge in PHP... Is there really no SIMPLE solution out there for someone like me? One that will include an external module or pasting a simple code snippet in one of the TPL files?

I do not want to go to `admin/config/development/logging' and then click "none", because this option there cancels errors FOR ALL users, and not just for anonymous\non-admin ones.

Do you have such a simple, detailed explanation of how to do it?

This is a typical error message I would like to hide:

And here are some more details about it:


texts: Is Sweaver module compatible with Domain Access module?

texts: I'm configuring a Domain Access website and having some issues on making Sweaver module working as it suppose to be. I see that Sweaver back end is configurable based on domain. What about the switch theme feature? Is there any known compatibility issue between these two modules?


texts: Vote up/down module undefined constant errors

texts:
I recently have been trying to create a site for people to submit encryption algorithms to be tested. I wanted to make a voting process similar to Stackoverflow.

The best looking module I found was called the vote up/down module.

I installed it on a fresh install of Drupal 7, along with the answers module and answers userpoints, however when I enable it on a question, I get the following error:

Notice: Use of undefined constant NODE_BUILD_PREVIEW - assumed 'NODE_BUILD_PREVIEW' in vud_node_node_view() (line 147 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).
Notice: Use of undefined constant NODE_BUILD_SEARCH_INDEX - assumed 'NODE_BUILD_SEARCH_INDEX' in vud_node_node_view() (line 148 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).
Notice: Use of undefined constant NODE_BUILD_SEARCH_RESULT - assumed 'NODE_BUILD_SEARCH_RESULT' in vud_node_node_view() (line 149 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).
Notice: Use of undefined constant NODE_BUILD_RSS - assumed 'NODE_BUILD_RSS' in vud_node_node_view() (line 150 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).
Notice: Undefined property: stdClass::$build_mode in vud_node_node_view() (line 152 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).
Notice: Undefined variable: a3 in vud_node_node_view() (line 161 of /var/www/crackmycode2/htdocs/sites/all/modules/vote_up_down/vud_node/vud_node.module).

and, when I go into the voting details tab, I get a WSOD.

Here is a screenshot of the actual error:

Is this just because I set something up wrong? Is there a library that is missing? Is there a patch that is required to be installed?


texts: Use static function as operations with batch API

texts:
I can't get batch to work with a static method as callback function for the operation

$batch['operations'][] = ['MyController::MyMethod', [$arg]];

If I use a procedural function and call a static method from that, it works.

It could be a solution, but as I have several methods to call during the same batch, I don't want to create a wrapper function.

Does someone know how to make batch API work with static methods?


texts: login form generated by drupal_get_form('user_login_block') does not log in

texts:
I have a custom module part of which builds a block with the login form

function my_module_block_view($delta = '') {
  switch ($delta) {
    case 'awsImage_public_info_forms':
      $user_login = drupal_get_form('user_login_block');
      $out = drupal_render($user_login);
      $block['content'] = $out;
      break;
    }
  return $block;
}

Form shows up on the page I have set the block to, BUT it will not log in. I can add and incorrect username / password and I'll get a drupal status error about the incorrect username, but when the login details are correct, it will not log in - the page will reload with "?destination=node/1137" - node/1137 is the node I am using the block on. Admin pages just show access denied.

I can log in via /user and there are no watchdog messages.


texts: How to create a view with 1 item in left column and 2 in right column?

texts:
I need to make a view of featured content. I'd like to make it so that two columns display: the left column with one item, and the right with 2 items. Essentially like this spot:

I've been trying with some different layouts, but for some reason this is escaping me. It can't be that hard, can it?

EDIT: I may not have been clear enough in my original post. The answers given so far seem to refer to formatting the fields in different positions, so that for each piece of content, field A would be on the left, and fields B and C on the right. That is not what I need.

What I need is instead of displaying three fields in this format, I need to display three pieces of content in this format. For this view, each image links to a different piece of content, so I'm only using a single field. I need to display the image for node A on the left, and images for nodes B and C on the right.


texts: How to redirect to frontpage from a controller

texts:
Right now I'm doing this ugly thing to get the url of the my set frontpage (skipping validations and making sure it exists since I'm not sure if I'll even use this approach)

$url = $this->config('system.site')->get('page')['front'];
return new RedirectResponse($url);

This works but seems ugly, bloated and wrong.

Update:

As pointed out in the comments, this may be a matter of personal taste, therefore the question would be deemed subjective and it can be closed. It surely isn't a duplicate, I'm not asking how to redirect in general, it's a specific redirection, perhaps I could've worded it differently.


texts:
i'm trying to override some fields in commerce_products_ui form in my-module, i need to 'disable' or 'hide' some fields, this question is similar to this one, it does not have an accepted answer and it does not work, i think the problem is that form_id is incorrect, code does not even dpm($form), i've google arround looking for correct hook and form_id, but nothing helpfull came up, i use my_module_form_alter() because i use it to modify several forms, i stripped other forms code, this is my code:

 function my_module_form_alter(&$form, &$form_state, $form_id) {
          global $user;
          //$account = $user;
          $uuid = $user->uid;
    /*  check that user is NOT admin (No1) */
      if ($uuid !='1') {

           // FIRST ATTEMPT
           if ($form_id == 'commerce_product_product_form') {
               //dsm($form);
               hide($form['commerce_price']);
               $form['field_my_field']['#disabled'] = TRUE;
            }

            // SECOND ATTEMPT
            if ($form_id == 'commerce-product-ui-product-form') {
                //dsm($form);
                hide($form['commerce_price']);
                $form['field_my_field']['#disabled'] = TRUE;
             }
        }

comments on my code: inspecting code in mozzilla it says formd_id = 'commerce-product-ui-product-form' (second attempt in my code), but from a very old commerce issue  answered by Ryan Szrama he suggest to use 'commerce_product_product_form' instead (first attempt in my code), any help will be very appreciated. regards.


texts: How to display a block in the webform confirmation page?

texts:
I'm looking for a way to display a block (a view) in the page that is displayed when a webform is submitted.
This is the url of the confirmation/done page :

domain.com/node/*/done

I can't figure out a way to target this url structure by using the Show block on specific pages or context path settings.

Any ideas ?


texts: How do I get the current language in custom user edit Twig file?

texts: I have a custom user profile edit twig file.How can i check current language code in user twig file in drupal8?


texts: How to make an entity reference field an editable field in views

texts:
I have a view that displays entity references. Entity references are assigned via select list and are filtered by a seperate entity reference field.

I installed the Editable Views module so that I can directly edit the field from the view.

Even though the admin user has all the right permissions set up, they are still only able to see the entity reference field displayed on the view, but not actually edit it. Is there a conflict between the two modules? Or is there some kind of extra setting that I am missing.


texts: Enumerate content in custom view template

texts:
I am very new in Drupal. I am using Drupal 7.
I would like to create a custom rendering for a view I have created.
Thanks to many posts found on the internet I have already done the following steps:

Created a content type with Title and URL (it simulate a link list)
Added 4 items of this content type
Created a view which return items of my content type unsorted
Thanks to the Theme Information link I have created a template named views-view--xxxx--page.tpl.php where xxxx is the name of my view.
I have added the following code to the TPL file

Sample Title

And this works perfectly because I am seeing the Sample Title text when navigating on the page. I want now to enumerate the list of content item produced by the view but I dont know how to enumerate them. I have tried with

<?php foreach ($rows as $id => $row): ?>

<?php print $view->render_field('field_url', $id);?>

<?php endforeach; ?>


texts: How do you keep the login block on the same page when validation fails?

texts: On pages where the login block exists, I need to stay on that page (and preserve query string arguments) if the validation fails when submitting the form.  Does anyone have any idea how this could be done?


texts: show messages of drupal_get_form loaded forms in custom module

texts:
In my case I use drupal_get_form in my custom module in order to load forms from other modules and show them combined in one page (menu callback). So in my custom module I have

  function mymodule_claim_menu() {
    $items['profile_edit/%user/%'] = array(
    'title' => 'Edit profile',
    'page callback' => 'connections',
    'page arguments' => array(1,2),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
    'file' => 'node.pages.inc',
    'file path' => drupal_get_path('module', 'node'),
  );
 return $items;
}

function connections($account,$tab = "profile") {
  $link_output = array();
  $rss_output = array();

  $link_output['linkedin_settings']= drupal_get_form('linkedin_user_enable_form', $account->uid);

  $rss_output['rss_input'] = drupal_get_form('activitystream_accounts_form', $account);

  $output = array_merge($link_output,$rss_output);

  return $output;
}

The (simplified) code above works fine except status messages (drupal_set_message) not getting displayed when a user submits one of the forms. I realise from the previous posts that it's something with the order but I'm not sure what I can change to make it work. Any suggestions?


texts: Two collapsible fieldgroups. When I open one of this collapsible fieldgroups, the other closes and reverse

texts:
Is a question about the Field group module.
I have two field groups with the "Div" format. The two fieldgroups are collapsible. What I want to get is that when I open one of this collapsible fieldgroups, the other closes and reverse.
I asked this same question in the forum module issues, but got no answer except that would make it in this forum, which is more appropriate. I think that is a question about js or css, and I tried one and thousand tutorials, but I have not managed to find the solution…

What i have to do to get this?
Could anyone help me (please)?


texts: How to bring custom block theme suggestions into the right hierachy?

texts:
I have to create theme suggestions for my content block types (custom blocks - configured via admin/structure/block/block-content/types), because i didn't find them as default suggestions.

The default was:

FILE NAME SUGGESTIONS:
* block--registernowheaderblock.html.twig
* block--block-content--7bd0dc95-f2ee-4e70-8a5a-90d718384712.html.twig
x block--block-content.html.twig
x block--block-content.html.twig
* block.html.twig

block--block-content.html.twig is not enough, because i need different custom block type templates. (Btw. 2 times block--block-content.html.twig?)

I need:

FILE NAME SUGGESTIONS:
x block--block-content--header-content-block.html.twig
* ...
* block.html.twig

So i tried in the theme file:

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */

function MYTHEME_theme_suggestions_block_alter(array &$suggestions, array $variables)
{
    $block = $variables['elements'];
    $blockType = $block['#configuration']['provider'];
    if ($blockType == "block_content") {
        $bundle = $block['content']['#block_content']->bundle();
        $suggestions[] = 'block__' . $blockType . '__' . $bundle;
    }
}

This brings up:

FILE NAME SUGGESTIONS:
x block--block-content--header-content-block.html.twig
* block--registernowheaderblock.html.twig
* block--block-content--7bd0dc95-f2ee-4e70-8a5a-90d718384712.html.twig
* block--block-content.html.twig
* block--block-content.html.twig
* block.html.twig

Nice - but my suggestion is higher then the id based ones for single blocks - not good ... so i added

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function oeb_theme_suggestions_block_alter(array &$suggestions, array $variables)
{
    $block = $variables['elements'];
    $blockType = $block['#configuration']['provider'];
    if ($blockType == "block_content") {
        $bundle = $block['content']['#block_content']->bundle();
        $blockUuid = $block['content']['#block_content']->uuid();
        $blockId = $block['#id'];
        $suggestions[] = 'block__' . $blockType . '__' . $bundle;
        $suggestions[] = 'block__' . $blockType . '__' . $bundle . '__' . $blockId;
        $suggestions[] = 'block__' . $blockType . '__' . $bundle . '__' . $blockUuid;
    }
}

Result

FILE NAME SUGGESTIONS:
* block--block-content--header-content-block--7bd0dc95-f2ee-4e70-8a5a-90d718384712.html.twig
* block--block-content--header-content-block--registernowheaderblock.html.twig
x block--block-content--header-content-block.html.twig
* block--registernowheaderblock.html.twig
* block--block-content--7bd0dc95-f2ee-4e70-8a5a-90d718384712.html.twig
* block--block-content.html.twig
* block--block-content.html.twig
* block.html.twig

This is not nice, because of the doubled id stuff - is it possible to get something like:

FILE NAME SUGGESTIONS:
* block--registernowheaderblock.html.twig
* block--block-content--7bd0dc95-f2ee-4e70-8a5a-90d718384712.html.twig
x block--block-content--header-content-block.html.twig
* block--block-content.html.twig
* block.html.twig

Means: Single blocks are the highest - but unique? Or should i live with this to keep the stuff simple?


texts: How can I display filter guidelines/tips below field for text formats?

texts:
I want reverse of these
https://www.drupal.org/project/drupal/issues/2098071
https://www.drupal.org/project/drupal/issues/1340860
It can be achieved by hacking core i,e removing line

$element['format']['guidelines'][$format_id]['#access'] = FALSE;

in Element.php but I want proper drupal solution.


texts:
I have a Drupal site which is online, and I'm going to do some maintenance on it. That means I need to have a local copy to do some testing first. They've given me a copy of the site on a folder "/mysite.co.uk" and this contents:

(.htaccess file was renamed)

I've installed Drupal on a VM, imported the DB, updated some fields which pointed to "modules/sites/mysite.co.uk/modules/..." and the site seems to work OK.

However, when I try to access some modules, like say, simplenews, it gives me a "Failed opening required 'sites/all/modules/simplenews/simplenews.admin.inc" or undefined functions...

Of course, I could go and download every module it complains about. But that's no good. My suspicion is that they had this site installed in a multi-site environment and now I'm missing all the global/common files. Could this be the issue? If so, how could I perform a migration, should I ask for the global installation files?


texts:
I'm trying to change the logo in my header based on the taxonomy term of a page. I have managed to get it working on the taxonomy landing page itself. However, I have content pages that have term references on them which don't pull through the term title.

This the code that allowing me to display the title on the taxonomy page:

$termid = arg(2);
      $term = taxonomy_term_load($termid);
      $title = $term->name;

      $title = str_replace(' ', '', $title);

      $field_organisation->field_organisation['und'][0]['tid'];

I am then stripping out the whitespace and printing the value inside an img tag.

I've tried doing this with views and creating a list of all nodes and adding a contextual filter. Yet this seems to only work the other way. So it only displays the image on the node page itself and NOT the taxonomy landing page.

Any help would be much appreciated.

Thanks.


texts: Is it possible to redirect after "pushing" a file to the user?

texts:
I've got a setup where a site generates internal analytics about site usage. Users are able to request a download of their personal analytics, and because this information is sensitive I do not create any files, I generate a CSV file in a variable and then "push" it to the user with this:

function _cex_download( $output, $filename )
{
  header("Pragma: public");
  header("Expires: 0");
  header("Cache-Control: private");
  header("Content-type: application/octet-stream");
  header("Content-Disposition: attachment; filename=$filename");
  header("Accept-Ranges: bytes");
  echo $output;
  exit;
}

This causes the user's browser to pop a "save file" dialog, and the user gets the file created on their end. This works fine, except the site's administrators are able to trigger 'destructive exports' - and in that situation I have a secondary confirmation form the admin needs to accept before the destructive export executes.

The problem is that this "push download" routine ends the Drupal page processing. There does not appear any way to redirect the admin to some page after that push download routine is called. Admins get a 'save file' dialog popped by their browser, but they remain on the confirmation form.

I tried going the multi-step form route, but after a day of dinking around with strange redirects, I backed out of that confusion. Started looking at ChaosTool's multi-step form logic too. But something tells me that the issue really is that this "push downloading" is a guided-process-killer.

Perhaps a jquery confirmation dialog that intercepts the initial 'Export' button click, do the confirmation entirely in javascript, forget out having a php/FAPI confirmation form, and when the user confirms in jquery I programmatically submit the Export I intercepted?


texts: getting a target_id value for for users in particular node drupal 8

texts:
i want to display a taget_id values for user in node's field but i can't print them , this is what I have done in the hook :

 $node = \Drupal::routeMatch()->getParameter('node');
  if ($node && $node->bundle() == 'MynodeType') {
    $members = $node->field_members->getValue();
    $members_ids = [];
    $current_user = \Drupal::currentUser();
    $user_id = \Drupal\user\Entity\User::load($current_user->id());

    foreach ($members as $member){
      $members_ids[] = $member['target_id'];
      echo $members_ids; // why this is not like (1,8,....)?
    }


texts: Adding an 'All' option to a views exposed filter

texts:
I have a Views exposed filter, that allows multiple items to be selected. It's based on the 'Allowed values' for a multiselect CCK field.

The exposed filter comes out looking like this:

Option 1
Option 2
Option 3

I need to add an 'All' option to the top, so that it would be:

All
Option 1
Option 2
Option 3

Clicking the All option should have the same effect as holding Ctrl and clicking on Options 1, 2 and 3. ie. return all nodes that have a value of Option 1, Option 2 or Option 3 for this field.

How can I add such an option to my widget? I'm sure it could be done through form_alter somehow, but I can't suss out how.


texts:
I have a simple question.

I am trying to create a folder inside the Drupal installation that will not be shared to all the multi-sites.

For example:

  www.mydomain.com/xxx

  www.anotherdomain.com/xxx

I need this two folders of xxx should go to different path.

How can I achieve that?

I tried to create a new folder in Drupal root folder, but like this all the domains familiar with the same contents.

Thanks for the help.


texts: Modify/Alter Password Policy Constraints Text

texts:
I'm looking for the easiest possible way to modify or alter the password policy constraints error text. The following is the default the users see.

The password does not include enough variation to be secure.
•   Password must contain characters of at least 3 different types (lowercase, uppercase, digit or punctuation).
•   Password must contain at least one digit.
•   Password must be at least 8 characters in length.
•   Password must contain at least one lowercase character.
•   Password must contain at least one punctuation (not whitespace or an alphanumeric) character.
•   Password must contain at least one uppercase character.

I would like to modify this text to display to users like so:

Password must:
    • Be at least 8 characters
    • Have at least one lowercase letter
    • Have at least one number
    • etc etc.

Would this be possible using a form alter or other methods?


texts: Adding Display Suite fields to Search API results

texts:
Problem

I have some Display Suite token fields, and I want to include these and other entity fields in the Search API search results.

I also want to include the Search API Excerpt field in the results.

What's the easiest way to get these DS fields into the search results along with other entity fields?

What I've tried

I have tried using Fields for the view's Format > Show setting, but the DS fields don't appear as field options.

I have tried using Rendered entity for the view's Format > Show setting, but the Excerpt field doesn't appear as a field option in any of the display configurations.

I have tried adding custom theme templates to override the display, and I get a fatal error.  I haven't resolved this error after a bit of searching, so theme overrides doesn't look like the easiest route.

When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #attributes.


texts:
I am extremely tired right now and don't have time to read through verbose drupal 7 documentation.  Can someone just show me a quick Hello World example that will do the following in drupal 7?

I have a template file /sites/all/themes/mytheme/page.tpl.php and in it I have

<?php echo "Hello World"; ?>

When a person comes to the page in English, it should show "Hello world".  When the person comes to the page in French, it should show "Bonjour tout le monde".  How do I augment the command echo "Hello World" to do such a thing?  If language files are needed, show me how to structure them.

Thanks


texts: View data not showing after moving website

texts:
I just move a drupal 7 website from my localhost WAMP server to a production server (using phpmyadmin for the database).

Everything is fine except the views which didn't show anything. The data are here but even with the views ui, the preview doesn't show a single data.

I suspect a database problem but I don't know what to do


texts:
I created an Image Field for the Basic Page Content Type.

I want to control the output of this image to use as a banner with a caption on top. Is there a function to render out a field specific to the page,

such as <?php print render($page['my_image_field']); ?>.

I wan't to style this separately from the body content.


texts: If I don't see the "Full HTML" and "Filtered HTML" input formats, is it OK to add them manually?

texts:
I currently only have a "plain text" format.
Is it ok for me to add additional "Text formats" on the "Configuration" screen? Eg. Full html, filtered html etc?

Or should these have been created automatically when I installed the ckeditor and IMCE modules?


texts:
My Drupal site is on a subdomain of my old html/php site. So, I am running into problems sharing content from my Drupal site via iFrame.

I looked up solutions that worked for others and the consensus seems to be either edit settings.php

$conf['x_frame_options'] = '';

Or to use the Securit Kit module to change the X-Frame options to disabled.

I have tried both, cleared the cache and the site with the iFrame is still saying Refused to display https://example.com/entity_iframe/node/1 in a frame because it set 'X-Frame-Options' to 'sameorigin'.

Any ideas?


texts: Include a module template into an other module template

texts:
I'm working on a Drupal 8 project and in my module X twig template I need to include the template of an other module Y. All what I found in documentation is how to call a template inside other template in theme see here

I've tried in my twig-of-module-X.html.twig file:

{% include 'modules/Y/templates/twig-of-module-Y.html.twig' %}

but doesn't work!
Any suggestion please?


texts:
I have been trying to find a good, working method to do some bulk taxonomy operations in Drupal 7.

The Administration Views module doesn't appear to work - I just get page not found errors when trying to access any of the views.

So, I have been trying to follow this guide here: http://learnbythedrop.com/drop/166 . However, this is for Drupal 6 and I can't find the corresponding options in Drupal 7. There is no Style option in the view dialog, and Format contains:
Grid
 HTML list
 Jump menu
 Quicktabs
 Table
 Unformatted list, But nothing for VBO.

Can someone help here? This is where drupal really falls down IMO - total lack of up to date documentation and lots of time spent trying to find modules to do simple things which should be in core.


texts:
Ive followed 3 tutorials and I cant seem to crack this. My goal is to create a form in the admin section to store some information.

I have used the following to create the form and call it from a url but I seem to be missing something

    function read_more_news_admin() {
  $form = array();
   //link field
      $form['link_container'] = array(
        '#type' => 'container',
        '#attributes' => array('class' => array('some-class')),
        '#tree' => TRUE,
      );
      $form['link_container']['link'] = array(
        '#type' => 'link_field',
        '#field_name' => 'link_field',
        '#language' => 'und',
        '#field_parents' => array(),
        '#delta' => 0,
        '#default_value' => array(
          'title' => variable_get('link_title', ''),
          'url' => variable_get('link_url', ''),
        ),
      );
  return system_settings_form($form);
}

function read_more_news_menu() {
  $items = array();
  $items['admin/settings/readmorenews'] = array(
    'title' => 'Read More News Module Settings',
    'description' => 'Set read more news outgoing link here',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('read_more_news_admin'),
    'access arguments' => array('administer readmorenews settings'),
    'type' => MENU_NORMAL_ITEM,
   );
  return $items;
}

Any help would be appreciated


texts: Views: add custom no result behavior to a view?

texts:
I am trying to add custom no result behaviour to a view. I have many pages with view panes in them. Sometimes if no results are available, I would like to be able to display a 404. This is not an option when it's a view pane. I would like to do this in a reusable way where if the view pane has that custom option then this happens.

I can hard code this stuff on one of views hook, but ideally I want to be able to configure such behavior.


texts: jquery hover function in views template (drupal 6)

texts:
I have a views template called: views-view-fields--video--block-1.tpl.php

Inside that file i have:

<?php

print '
';

print '
'. $fields['field_video_embed']->content.'
';

print '
'. $fields['title']->content .'
';

$hover_play = l('', 'node/' . $row->nid, array('attributes' => array('class' => 'play_button', 'style' => 'display: none'), 'html' => true));

print $hover_play;

print '
'; // vgrid

?>

As you can see in my JS code at the top of the template, i'm printing $hover_play when user hovers over .last-vid-block .imagecache object, so it fades In then fades Out, that works, yeah.

But the problem is -> i have in that views block 4 nodes with that markup, so when i hover over just one .last-vid-block .imagecache that $hover_play shows on all 4 objects... How to separate them - if i hover just 1st object $hover_play shows only at 1st object etc...
Thanks in advance!

ATTENTION! Edited js code at the top! It works as intended, is there any erros in that code?


texts: How to resolve my Open Atrium installation error?

texts:
I am very new to open atrium.  I installed Open Atrium and now the home page is not loading properly. Instead I have the following error:

  Warning: file_put_contents(temporary://fil29F1.tmp): failed to open
  stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in
  file_unmanaged_save_data() (line 1936 of
  C:\wamp\www\openatrium\includes\file.inc). The file could not be
  created.


texts: How to automate the transfer of a registered user from Drupal to LimeSurvey?

texts:
I have a Drupal site which is using the LimeSurvey Sync module. All is working fine.

Now I want to automate import user in LimeSurvey when user registered in my Drupal site.

Is there any option to do it?


texts: How can I get path aliases arguments from a URL in a template?

texts:
I have a content type which has an automatic path alias to latest-news/[title] (e.g. latest-news/example-news-title).

I need to get the first part of the path alias in my page.tpl.php file, but when I use arg(0) I am given node and not latest-news.

How can I get the first part of an aliases URL in a page template?


texts:
I am creating custom theme for Drupal 8. I am uploading the logo from theme setting, but I am not able to print the path of that logo. What I am doing to print the full path of logo is using {{ logo }}, but it is not working.

In Drupal 7 we can get the full path of logo with the following code.

 <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />

What is the equivalent for Drupal 8?


texts: Why is $base_url = http://{$_SERVER['SERVER_NAME']} in settings.php? Will this cause any problems?

texts:
I saw this on a legacy website and I am not sure why our sys-admin insists on doing it this way. While most things are working fine, I wonder how will this affect the site, for example, I know the $_SERVER is not defined on cli and every time I execute a drush command it gives me parse_url(http:///example): Unable to parse URL in drupal_settings_initialize() (line 718 of                                                 [warning]
path/to/includes/bootstrap.inc).


texts: Overriding menu.html.twig just for the primary menu

texts:
Drupal 8 Beta 1 has a lot of nice templates to use which can be brought into a custom theme and then customized. I brought in core's menu.html.twig into my custom theme and indeed I can customize markup in there. However, this template overrides all Drupal menus, not just the primary menu which is the one I want to override.

I tried the Devel module for Drupal 8 figuring I might get some insight about what's going on under the hood. However, the module still looks like it's in a state of flux and I got massive errors. My goto module for template suggestions for Drupal 7 is Devel Themer (Theme Developer) but alas no Drupal 8 version.

I also tried getting specific with the template name and tried menu--primary.html.twig but that did not work either.

I then tried within the template wrapping an if around the part that I want to modify as such:

{% if primary_menu %}
   <ul{{ attributes.addClass('foobar-menu') }}>
{% endif %}

... but no joy there either. so I am out of ideas on how to do this.


texts: drupal_html_id() alternative for non-Ajax content?

texts:
I am looking for a drupal_html_id() function alternative which returns incremented ID's of non-Ajax contents only.

Is this "ajax/non-ajax" distinction feasible in this context or any other way?
If yes, can anyone provide a solution or recommendation?


texts: private file downloads don't work with IE8 only when using hook_file_download

texts:
I am trying to allow files that are within the /sites/default/files/private/ directory to available to users with correct role and this is working correctly within all browsers (including IE9) except for the IE8 browser.  It does not appear to be a particular file type since it does not work with either .pdf's or .doc's extension.  It their something special that I need to do to the "mime type" so that IE8 will successfully download these files?
I have listed below hook_file_download which determines when a requested file download is allowed based on a combination of the page $url and the requesting users role and I highlighted in bold the bottom of the function where it determines the mime type that is returned.

function atf_retirees_file_download($uri) {
  $user = $GLOBALS['user'];
  $roles = $user->roles;
  $pos_inside_atf_alias = stripos($uri, '/inside-atf/');
  $pos_nibin_alias = stripos($uri, '/nibin-user-area/');
  if (($pos_inside_atf_alias === false && $pos_nibin_alias === false) || ($pos_inside_atf_alias !== false && !(in_array('ATF Retirees', $roles) || in_array('administrator', $roles))) || ($pos_nibin_alias !== false && !(in_array('NIBIN User Area', $roles) || in_array('administrator', $roles)))) {
    return -1;
  } else {
    **$mime_type = file_get_mimetype($uri);
    return array('Content-Type' => $mime_type);**
  }
}


texts: cannot remove $base_url address from a link

texts:
There is a Ads block in my website in which some websites logo and their address are placed in there. I created a content type for it , called Ads (and also a view Ads__view). it has two fields : 1.link 2.logo . I created a slide show using slideShow module and it slides the logos. I want my website to redirect to these websites when user clicks on any of them, so I created a page called views-view-fields--Ads__view.tpl.php and this is the code of it :

<?php
$address = strip_tags($fields['field_Ads_link']->content);
?>
<a href="<?php print $address ?>"><?php print $fields['field_Ads_photo']->content; ?>

the problem is $base_url of my website is attached at the beginning of the  ($fields['field_Ads_link']->content for example www.google.com will be www.mywebsite.com/www.google.com . how can I remove this attachment ?


texts: Department-based web site in which users can only edit content in their own department

texts:
What would be the steps to build a web site with different departments in which the users with edit permission can only edit content in their own department? Content types would be shared, e.g. the "page" content type should be available to all of them.

I've read this can be accomplished with PURL + spaces, but I am not sure this is still the best option, as most posts about it are from a few years ago.


texts: Book page fields inherit content from parent

texts:
I created a book with several book pages of a specific content type. I am trying to inherit the values of some fields from the top page of the book to the child pages so that i don't have to fill them manually on each page.

I tried the "Field default token" module with no luck. Actually it doesn't display the value of the token that i select.

Any ideas please?


texts: How to process single queue item using QueueWorker on cron runs?

texts:
For each cron run, I would like to be able to process only 1 item in my queue using QueueWorker. At the moment it seems to me that Drupal keep processing items until it reaches the time parameter for the queue worker. I want to change this behavior to process 1 queue item at a time regardless of the time param. This is what I have so far:

/**
 * Processes Tasks.
 *
 * @QueueWorker(
 *   id = "data_provider_queue",
 *   title = @Translation("task worker: data provider queue"),
 *   cron = {"time" = 60}
 * )
 */
class SomeQueueWorker extends QueueWorkerBase {
  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
       // Do something with data.
       // This seems to keep getting called for more than
       // one item in the queue. How do we change that?
  }
}

Is this possible with QueueWorker or should I just process queue items in a cron hook manually?


texts: Set two file_public_base_urls and two file_public_paths in settings.php

texts:
I need to set two file_public_base_urls and two file_public_paths in settings.php in Drupal 8.7. and have them associated with each other. For example:

$settings['file_public_base_url1'] = 'http://downloads.example.com/files/media1';

is associate with

$settings['file_public_path'] = 'sites/default/files/media1';

and

$settings['file_public_base_url2'] = 'http://downloads.example.com/files/media2';

is associate with

$settings['file_public_path'] = 'sites/default/files/media2';

Does Drupal core support this, or it can only be achieved programmatically?
Any ideas or suggestions?

Basically, I need to separate the uploaded files between audio files and other files, such as image files. For example, when an editor uploaded an audio file, it would be saved in sites/defaults/files/audio directory. When an image file is uploaded, it would be saved in sites/defaults/files/image directory.

I have been looking at basePath function in PublicStream.php in Drupal core tried to find a way to determine if an uploaded file is mp3, so I can save it to sites/defaults/files/audio directory, but with no luck.


texts: How to fetch customer shipping information from rule component?

texts:
I created a rule for that sends each product creator an email on the "Completing the checkout" event. The rule, component, and action all work, but I can't find the Customer Shipping Information tokens.

Can you provide insight or ideas on how I might get a token that would reveal the shipping information for my email? Below is my rule component and screenshots.

{ "rules_send_email_to_vendor" : {
"LABEL" : "Send email to vendor",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Commerce Checkout" ],
"REQUIRES" : [ "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"DO" : [
  { "LOOP" : {
      "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "component_rules_fetch_product_author" : { "line_id" : [ "list-item" ] } }
      ]
    }
  }
]
}
}

And below my rules screenshoot


texts: How do I use FAQ module views with accordion effect?

texts:
I want to use a setup similar to the hard-coded faq-page, having the questions grouped by category, but having the answers hide/show with the accordion effect. I would like to add a jump menu attachment at the top of the page, but this requires setting up anchor links in the original view. I have tried using the various Views displays provided by the module, but these don't have the accordion effect. Is there a magic combination that I'm missing?

Thanks!


texts: Change system mail on run time when sending mail

texts: I have 4 domains using domain access module like a.com, b.com, c.com, d.com. currently when user registers he receives a mail from admin@a.com which is default in site configuration. Now what I want is to Change system mail on run time with respect to 4 diffrent domains so that when user registers from b.com he will receive mail from admin@b.com and so on.As this info is saved in system configuration so how to change the mail id of the site when sending mail on run time.


texts: Drupal page is not found error is showing

texts:
I am working on a project where I created a custom module to store data into database from a form. It is working fine. But now I am working on how to fetch the data from database and show the data in another page.
The following is the code in my .module file:

function request_by_user_menu() {
  $items = array();
//added for fetch and show data from database in request_by_user_menu().not working

 $items['example/submit'] = array( //this creates a URL that will call this form at "examples/form-example"
    'title' => 'Form Data', //page title
    'description' => 'Show data from database.',
    'page callback' => 'request_by_user_show', //this is the function that will be called when the page is accessed.  for a form, use drupal_get_form
   'access callback' => TRUE
  );
  return $items;
}

/*//function for fetch and show data from database.Not working.*/
 function request_by_user_shown(){
     $results=db_query("SELECT * FROM {request_by_user}");
     $header=array(t('ID'),t('Number'));
     $rows=array();
     foreach($results AS $result){
         $rows[]=array(
         $result->uid,
         $result->passwd,
         );
     }
     return theme('table', array('header' => $header,'rows' => $rows));
 }

When I am opening 'example/submit' it is showing "page not found" error.


texts:
Ideally I want users to earn "credits". These credits will allow them to redeem "content" (nodes). My goal is basically to allow users to only gain access to content they "redeem" using their credits, and they only gain credits by submitting content which I approve and assign value to. So if user X submits content, I think its great and rank it 8 out of 10 and decide that he gets 8 credits, he then gets 8 credits. He can then use those 8 credits to redeem content, and content can have different values.

What is the best way to go about getting this functionality in Drupal?


texts: How can I add paragraphs to a translated node?

texts:
I have a problem with the Paragraphs module and translation. I'm using Drupal 8.7.7 and Paragraphs 8.x-1.9.

When I add a translation to a node with a paragraphs field (unlimited), I can only translate existing fields in this paragraph, but I cannot add new values on the translation node.

I followed the instructions given in the docs on  https://www.drupal.org/docs/8/modules/paragraphs/multilingual-paragraphs-configuration and in fact, if I didn't I wouldn't have been able to even see the fields in the translation edit form.

I have no idea, how to set this up correctly.

I installed the Paragraphs Asymmetric Translation Widgets module which somehow says, it deals with it, but it does not. I used the Widget 'Paragraphs Classic Asymmetric' in the form display, but to no avail.

I'm really desperate now.


texts: How to use cron to delete nodes of a content type that does not allow deletion by anonymous users

texts:
The background for this question is here: Delete nodes using Rules and VBO

Summary: a VBO View selects various nodes of a particular content type. A Rules Action Set is instructed to load this VBO View, loop through the entity objects, and delete them. A Rule runs/is triggered on cron and has this Action Set for its action. So, when cron runs the selected nodes should be deleted.

However, the nodes are not deleted, because cron runs as the Anonymous User (uid=0), and the content type is configured such that anonymous users are not allowed to delete nodes of this content type.

How can this be solved so that the nodes are deleted on cron?

Giving anonymous users permission to delete nodes of this content type is not a good solution on this site.

Presumably, cron runs as Anonymous User (uid=0) for security reasons. Any acceptable solution should not undermine the site's security.

A programmatic solution (e.g. code in a custom module) is certainly acceptable if a "code-less" solution using Rules is not possible.


texts: How can I point to an internal anchor using core menu?

texts:
We have a navigation menu created using Drupal's built-in menu system. One of our menu items has the path set to "node/100770#digital-anchor," but when the menu is rendered, it strips off everything to the right of the node ID. I've tried this suggestion (using a named id), but the issue isn't that the browser is ignoring everything the node id; it's that Drupal is actually stripping off everything after the id when the menu is rendered. If I look at the rendered source in the browser, it just isn't there.

How can we point to an internal anchor (or named element, if you believe that anchors are deprecated) using the default menu?


texts: How to enable insert module in installation profile?

texts: I want to use the insert module for a file field but I can't get it to be enabled programmaticly. Is there a setting like 'insert' => true, or something like that? Is there any documentation about the these settings because I can't seem to find any info on the web?


texts: Views block: select one item from each content type

texts:
I am using a flexslider views block for the homepage of a site. There are content types such as news, articles, announcements... In that views block I would like to display the latest item of each content type.

I played around with the filter and sorting settings in the views admin panel but could not manage to list the items that way. I can either list the latest item -no matter what content type, or list the latest items of a certain content type -only one type. I tried to group the results in someway and that also was not what I need.

I found a related question but there seems to be no useful solution on that page.

Any ideas how I can manage this?


texts:
I have Search API SOLR running on my Drupal 8 site and I'd like to know if there is a way to have view pages display in my search results.

As an example, I have a database content type that allows users to put in the name of the database, the custom URL to link to the external database and a short description of it. The way I display this content on my site is with a view that can be filtered with certain criteria.

The actual node of these databases is never linked to and I never want users to end up on these node pages. However, if I search for the name of a database, it won't show up because I've disallowed that content type in my search settings but I still want that view page to be found when searching for the name of a database.

Can anyone help me figure out how to get view pages or pages with view block result to show up in my search results so that certain content type nodes that are never meant to be seen don't end up in the results?


texts: How do I create e-products, and store order id+uid in my own tables in case of successful purchase via PayPal

texts:
On a website I'm developing, there's a plan that users could buy some "online" products (or e-products) cheaply via PayPal, and than give these products to each other as a present.
For example, one user could buy a star (or more) for 1€, and send this star to another user he/she likes as a gift.
So nothing would be shipped, nothing would be downloaded.
I already have Ubercart set up with a PayPal Sandbox API key (there will be other products too), so I can see that online transactions seem to work successfully for products that can be shipped.

How can I create products that can not be shipped, can not be downloaded, just simply purchased and registered, assigned to a given user (like an "online" product, which users can utilize on an online surface)?
I could create a "star" product in my Ubercart webshop, let users buy it, and than check this type's stuffs in Ubercart tables.
After a successful purchase, how could I check the order id (for the "star" product), and store the purchase process in my own tables to let users present these "online" products to each other (there would also be a field to whom it was sent) and register when this whole thing happened, and that one user already took this opportunity?
(To let you understand why it's needed: there would also be a little icon on the site indicating that users already have e.g. 12 stars that could be virtually given to another user; besides, there would be another icon indicating the user got a star from another user [which user gave it, and when]. I would also like to generate an own unique code for these stars to utilize them later for example for a draw!)

Any good ideas are appreciated. Ask if anything isn't quite clear!
Thank you in advance!


texts: How can I include ratings in the site, with reference stored in the node table?

texts:
I need to implement ratings for my site. I have already stored the data in the node; now, I need to store the average ratings point in the node field type which I have created. It must be the reference for the ratings table.

How can I implement this?


texts:
I have a system where (to start) I have three types of data I need to store. I'm familiar with relational databases so I'm going to describe it in those terms. The Author table just has a couple columns like a primary key, and a few text fields (it's info about an author). Location has a similar structure to Author, but it's for different data (info about locations). Article is basically what links the two together. It has some regular text data, but also has foreign keys to both Author and Location (it's an Article written by Author about Location).

I've played with two ideas for how to represent this in Drupal. First with the Field API creating content types. The main problem here is that I'm not sure how to set it up so that Article has the proper relations to Author and Location.

The second approach I'm considering is using the Entity API module, but I'm not really very familiar with the module. However, I am very comfortable using hook_schema() to set up the tables and relationships. From there, I'm not sure if Entity API has much useful in the way of making the data manageable like a content type or if I'd have to write that all by hand to begin with.

Am I looking at this all wrong? What is the drupal way?


texts: node_save() is hanging in db_transaction?

texts:
I'm writing some D7 code that handles the modification of a node -- this is happening outside the usual form_submit process, so I'm having to do everything myself.  My basic approach is something like:

$the_node = node_load(123);
[change whatever node properties need to be changed]
node_save($the_node);

This should be trivial, and works for me in other situations, but, for some reason, in this case it's hanging inside of node_save; eventually, my php process reaches its expiration time, and the page times out.  As a test, I've removed all the code that modifies the_node, so that all I do is load the node and save it, and it still hangs.

I've put some watchdog statements into node_save, and have found that the hang is taking place in that function's initial call to db_transaction() -- it goes off to set up the database connection and never comes back.  I realize that this isn't enough information for anybody to really debug what's going on, but I thought I'd post it in the chance that someone else has bumped into this.  Any insights out there?  Thanks!


texts: View that shows posts specific to the node

texts:
In my website, under every project we do, there is a project info post which summarises what the project is about as well as all the recent updates(posts) about that project.

this is what it looks like http://i.imgur.com/yuJEnYA.jpg

I am trying to find a way i can view a 'project-info' node and add a 'view' that shows all the related 'project-posts' related to the particular project that the 'project-info' node is about.

I'm not sure where to begin.

(Drupal 7)


texts: How does the search work differently for Chinese words and English words?

texts: In the search settings page, the search key length is "3" by default. It makes sense for English words. For Chinese words, to get search result, I have to input 4 words like "欢迎光临". Actually, we'd like to search only 2 words(eg."欢迎", I think it is common for Chinese to search). That means I have to set the search key length to "1". Is it possible to set the key length separately for English and Chinese? Or is it possible to take one Chinese word as key length “2”？


texts: Modify apachesolr's 'did you mean?' suggestions to provide better alternatives

texts:
Has anyone modified the default apachesolr 'did you mean?' suggestions that is returned out of the box with the apachesolr module?

For instance, a search for 'diabetes' currently returns 'did you mean: rates' http://www.health.govt.nz/search/results/diabetes

Is there a way to add some form of control over this, or is the solution simply adding more nodes to the index in the hopes of making it a better spell checker?


texts: How to hide default "N/A" option for checkboxes?

texts:
I have a "gender" (checkbox) option that I want to show on the user profile page (but not on the registration page).
The options are "Male" (default) and "Female". Since I don't make the field required it is showing the "N/A" option. Drupal does this by design.

If I make the field required the "N/A" option will go away but then it will automatically show on the registration page which I don't want.

I was trying to hide it with CSS but I cannot see a way to just hide that checkbox and "N/A" text:

<input id="edit-field-gender-und-none" class="form-radio" type="radio" value="_none" name="field_gender[und]">
N/A

<input id="edit-field-gender-und-0" class="form-radio" type="radio" checked="checked" value="0" name="field_gender[und]">
Male

<input id="edit-field-gender-und-1" class="form-radio" type="radio" value="1" name="field_gender[und]">
Female

Help! ;-)


texts:
I have a Content Type Courses  & a User Role Student

In the student I used EntityReference to refer to a number of courses.

Is it possible to get a list of all the students that have a particular course referenced to them, in PHP?

Right now I'm only accustomed in getting a value from a field in a content type like this:

$user_surname = $profile_info['student']->field_surname['und'][0]['value'];

PS I think this has to do with back-reference,which is a module I already installed.


texts: Which is the correct "code/word" for Language Neutral?

texts:
I read an article from Gábor Hojtsy where he says:

  Language neutral uses the language code 'und', which means undefined
  and is specified to be used for such cases by the ISO 639 standard.

But when you go to read the ISO 639 you can find:

  und, for "undetermined";

And you can find inside Drupal the "Language Neutral"

I ask the question because I'm writing a module where I need to have a word to identify the nodes that don't have a defined language. So, which is the word to use, Neutral, Undefined or Undetermined?


texts: Aggregate and compress CSS/JS not working with Amazon S3

texts:
I am using Amazon S3, S3fs modules, I cant able to Aggregate and compress CSS/JS in Performance(admin/config/development/performance), as it is disabled.

And it says "Set up the public files directory to make these optimizations available".

I need to use Amazon Single Storage Service in performance

Any suggestions how to compress js/css.


texts:
I am using multi-language internationalize module for category and products translate. When product created assigning only English language category only but not assign other languages, How to assign to other languages.

There is any solution for this with module or else any other solution.


texts: What might cause my "User error" in Watchdog?

texts:
I'm trying to figure out the reason behind this "User error" in watchdog

User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children() (line 102 of /core/lib/Drupal/Core/Render/Element.php).

This error comes when I access any non-existing entity like

myentity/762574527 or myentity/anything

On googling, I got this link , which states its due to Token module.

I uninstalled this module and deleted every content related to it, still this error persists.

Can anyone tell the reason behind this error?


texts:
I need to sort contents in the same manner as blocks are sorting in the block list.
In the block list we can drag an drop blocks to place the them up and down, same functionality I needed for content list for contents.


texts: Using Drupal's session inside a PHP script

texts:
I need to pass parameters from a Drupal page to a PHP script.
There's no way to pass that directly and I need to use SESSIONS.
I've searched around and added this at the top of the script:

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);

With that I can use Drupal's session but I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers already sent

It's not so bad since it's just a warning and I can use CSS to make it not visible to the user. But I was wondering if there is a cleaner way to do so.


texts: Multilingual "Posted on: ... - By: ..." labels

texts: I would like to ask how to translate labels in drupal 7 like "Posted on: ... - By: ...".  I also have difficulties with translation for prev-next buttons text in calendar. I created a multilingual website based on Nexus 7.x-1.3 theme.


texts: Drupal 7 Use custom Alt tag for User Photo

texts:
Noob here - I would like user photo alt tags to say "[firstname] [lastname]" instead of "@user's picture". Machine names are field_first_name and field_last_name

I found this answer - https://drupal.stackexchange.com/a/60061 but I'm still not clear on how to edit that function. Copy/paste-able code for the template.php will be greatly appreciated.


texts: How To Display Image instead of Taxonomy name using Views to display my nodes?

texts:
I Have Entity Module and already have a Taxonomy Vocabulary with terms and an Image Field created. Each term has a unique image.

I Have a Content Type with a Term Reference field set to allow multiple selections of my Vocabulary.

I now want to have my Nodes displayed in a Views Table, Title, Node Image, and Taxonomy terms as images rather than their names.

How do I make this possible? Here is a link to what the site currently is (HTML Table rather than a view - very limiting and slow for updating). http://dev.destinationsound.net/

The different color circles are what will be taxonomy terms.

Drupal 7

Note: This is not for a taxonomy term page but rather a list of nodes that have taxonomy terms associated with them.


texts: Does a user profile using profile2 work with the metatags module?

texts:
I am using the profile2 module. I am looking for a way to set my meta tags based on user profile type. For example, I have teachers, students, and parents as profile types and each of their profiles have unique content. I would like the meta tags to be based on tokens so that they are unique for each profile.

I have tried the metatags module but I can not get the tags to be specific to the profile type (it does give you that option, though). So far I can only get unique meta tags on the user which means all profiles and users have the same token set, so that is a no go.

Any suggestions how to get this to work with metatags module or another way would be helpful. I hope this site produces better results than what I am getting on Drupal issue boards.

Edit:
I have posted a similar question on the drupal issue board. I hope that does not disqualify my bigger question here of "how do I get custom token based meta tags on my various profile types".

Drupal 7


texts: Libraries not found when installing from custom profile

texts:
I've created a custom Drupal installation profile which has the epsacrop project included in the makefile and as a requirement in the .info file. Also, the epsascrop project requires two libraries: Jcrop and json2. These are both included in my makefile and are placed within the /profiles/profilename/libraries directory when running drush make. Here the relevant bit from the makefile:

libraries[jcrop][download][type] = "git"
libraries[jcrop][download][url] = "https://github.com/tapmodo/Jcrop.git"
libraries[jcrop][directory_name] = "Jcrop"

libraries[json2][download][type] = "git"
libraries[json2][download][url] = "https://github.com/douglascrockford/JSON-js.git"
libraries[json2][directory_name] = "json2"

When I run drush si to build my site I get an error which indicates that the required libraries are missing, though I can confirm they were correctly placed within profiles/profilename/libraries:

  exception 'Exception' with message 'EPSA Crop : Jcrop: Not found

  The Jcrop
  plugin is missing. Download
  and extract it in your sites/all/libraries directory.

  EPSA Crop : json2.js: Not found

  The json2.js file is
  missing, you can download it here and put it
  in your sites/all/libraries directory. Don't forget rename
  the downloaded folder into json2. At the end, you should have
  something like this sites/all/libraries/json2' in
  E:\Projects\amfm_microsites\www1\includes\install.core.inc:773

  Stack trace:
  0 E:\Projects\amfm_microsites\www1\includes\install.core.inc(471): install_verify_requirements(Array)
  1 E:\Projects\amfm_microsites\www1\includes\install.core.inc(339): install_run_task(Array, Array)
  2 E:\Projects\amfm_microsites\www1\includes\install.core.inc(77): install_run_tasks(Array)
  3 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\includes\drush.inc(719):
  install_drupal(Array)
  4 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\includes\drush.inc(705):
  drush_call_user_func_array('install_drupal', Array)
  5 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\commands\core\drupal\site_install_7.inc(80):
  drush_op('install_drupal', Array)
  6 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\commands\core\site_install.drush.inc(289):
  drush_core_site_install_version(NULL, Array)
  7 [internal function]: drush_core_site_install()
  8 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\includes\command.inc(368):
  call_user_func_array('drush_core_site...', Array)
  9 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\includes\command.inc(219):
  _drush_invoke_hooks(Array, Array)
  10 [internal function]: drush_command()
  11 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\includes\command.inc(187):
  call_user_func_array('drush_command', Array)
  12 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\lib\Drush\Boot\BaseBoot.php(62):
  drush_dispatch(Array)
  13 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\drush.php(70):
  Drush\Boot\BaseBoot->bootstrap_and_dispatch()
  14 C:\Users\aaron.silber\AppData\Roaming\Composer\vendor\drush\drush\drush.php(11):
  drush_main()
  15 {main}

I checked the EPSAcrop module and it appears to be using the libraries API correctly, which I believe should look in profiles/libraries in addition to sites/all.

What's going on here?


texts: I want to create a rule based on the number of sales per product. Is there a data selector to get the number of sales per product? If anyone can point me in the right direction, I will be very grateful!


texts: How do I delete files attached with media entity?

texts:
Background:

drupal 8.4.2

custom media solution

Issue

I can not delete files permanently which created as media entity.

Reproduce

Created an image media entity.
/admin/content/files claims status permanent and used in 2 places.
After deleting newly created media entity from UI /admin/content/media.
/admin/content/files says status permanent and used in 1 places.

Even cron run after 6 hours (as described in file settings) file still exist on the server.

Is there any safest or best way to delete those unused file permanently?


texts: Can I specify 'greater than' with db_delete()?

texts:
I am new to Drupal 8.
I can use the following code to delete a record where salary == 45

$salary = 45;
$num_deleted = db_delete('test_table')
  ->condition('salary', $salary)
  ->execute();

Is it possible to specify a condition like "salary >= $salary" with db_delete() or I should use db_query()?


texts: Bought Drupal Organization Membership But Cannot Create Listing

texts: Recently, I bought DRUPAL ORGANZIATION MEMBERSHIP at $200 but now i am unable add my listing in drupal organzation list. And it also shows "not a confirmed user". Can someone help me with this ??


texts: Can I host Drupal alongwith Google App Engine?

texts: I am new to Drupal as well as Google App Engine. I want to create a scalable website with few specialized apps in Google app engine and integrate with Drupal. Given both the platforms are extensively used, it seems to me that they should be supporting each other. However, I checked both Google app engine and Drupal website but could not figure out if they support each other. So my question is , is there any way I can host Drupal with Google app engine? Can they work together in the same platform?


texts: Creating an entity reference in a custom entity

texts:
I have created an entity that I want to collect data with from an external source and I want to reference that data to a node. How should i set up that entity in DB so it can properly reference a node? Can I use entity_id that references nid? And I want my entity to be non-fieldable so it does not take up unnecessary space and time.

Thanks.