texts: how to let a form field be hidden and at the same time the value be able to acces the id using javascript?

texts:
How can I get the #value of a hidden form field in javscript as for hidden form field I am unable to get its id in the (inspect element) html.
How can I extract the value(#value) for the field using ajax for the hidden fields


texts: Drupal 7 menu translation and url aliases

texts:
I am building a multilingual site with Drupal7 and enabled i18n and menu translation module. I can translate menu items and it is working fine with only one little problem:

If the menu item points to an internal page (i.e: /user) everything is OK, however if the menu item points to a node, the title is translated but I can only specify one path.

I.e.: I have an English page "About us" which is node/1 and have the URL alias /about-us

I have the Hungarian translation of this node "Manunkról" under node/18 and URL alias /magunkrol

I see the correct titles in each language and I get the correct language versions when I click them. BUT on the English page, the link has /about-us in the HREF, but on the Hungarian page it has node/1 (the node path of the English version). The link gets redirected but this is not an ideal solution in regards of SEO. Is there a way to display the URL alias in the HREF for each language?


texts: subscribe a new member to an organic group based on proximity

texts:
I need to assign a new (D7) user to an organic group based on the proximity between the new user and the group.  Is there a way to do this with rules?

Thanks


texts: phpunit test: drupalGet a public node returns 404

texts:
Simply trying to get a node.

$this->drupalGet('node/25250');
$this->assertSession()->statusCodeEquals(200);

But this returns 404. I can browse to that node anonymously. Why is it returning 404?


texts: Image gallery with mobile view optimization

texts:
I'm using Drupal 7, and I want to have a photo gallery.

When viewing the gallery using mobile phone or ipad, I wish to have the photos shown like facebook photo gallery:

image will auto resize according to screen size
when user slides the image to left or right, it will shows previous or next photo

Is there any module which can achieve the above effect?


texts: Biblio module: importing ris files, titles not importing even though mapped correctly

texts:
I have ris files of citations to upload, and despite having titles mapped correctly at admin/config/content/biblio/iomap/edit/ris -- T1 goes to Title, I get nothing but "untitled" nodes. I am using version 7.x-1.0-rc7. Some other data seems to populate appropriately, but looking at logs, many things aren't, so it's more than just titles. I have a large number of errors for a number of fields along the lines of:

Notice: Undefined property: stdClass::$title in _biblio_ris_parse_line() (line 357 of C:\wamp\www\mysite\sites\all\modules\biblio\modules\RIS\biblio_ris.module).

Thinking there might be something wrong with the data, I created my own simple ris file and tried an example file that I found online. I had the same problems with all of them.

I tried the dev version and have the same problem.

Any help would be appreciated.


texts: Field in Custom Content Type Stripping out  tags

texts:
Drupal6: I have a custom content type, with a custom field, set to textarea. The content type's instance filter is set to Full HTML.

When I add an image tag to the custom field, the image renders in the WYSIWIG in edit mode. When I save the node, the  tag doesn't show up at all. When I view source, the  tag simply isn't there.

I returned immediately out of my module's hook_nodeapi, and disabled all custom filters in the full html input format, to no avail.

If I put the same image tag in the body field of this content type, the image renders when viewing the node. Any ideas?


texts: How do I update a field to use a different field_type?

texts:
I have created custom field_type for a field in my content type.  The field 'field_content_category' already exists and is an entity_reference. Changing the yml file and importing doesnt work because there is already data for the field.

My custom field_type is an entity reference and a field to type in an integer.

How do I change the field field_type without creating a new field?


texts: Differences from dpm and dsm for devel module for debugging objects?

texts: What are the differences of dpm and dsm for the devel module? I mainly use dsm for the devel module. What are some other common debugging functions that are useful in the devel module?


texts: Alternative ways to clear the Drupal cache

texts:
We have a busy database server and when we try to clear the cache on Drupal, Drupal tries to TRUNCATE cache tables and that causes a backlog until the MySQL hits to maximum number of user connections (which is 800).  This is causing problems for us.

As far as we can tell, the problem is being caused by the locks during the table truncation.

Are there any alternative methods to clear cache that can help avoid this situation?


texts: drupal identify which content type is not used

texts:
I have a drupal existing project which is slow in performance and many irrelavent extra stuff. what aprroach is best where i can identify that which content type is used or not . Or we can say that which content type is used where

Similar for field/taxonomy that which field/taxonomy is associated with which content type.


texts: Get field value in viewer.js file (from pdf.js)

texts:
I created PDF files protected with password. They are uploaded to Drupal and the password is saved in a field pdf_password in Drupal.

I would like the PDF to open them with pdf.js without having to ask for the password. For this I need to get the value of the field password pdf_password in the file libraries/pdf.js/web/viewer.js: instead of 123 to get the value of the field password pdf_password :

parameters.password = '123';

(the pdf.js is pdf.js project by Mozilla)


texts: Node export module imported node as another node numbers

texts:
I used Node Export module to export my nodes.

I exported 3 articles that are node/1, node/2 and node3.

While I imported it into another site, the node became node/4, node/5 and node6.

How do I make it imported as the same node number.

If there is already have that node, it will override it.

Drupal 6

Settings:

Node export

When importing a node that already exists: Create a new revision of the existing node

UUID

Automatic UUID generation for taxonomy:


texts: How to capture value of a field in a node

texts:
I am nearly a complete newbie when it comes to writing modules (Drupal 7). I have a module that successfully calls an OpenStates API and retrieves information about a member of the legislature. The key is a custom field called leg_id. In testing this, I hard coded the leg_id in the module that creates the block I want to display.

I now have a node that has a custom field for leg_id. When that node is displayed, I want to pass the value of the leg_id to the module that retrieves the information from OpenStates and display it in a block in the right sidebar.

I need a simple example of how to get the value of the leg_id field and pass it to the module that creates the block.

Here is an example of how the page should look: http://dev-thecivithing.pantheon.io/node/1

Block creation Module Code

<?php
// $Id$

/**
 * Implements hook_help().
 */
function committees_help($path, $arg) {
  if ($path == 'admin/help#committees') {
    return t('A demonstration module.');
  }
}

/**
 * Implements hook_block_info().
 */
function committees_block_info() {
  $blocks = array();

  $blocks['list_committees'] = array(
    'info' => t('A listing of all of the committees for the member'),
    'cache' => DRUPAL_NO_CACHE,
  );

  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function committees_block_view($block_name = '') {
  if ($block_name == 'list_committees') {
    $list = get_committees();
    sort($list, $sort_flags = SORT_STRING);

    $theme_args = array('items' => $list, 'type' => 'ol');
    $content = theme('item_list', $theme_args);

    $block = array(
      'subject' => t('Committee Membership'),
      'content' => $content,
    );

    return $block;

  }
}

/**
 * Web service to list committees for the member
 */

function get_committees() {

$leg_id='NCL000208';
$apikey='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list = array();

$request_url = "http://openstates.org/api/v1/legislators/$leg_id/?apikey=$apikey";
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$legislator = json_decode($result);
$roles = $legislator->roles;
    foreach ($roles as $role) {
        if (isset($role->committee))
            $list[] = $role->committee;

    }
    return $list;
}

Working Module

<?php
// $Id$

#print $body . PHP_EOL;

/**
 * Implements hook_help().
 */
function committees_help($path, $arg) {
  if ($path == 'admin/help#committees') {
    return t('A demonstration module.');
  }
}

/**
 * Implements hook_block_info().
 */
function committees_block_info() {
  $blocks = array();

  $blocks['list_committees'] = array(
    'info' => t('A listing of all of the committees for the member'),
    'cache' => DRUPAL_NO_CACHE,
  );

  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function committees_block_view($block_name = '') {
  if ($block_name == 'list_committees') {
    $list = get_committees();
    sort($list, $sort_flags = SORT_STRING);

    $theme_args = array('items' => $list, 'type' => 'ol');
    $content = theme('item_list', $theme_args);

    $block = array(
      'subject' => t('Committee Membership'),
      'content' => $content,
    );

    return $block;

  }
}

/**
 * Web service to list committees for the member
 */

function get_committees() {

if (arg(0) == 'node' && is_numeric(arg(1)))
$nodeid = arg(1);
$node = node_load($nodeid);
$field_leg_id = $node->field_leg_id['und'][0]['value'];

$apikey='a1e620771b1d463cb726eda33e8f3102';
$list = array();

$request_url = "http://openstates.org/api/v1/legislators/$field_leg_id/?apikey=$apikey";
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$legislator = json_decode($result);
$roles = $legislator->roles;
    foreach ($roles as $role) {

        if (isset($role->committee))
            $list[] = $role->committee;

    }
    return $list;
}


texts: How to know that the node of a specific type is being viewed for the first time?

texts:
I want to display a block on the node page if it is being viewed for the first time. After that that block will not be displaying.

It will be for all the nodes of a given content type.

I know the Drupal put the node in the cache if it is being viewed for the first time but I can't found its code.

Is it possible? Any Ideas?


texts:
I have a content type with an image field; the number of files is unlimited. I need to extract, filter using regex, and display the filename for each image in the particular node type using a view.

I tried with field--field-images--content-type.tpl.php and every other overwriting theme hook's trick and nothing even started working.

I think I miss something important on the way.


texts: Entity Reference Module > Undefined & Non-Object Crashes

texts:
Preface
I have a fresh site install of Drupal. I'm fairly new to Drupal, but I feel rather confident with anything but module hacking right now. I've just finished about a month+ of editing and tweaking a play site to get comfortable with the Drupal theme engine and feel I am ready to move on. So I started putting together a real site using Drupal (rather than my play one).
I installed Entity API, Entity Reference, Views, and a few more.
Goal
My goal is to create Video Tutorials (custom content) that are listed inside Tutorials (custom content). This way I can create several Video Tutorials and use them in one, or more, Tutorials.
Attempts
I checked into Node Embed, which would theoretically work much better for this, but I have since given up as Node Embed requires installing and configuring an outside (non-drupal) plugin and the last time I tried to get that WYSIWYG editor installed it took me forever and I don't want the hassle.
Issue
I have just attempted to create the Video Tutorials and Tutorials custom contents.

I created Video Tutorials first. I have not edited the custom content fields. It has the generic fields for now.
Then I proceeded to create the Tutorial custom content type. I created a new field for it [field_tutorial_videos] that is supposed to be an Entity Reference to Video Tutorials.

The problem is I get this error block as soon as I create that field and it shows up everytime I click to edit this field...

Notice: Undefined property: stdClass::$nid in entity_metadata_no_hook_node_access() (line 619 of .../sites/all/modules/entity/modules/callbacks.inc).
Notice: Undefined property: stdClass::$vid in entity_metadata_no_hook_node_access() (line 620 of .../sites/all/modules/entity/modules/callbacks.inc).
Notice: Trying to get property of non-object in entity_metadata_no_hook_node_access() (line 620 of .../sites/all/modules/entity/modules/callbacks.inc).
Notice: Undefined property: stdClass::$nid in node_access() (line 3002 of .../modules/node/node.module).

I have read through the README on both ENTITY API and ENTITY REFERENCE and I get nothing that makes sense. I have no idea what to do from here.


texts: How can I upload an image file using multipart/form-data?

texts:
I want to send an image file using REST API in Drupal 8 along with a registration form. I have built a custom API to save the registration form.
For the files I have created another API to save data using HEADERS Content-Type: multipart/form-data and update the registration form with file ID after saving it.
When I send the file using the POSTMAN Chrome extension to check the API, I don't get the file data in $request->files->get('image_name') in my Controller. What may be the reason?


texts: How do you create a view in which users can assign tasks to themselves?

texts:
What I want to do.

A user clicks on his profile page.
A view displays that shows a list of completed tasks.
A task consists of a list of check-boxes (a checklist) and a "pending
and finished" dropdown.
The user should also be able to create a task for himself, selected
from a list of checklists.

This is my solution so far

Create a content type "checklists"
create a role reference field
create the checkbox field
create a view with CONTEXTUAL FILTERS to show the tasks assigned to
the user

Ive also tried a few modules

checklist
QA Checklist
SEO Checklist

But they dont seem to have the features i want.

Am i going in the right direction?

  Flags also looks promising - It looks like you can create a flag(button:create task) and then use actions or rules to create the node and reference the user automatically


texts: How do I display an error message on a basic page when the user does not have permissions to see the nested view inside the basic page?

texts:
I have a basic page, and inside of that basic page I have a view "newsletters". The view "newsletters" has permissions set on it based on role, so only admin and subscribers can see it. How can I display "You must be a subscriber to view this content" on the basic page when the user does not have permissions to view "newsletters".

Currently, if the user cant see "newsletters" my basic page just shows an empty page. I want it to display "You bust be a subscriber to see this content".

I tried creating another view "redirected page" that is only visible to anonymous users but it is not showing up for some reason.

The reason I made a basic page with a view nested inside it is because I wanted users who don't have permission to view the page to still see the link in the menu bar.


texts: Dynamically hiding / showing Field API fields in Drupal 7

texts:
I've created an entity with an 'add new' form. The entity itself has a limited number of actual variables. I've added most of the extra data I need using custom Fields (i.e. the Field API).

What I need to do at this stage is be able to dynamically hide one field based on the value of another. i.e. if a drop-down field has it's value set to No, another field should be hidden, otherwise it should be shown.

From what I can see, it is somewhat easy to add this functionality to fields created using the Form API (i.e. via the AJAX property), however is there any way to achieve it using attached fields? I have no issues using custom Javascript if that is what is required to solve this.


texts:
Well after 3 days of headsmahsing against this issue and trying to resolve it by reading the documentation available, I think it’s time to expose my problem. ^^

Every time I try to create a new web site from acquia dev top, at the database configuration step, it doesn’t set up the database at all and give me directly “Drupal is already installed”.

When I try to view my “existing site”, I have “The website encountered an unexpected error. Please try again later”.

This problem occur with every version of drupal, and every version of php I try to install. Trust me I try every combination, and of course I have try the right configuration first, as describe here: https://www.drupal.org/requirements.

Of course, I have also tried what is indicated:
•   “To start over, you must empty your existing database and copy default.settings.php over settings.php.”

I have delete the previous database, and copy default.settings.php over settings.php. But it’s just bug and give me :

  Échec de connexion à votre serveur de base de données. Le serveur
  retourne le message suivant : SQLSTATE[HY000] [2002]
  php_network_getaddresses: getaddrinfo failed: H�te inconnu. .

I also try to desinstall and reinstall acquia dev top (with the last version up to date). Every dev desktop folders and files have full authorization.

It’s really weird, because 3 days ago, I created and installed a local web site with drupal 8 with acquia dev top. It worked perfectly fine, until I mess up by installing a wrong theme (^^). After that, every time I try to create a new site, I obtain the result as described before.

My last guess is that the problem is inside Phpmyadmin. Anyone have a suggestion ? ^^

I am running out of option, and I think I will turn to another solution than Acquia Dev top.

Thanks for your attention and consideration.


texts: How add a views page url to the admin_menu?

texts:
I tried creating a view with a page display, giving it a normal menu item in navigation, the url admin/people/allusers (or any url like admin/content/listing), clearing the caches, but the admin menu does not pick up the page and put it in the drop downs.

How do I do this without having to use hook_menu for each views page url I want in the admin menu bar?


texts:
Can see black circle at the picture below?

How to remove that hyperlink?


texts: What are the technical implications of choosing asynchronous or synchronous billing cycle?

texts:
When using the Commerce License Billing module the "/admin/commerce/config/license/billing-cycle-types/manage/monthly" page clearly states:

  Asynchronous

  Determines whether the billing cycle starts at the time
  of purchase, instead of starting at the beginning of the calendar
  period.  For an order placed on Jan 5th, a monthly synchronous billing
  cycle would start on Jan 1st 00:00 and end on Jan 31st 23:59:59,
  while a monthly asynchronous billing cycle would start at the time of
  purchase (Jan 5th) and end a month later (Feb 5th).

I wonder what are the technical implications of choosing asynchronous or synchronous billing cycles. I mean if I go with synchronous billing period will all the recurring services be renewed on 1st of each month at the same time? Won't that make it difficult for cron?

Synchronous billing cycle seems very convenient and more appealing to the end-customers, however my main concern is that Drupal cron might stack in posterity with growing number of orders for the recurring services in the system.

Could anybody elaborate on this to confirm or mitigate my concern?


texts: Look for documentation about how precisely modules parts are loaded (Drupal 7)

texts:
Developping my custom module, I ran several times into misunderstood issues regarding the precise order used by Drupal when loading parts of a module.
Each time, I finally got rid of it after any disabled and suppressed then recreated, but this is obviously not satisfying.

So I'm now looking for sufficient information to be able to understand what happens in those circumstances.

This time the problem I have is as follows:

Having my module working fine on a site under D-7.34, I upgraded it to D-7.35, following all necessary steps.
After successfully executing update.php (which notified that no update was needed), I clicked to go to front page: this one was properly displayed.
NOTE: necessarily, my module was already involved at this stage, since it works during output rendering (so whatever the path indicated by the URL)
But from there, then, any attempt to access another page (either public or administrative one) fires a PHP error "Call to undefined function myfunction()...", where myfunction() belongs to my module.

I can't figure out how it is possible, since my code schematically looks like:

file: mymodule.module

<?php

module_load_include('inc', 'mymodule', 'mymodule.core');

function mymodule_some_hook() {
    # ...
    myfunction();
    # ...
}

file: mymodule.core

<?php

function myfunction() {
    # ...
}

In other words, in my eyes:

when the error fires, it necessarily means that mymodule.module was loaded, since it is where myfunction() call resides
then if mymodule.module was loaded, it should have first executed module_load_include(), so loading mymodule.core and defining myfunction()

Yet it is clear that, in this case, something is happening differently!

But why this behaviour now, and not at the first access to front page?
And why this behaviour with D-7.35 (where no changes seem to be involved here), and not with D-7.34?

NOTE: I suspected something wrong with caching, so I tried flushing it. But flushing process failed with the same "Call to undefined function".
Then I used directly PhpMyAdmin to truncate all cache tables, without success: behaves the same after that.

Comments greatly welcome, and notably if pointing to any documentation about detailed process of modules load.
Thanks in advance.


texts: Possible to use default user picture in rewritten views field?

texts:
I have a view which displays fields and one of them is a rewritten field to display the user picture along with some other information. There is no issue if the user picture is uploaded, but if the user does not, this field does not show the default user picture. Is there anything I need to do to allow the default user image to display in this rewritten views field?

I tried unchecking the hide field if empty option under no results behaviour, but realised that since I already rewrote the field, this does not seem to apply, because my rewrite renders other fields that always have values in them.


texts: Filter view content by data in text field

texts:
I've created a text field on a custom content type. The text field is called "targetUser" on my content type "message".

targetUser is meant to collect the uid of a user that a current app user is sending a message to. E.g. If user 1 is sending a message to user 7, the number "7" will post to the targetUser field.

I want to create a view that ONLY displays "messages" with the targetUser number that matches the logged in user's uid, so that they may ONLY see messages meant for them.

I essentially want my view to say: "Only display messages with this user's uid in the field targetuser" - is this doable? Hope I explained this well enough.


texts: How to add a preprocess function in Omega theme?

texts:
Omega theme has a singular way to add preprocess functions.

I need to add this preprocess function to be executed when a view is rendered:

function MyTheme_alpha_preprocess_views_view_fields(&$vars) {
...
}

This is what I've done (is not working, the dpm function doesn't print the message, no error is shown)

1) In sites/all/themes/MyTheme/preprocess/created the file preprocess-views-view-fields.inc

2) In preprocess-views-view-fields.inc I added the function:

   function MyTheme_alpha_preprocess_views_view_fields(&$vars) {
     dpm('hello');
    }

What am I missing?


texts:
I have defined a batch, everything works ok, but I want to understand how the messages are displayed. So I have this batch:

$batch = array(
  'title' => t('Generate reports'),
  'operations' => array(
    array('create_report_callback', array($time_min, $time_max)),
  ),
  'init_message' => t('Starting report generation...'),
  'progress_message' => t('Generating report. Operation @current out of @total.'),
  'error_message' => t('Error detected. Please try again!'),
  'finished' => 'create_report_finished',
);

What I want to know is how to change the progress_message to something else than Operation @current out of @total. I don't know where the @current and @total come from

Thank you.


texts:
I have a form to get some user input in Drupal. I want to add some prefix to the user input.

For example, the user enters "Laptop"; I want to save it in the database as resource_Laptop. I want to add the prefix before the validation is done, to avoid it fails.

How do I do this? Will hook_form_alter() help me here?

I have used this method, but not satisfied with this hack.

function mymodule_form_alter(){
  drupal_add_js("
    (function ($) {
      $(document).ready(function() {
        $('.field-suffix').hide();
        $('#edit-submit').click(function(){
        var s = $('#edit-machine-name').val();

        if (s.indexOf('_resources') == −1) {
          $('#edit-machine-name').val($('#edit-machine-name').val() + '_resources');
        }
      });
    })(jQuery);", 'inline');
}


texts: Getting node name when using search file attachments module

texts:
I am using search file attachments module for searching attached file's content. When two nodes have the same attachment I had a problem that it is showing only attached file names, not nodes.

I want to display which file attached to which node also.

Any help on how to achieve this?


texts: Is it possible to edit the text size of shortcode outputs from within admin?

texts:
I'm using Drupal 7, and I have a carousel that uses shortcodes to output text.

[testimonial name="Angela Somone" sequence = "3"] My daughter attended the...

It would be good If I could adjust the text size of "Angela Somone" from within my admin panel without having to edit my css files and upload via GIT etc.

I tried wrapping it in a span but that breaks my code.


texts: How to hide empty 'Content Zone' div in Omega?

texts:
I'm using Omega and I have "Force this zone to be rendered" unchecked in the Content Zone settings, and "Force this region to be rendered" unchecked in the Regions settings.

Any idea what would force this zone to be rendered even if there's no content? The zone is outputting this:

<div id="zone-content" class="zone zone-content clearfix container-24">


texts: Kind of similar to my previous question, but apparently doesn't work the same way: is there an easy way to use a taxonomy term or a token as node css class to theme different pages?


texts:
I generated 2 entities and addtyed a new Form with the overview of them. But when I try to add links, they won't appear.  I follow the guide but wont work. Form and Entities work. The routings are generated with drupal generate:entity

links.tasks.yml:

# Timeslot routing definition
timeslot.settings_tab:
  route_name: timeslot.settings
  title: 'Settings'
  base_route: timeslot.settings

entity.timeslot.canonical:
  route_name: entity.timeslot.canonical
  base_route: entity.timeslot.canonical
  title: 'View'

entity.timeslot.edit_form:
  route_name: entity.timeslot.edit_form
  base_route: entity.timeslot.canonical
  title: 'Edit'

entity.timeslot.version_history:
  route_name: entity.timeslot.version_history
  base_route: entity.timeslot.canonical
  title: 'Revisions'

entity.timeslot.delete_form:
  route_name:  entity.timeslot.delete_form
  base_route:  entity.timeslot.canonical
  title: Delete
  weight: 10

# Issue timeslot routing definition
issue_timeslot.settings_tab:
  route_name: issue_timeslot.settings
  title: 'Settings'
  base_route: issue_timeslot.settings

entity.issue_timeslot.canonical:
  route_name: entity.issue_timeslot.canonical
  base_route: entity.issue_timeslot.canonical
  title: 'View'

entity.issue_timeslot.edit_form:
  route_name: entity.issue_timeslot.edit_form
  base_route: entity.issue_timeslot.canonical
  title: 'Edit'

entity.issue_timeslot.version_history:
  route_name: entity.issue_timeslot.version_history
  base_route: entity.issue_timeslot.canonical
  title: 'Revisions'

entity.issue_timeslot.delete_form:
  route_name:  entity.issue_timeslot.delete_form
  base_route:  entity.issue_timeslot.canonical
  title: Delete
  weight: 10

links.menu.yml

# Timeslot menu items definition
entity.timeslot.collection:
  title: 'Timeslot list'
  route_name: entity.timeslot.collection
  description: 'List Timeslot entities'
  parent: system.admin_structure
  weight: 100

timeslot.admin.structure.settings:
  title: 'Timeslot settings'
  description: 'Configure Timeslot entities'
  route_name: timeslot.settings
  parent: system.admin_structure

# Issue timeslot menu items definition
entity.issue_timeslot.collection:
  title: 'Issue timeslot list'
  route_name: entity.issue_timeslot.collection
  description: 'List Issue timeslot entities'
  parent: system.admin_structure
  weight: 100

issue_timeslot.admin.structure.settings:
  title: 'Issue timeslot settings'
  description: 'Configure Issue timeslot entities'
  route_name: issue_timeslot.settings
  parent: system.admin_structure

trivali_crm_supportcontract.timeslots:
  title: 'Timeslots'
  route_name:
  weight: 100
  menu_name: main


texts: How do I make changes in Views from dev to stage to production environment?

texts:
I am currently working on Production website. We are hosting our site in Acquia where we have Dev, Stage and Production environment.

I have question regarding making changes in Views Block in production.

If we make any changes in views in Dev environment, changes will not be push in Stage environment as I think views changes are done in the database.

How do I make changes or update my existing views in Production without redoing it from scratch.

Thank you for your help!


texts: How to use Rules send an email with a list of nodes that fill certain conditions?

texts:
I would like to send an email everyday that has a list of nodes that are filtered by certain conditions. I think the Rules module would be a good place to start.

Real Example:

Content Type named "Issue".
Field inside Issue that connects a user as Responsible Party for the issue.
Field inside Issue that defines it as either "Active" or "Resolved".
Email a list to the responsible party of their Issues that have a "Active" status.

If this can be done with Rules, what event do you have it react to? I would guess the core functionality of it would be put in a component that rescheduled itself every 24 hours. Then the action of the component would be "Send Mail". How would it grab the list of nodes that fulfill the conditions?


texts:
In Drupal 6, the Private Upload module allows you to specify that a node file attachment should be stored in the private file system, so that it is not directly accessible by URL. There is a checkbox that toggles public/private.

In Drupal 7, some of this functionality has been moved into core. When you create a File field, you specify whether it uploads into the public or private file system. However, you cannot toggle public/private on each upload.

So what would be the best way in Drupal 7 to be able to specify that some file attachments be be in the public file system, and some be private? I could create two kinds of file fields, public and private, and have each node type have both kinds of file fields. Or I could have separate (though probably otherwise identical) public and private node types, with corresponding file fields. Both ways are awkward.

Any modules that would help with this that I have missed? (I put in a core feature request for a public/private toggle in the field, but that won't help in the short term.)


texts: How do I create radio button for options on a Drupal Commerce product?

texts: I just need some radio buttons for adding on components in a drupal commerce product. The best example is Apple's build a customized MAC or laptop where you add on specific elements to the product but start with a base. I also need to know how I can do this with ajax.


texts:
Is it possible to disable the page of one time login which can be accessed from the reset user password URL sent to the mail:

  www.example.com/user/reset/1234/1429007410/5H-zpRSsUsNNdiiFMZeaIZVthjO4uJjjrsVJ8Jg75Ys

and send the user directly to logged in edit profile page:

  example.com/user/1234/edit?pass-reset-token=fNWPgVXjnHocvcT3mWxp38vOCuLpz1e5lErOCCDGTe0

so we can make it 1 step instead of 2 steps and consider the user clicked the login button from the page 1 which can be dispensable !?


texts:
For a while now, all my Drupal 7 and Drupal 8 instances have been under constant attack from South America or Asia, where the attacker  is trying to infiltrate Drupal with MySQL injections.

The attack is done by adding some MySQL queries to at the and of the
    URL:

www.example.com/) AND 8205=8205 AND (2155=2155
www.example.com/ AND 4874=9552
www.example.com/ AND 8205=8205
www.example.com/') AND 5487=2530 AND ('Kcfy'='Kcfy
www.example.com/') AND 8205=8205 AND ('nUHc'='nUHc
www.example.com/' AND 9068=8481 AND 'wbYZ'='wbYZ
www.example.com/' AND 8205=8205 AND 'DeAs'='DeAs
www.example.com/%' AND 7985=5834 AND '%'='
www.example.com/%' AND 8205=8205 AND '%'='
www.example.com/ AND 5913=3547-- BaJk
www.example.com/ AND 8205=8205-- jBam
(SELECT (CASE WHEN (1873=3317) THEN 1873 ELSE 1873*(SELECT 1873 FROM INFORMATION_SCHEMA.CHARACTER_SETS) END))
(SELECT (CASE WHEN (9523=9523) THEN 9523 ELSE 9523*(SELECT 9523 FROM INFORMATION_SCHEMA.CHARACTER_SETS) END))
www.example.com/) AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND (3698=3698
www.example.com/ AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)
www.example.com/') AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND ('XLCQ'='XLCQ
www.example.com/' AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND 'Witz'='Witz
www.example.com/%' AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND '%'='
www.example.com/ AND (SELECT 1687 FROM(SELECT COUNT(*),CONCAT(0x71717a6a71,(SELECT (ELT(1687=1687,1))),0x716b716b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)-- OHLo
www.example.com/) AND 3711=CAST((CHR(113)||CHR(113)||CHR(122)||CHR(106)||CHR(113))||(SELECT (CASE WHEN (3711=3711) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(107)||CHR(113)||CHR(107)||CHR(113)) AS NUMERIC) AND (3563=3563
www.example.com/ AND 3711=CAST((CHR(113)||CHR(113)||CHR(122)||CHR(106)||CHR(113))||(SELECT (CASE WHEN (3711=3711) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(107)||CHR(113)||CHR(107)||CHR(113)) AS NUMERIC)

Can somebody tell my, what these attacks are about? Was there a bug in Drupal making it vulnerable for those attacks? Is somebody else experiencing those attacks?


texts:
The Drupal 7.59 installation we have a new page for each uploaded image in the files directory. (It's been like this at least since Drupal 7.39 when I joined this project.)

If the image is awesome-photo-by-Robin.jpg, we will get www.ourdomain.com/files/awesome-photo-by-robinjpg. (The missing period before the extension is not a typo.)

The problem is that these pages get indexed by search engines, and because they have no content except header, image and footer, they get very low ranking and clutters our SEO results.

Obviously, these are automatically created during the upload process, where you have no possibility to disable or choose this. However, afterwards, one can go through /admin/content/file and edit the file and voilá, some information appears.

Removing the alias doesn't help, since the page remain anyway. (I also cleared the Drupal cache to make sure.)

Can these auto-generated pages be disabled somehow?
If they can't be disabled, we're considering adding Disallow: /files/* to the robots.txt file. Do you think that would work at all to amend this issue, or maybe cause other issues down the road?
What is the actual purpose of these pages?

This is the HTML that's surrounding the IMG tag, maybe it can give you any clues?


texts: Trouble incorporating "Related Articles" block into panel

texts:
I have a "Related Articles" view block that is in use on the site, and it functions fine. The site's original dev team configured everything through templates, but the code is placed in the "Article" template properly, and it all is well. This is a standard Related Articles block that uses the contextual filter "Content: Has taxonomy term ID" to find other nodes of Article type with the same taxonomy terms.

I have a problem, though, creating a similar block for a recently created content type ("News"). This node type's display is configured through Panels, though I'm not sure if that's what's causing the issue. I cloned the original block and altered the (non-contextual) filter to select content based on whether the content type is either Article or News (the original does only Article). Everything else is the same, including the contextual filters. When I place this block in the News panel, I get no results in the block (I've double-checked to make sure I'm using terms that exist on other articles).

I'm sure there are a number of things that could be causing the issue, but I don't know where to look. Can you offer me any guidance?

Thank you.

EDIT:

Here is their php code. I'm not proficient in php, but this looks pretty barebones to me.

<?php print '

Related Stories

' . views_embed_view('related_stories', 'block') . '

'; ?>

EDIT 2:

I have tried placing the following php into the panel:

<?php
$node = menu_get_object();
if (is_object($node)) {
  $tid = $node->field_article_tags['und'][0]['value'];
  $output = views_embed_view('related_articles_for_news_', 'block', $tid);
}
echo $output;
?>

Still no luck. Everything looks correct to me. The URL on the view as I edit it is:

admin/structure/views/view/related_articles_for_news_/edit

and this is the only display in the View. The advanced settings say that the machine name is "block", and I confirmed that field_article_tags is correct.

Additionally, I accidentally left off the trailing underscore in the view title originally, and, of course, that did not work either.

Any thoughts as to where I might be going wrong?

Thanks again.


texts: What's the use of the new Star button in the project pages?

texts:
If you go to a Drupal project page (example Views) you will see a new button with a Start like this:

And you can Star and Unstar a project, but what is the real use of this button?

I can't find all the users that have starred a project.


texts:
When I was building a feature (as in Features), I noticed the menu_masks variable. I have read menu_get_ancestors() and _menu_router_save() but I still don't understand what it does.

On a more practical level: When I'm building a feature which defines the menu's for my site, should I export the menu_masks variable too?


texts:
I had asked this exact question on StackOverflow, until I cam across this StackExchange site...makes much more sense to post this here!

I'm using nice_menus-6.x-2.1 with Drupal 6.22 and would like to know if there is any way to rewrite the menu output so that the end-result resembles the following:

Parent Link 1

        Parent Link 2

Child Link 2[Description]

Child Link 2[Description]

Parent Link 3

Basically, I only want the customization on the second tier of sub-menus onwards. The
 wrapper is there for styling purposes. The  within the link tag is supposed be the description that you usually get on mouse-over, but I want this to show a bit smaller below the link (but be part of the link itself, and therefore not outside the  tag).
I'm sure this is possible? I just don't know where to start.  I'm looking within nice_menus.module but can't seem to find the function for the children rewrite. I currently have this working in a mock using plain HTML markup and CSS, but I just can't work out how to customize the PHP function in Drupal.

Has anyone been through this and would care to share?

Thanks a million everybody!


texts: Slow "Add another item" with unlimited valued fields

texts:
In Drupal 7, when you have node with field which has unlimited values (let's say, image field), "add another item" response time becomes very slow after you added 10 - 20 items. How do you fight this problem? Have you ever encountered this problem?

I created a project, where user can add up to 100 values of an image field which in theory has unlimited values setting. But, after you add a dozen of images, every new click on "Add another item" becomes slower than previous. I know this happens because of the fact, that Drupal rebuilds this field and all its values after each ajax request, so the more values you added the more work Drupal has to do on every "ajax" request, but, actually, this is not quite great thing.

Are there any approaches on how to change/override such a behaviour?


texts: Drupal shows ?? instead of special characters with oracle

texts:
I have a Drupal 7 installation working with Oracle 11g database with Apache/2.2.12 (Linux/SUSE) and PHP/5.3.8

The problem I face is that special characters are not displayed correctly. Instead two question marks ('??') are shown.

I've been able to correct some static pieces of content (in blocks) converting the characters to their corresponding html entity. However, new content and menus dont support this.

I would like to know how to show those characters correctly.


texts: How to make an existing website responsive using zengrids?

texts: i'm creating a website using drupal 7, zen theme with some other modules, like superfish menu for example, for now the website is empty, i'm wondering how to make the website responsive from now ? Can i just (from my starterkit theme) access to the css (or create my own) that contains some media queries and it will work ? or zengrids is a best solution ?


texts:
When a user tries to search for another user, the search returns no result, however, when it searches for a node e.g article, questions etc it returns a matching value immediately with search autocomplete. What is wrong?

Permissions are ok and user is set as default in settings. I want users to be able to search users, nodes, location or whatever available and matches their query.


texts: How to use preprocess function for custom templates defined in hook_theme?

texts:
I have a custom module that i've created and I have set the theme template like this:

/**
 * Implemtnation of hook_theme()
 */
function custom_slider_theme($existing, $type, $theme, $path) {
    return array(
        'custom_slider' => array(
            'variables' => array('nodes' => NULL),
            'template' => 'custom_slider',
        ),
    );
}

This is all working fine.

What I can't find is how to load a css file for that template so when custom_slider.tpl.php is loaded the relevent css file is loaded. I don't need that css loaded on every page. I would rather call drupal_add_css() only when it's needed.

I used below approach, but it's not working.

function ModuleName_preprocess_TemplateName(&$vars) {
      drupal_add_css(drupal_get_path('module', 'custom_slider') . '/file.css');
    }

Also I added

'preprocess functions' =>array('ModuleName_preprocess_TemplateName'),

in hook_theme, where I defined my templates, kindly suggest the right way to do it.

Any help with this is very much appreciated.


texts: How do I update commerce product display nodes based on SKU (of the referenced product)?

texts:
I would like to update the product display nodes with taxonomy terms based on the SKU of the referenced product of each node. Is that possible, programmatically?

I know the SKU.
I need to find the product by the SKU of a product display.
1.I update the taxonomy term of the product display accordingly.

I tried to use EntityFieldQuery without success.

If someone could possibly give me an idea on the best approach to do this in DrupalCommerce, or provide a link to the documentation I have missed, it is greatly appreciated. I have lost a day or two googling the wrong questions, apparently.


texts: Content is not filter with conceptual filter in views

texts:
I am using two view one view as a page with exposed filter and  another view as a block and filter the content by getting Value from url in  contextual filter.

Exp:http://exp.com/?field_project_catagory_tid=112&field_nd_portfolio_tid=92

If we use one conceptual filter this http://exp.com/field_project_catagory_tid=112

and  get the value with use the PHP code in conceptual filter

$path=drupal_get_path_alias($_GET["field_project_catagory_tid"]);
return $path;

Its working fine and listed the value in both the views

If  we pass one more filter then we have url Like this
 http://exp.com/?field_project_catagory_tid=112&field_nd_portfolio_tid=92
and it works collectively fine.

but if user filter with one filter it is not working.

Then how we can use the value in contextual filter for individually also. Please help


texts: Removing part of string retrieved from $_SERVER["REQUEST_URI"] in webform default value field

texts:
I'm trying to figure out if doing this is possible. I'm not very good at php so I'm trying to avoid having to create a module or something else to do this.

What I am trying to do is this:
In the default value field for a section in my webform, $_SERVER["REQUEST_URI"] to return the URL that the form is on, however, the entire URL is retrieved. (/cms/?q=content/82245940-initial-services) I want to cut out the non-identifying part of the URL so that I'm left with 82245940-initial-services. Is there a way to code this into the default value field(1 line), or do I need to create special code to do this?

Something like this:
$_SERVER["REQUEST_URI"-"http://example.com/cms/?q=content"]


texts:
I want parts of my site to be accessible to Android, iPhone and other mobile platforms. Is there a particular theme I should start with, or anything I should look for in a theme besides it being clean and simple?
Would I be better off creating a theme from scratch?


texts: How to format Start + End Dates without using PHP

texts:
I have a content type with a start date, and an option for an end date. When this field is displayed in a view, I would like to see

1 May 2012
2-3 May 2012

(etc...)

At the moment, I can only adjust the format to display

2 May 2012 - 3 May 2012

I've also learnt that even though an end date may not be provided, it defaults to the start date, so I can't use any rewrite rules in Views module to get around this.

Is there anyway to adjust the Date format when using a start and end date?


texts: Select the same number of results for every group

texts: I have views where I select nodes and group all results in 3 groups by field. When I select for example a limit to 30 I get results but with the different count in every group (for example 20/7/3). What I can use to select for example 10 most relevant results in every group. I can do it with query alter or maybe need to create some plugin?


texts: Get a list of revision IDs for any given entity?

texts: What's the most uniform method for getting a list of revision IDs for any given entity, programmatically?


texts: How to create webform according to user rules

texts:
I wanted to create a "Contact Us" webform, which should have following fields-

Name
Email Address
Contact No
Message

For an anonymous user, all of these fields should display.However for logged in user, field 1, 2 and 3 should not be displayed.

I don't see any option in webform to set a filed in such a way, so that only anonymous user can see it.

I tried to create two webform and assigned different-2 submission access but unknowingly now the website is having two menu items.


texts: How to output form element values as text?

texts:
On a node edit form, I want to make certain fields be non-editable by all users but the values stored in them to be visible on the form. My thought was to just print them out as text instead of in an HTML form element. What is the best way to accomplish this?

To provide some context, these values are populated via a migration and should not be edited on the site.


texts: How can I add a new module to existing Examples Module?

texts: I have created a New Drupal 8 Module that could be added to existing Examples Module. So, How I can proceed?


texts:
On a site I am working on, I get logged out almost daily. I assume there is a limit on the login duration.

I already set session.gc_maxlifetime to a very high value, using ini_set() in settings.php. This setting is visible in /devel/phpinfo.

Is there anything else that limits the login duration?

EDIT: The original problem occured on a Drupal 7 site. But I imagine that the same problem and solution would apply in Drupal 8. Maybe someone wants to confirm this in the comments.


texts: Drupal form does not save the user input value in the $form_state array

texts:
This question extends a prior question. I the previous one, I found several errors relating to coding, and thought I had solved the basic question, only t discover that it still is not working correctly.

I have a form to get a file name for opening (http://pastebin.com/8NfGGNSn). When I set the form field type as a textfield, the form widget saves my text entry (in the $form_state ['values']['upload_file] field). When I change the form widget type to 'file' the entry text from the form is not saved. My browser is Firefox and it makes available a browse button and a file selection window in the form. When I select the file from the window dialog, the form widget is completed with the full file path, however, it appears that the path text in the widget is not being placed in $form_state[values][update_file]. It remains empty. IN both textfield and file cases I am checking the value of the $form_state array during validation, so there should not be any clear or reset activity at that point. Any ideas why the content is deleted from the widget? OR does a file name get saved at another location?


texts:
Is it possible to use custom variables in content?

For example we have the price of a product which is listed on a large number of nodes as £9.99... This price then changes to £11.99. Updating this price becomes a pain!

What we would like is to be able to have a variable such as [product1price = £9.99] which we can include in node body. Then should we need to change this price, we can edit the variable to instantly update it everywhere it appears in the system.

Does a Module already exist for functionality like this?


texts: How to find orphaned files and images which are not linked from any css stylesheet or from any node?

texts:
Is there a way to list all unused files which reside inside public file system and inside a theme directory and list them, or maybe even have an option to delete them automatically?

I mean files which are currently not linked from any css stylesheet or from any node.


texts:
when I try to delete a view from the views module, I receive the following error:
error_1

Trying to save a new view shows this:
error_2

Any idea how to fix this?

I also cannot delete the view manually as my phpadmin tells me that there is an error and that I have to configure session.save_path... but I cannot find any file named session.save_path on my server.

Please let me know if you ever had this errors and if you know how to fix this. I invested 50 hrs to develop new functionality and I cannot risk the website goes down for days...

Thanks in advance!!


texts: Set custom timer for Slick slideshow based on field value

texts:
I have a Slick slideshow. My nodes have a Timer field. Right now, I am setting the time of the slick slide like so:

Drupal.behaviors.mrpeanut = {
  attach: function (context, settings) {
    var $slider = $("#slick-views-slideshow-page-1-slider");
    $slider.once('mrpeanut').on("afterChange", function(event, slick, currentSlide) {
            slideTime = $('div.slide--' + slick.currentSlide + ' div.field--name-field-timer').text();
            $slider.slick("setOption", "autoplaySpeed", slideTime);
        });
  }
}

However, I had some feedback that I may be better off to preprocess the field then attach a JS settings array with all the timer values. This is what I started piecing together based on some discussion in Slack (thanks, @nikathone).

In mrpeanut.module:

function mrpeanut_preprocess_node(&$variables) {
    $variables['#attached']['library'][] = 'mrpeanut/mrpeanut';
    $node = $variables['node'];
    $slideTime = $node->hasField('field_timer') ? $node->get('field_timer')->value : 20000;
    $slideTime = $slideTime * 1000; // Convert milliseconds to seconds
    $variables['#attached']['drupalSettings']['slideTime'][$node->id()] = $slideTime;
}

In mrpeanut.js:

(function($, Drupal, drupalSettings) {
    Drupal.behaviors.mrpeanut = {
        attach: function(context, settings) {
            var $slider = $("#slick-views-slideshow-page-1-slider");
            var slideTime = drupalSettings.slideTime;

            // Get Node ID from the article
            var nodeAbout = $('.slide').find('article').attr('about');
            var nodeID = nodeAbout.substring(6, $('.slide').find('article').attr('about').length);

            $slider.once('mrpeanut').on("afterChange", function(event, slick, currentSlide) {
                $slider.slick("setOption", "autoplaySpeed", slideTime);
            });
        }
    }
})(jQuery, Drupal, drupalSettings);

However, it's not actually setting the correct timer values. One issue I'm having is that I need to capture all Node IDs from the view (whereas now I am only getting the first). Second, I'm setting the time slide on the afterChange instead of initially all-at-once.


texts: Why is my Menu Router being rebuilt on every request?

texts:
I have inherited a Drupal 7 site, and it is running quite slowly.

After enabling the Devel Query output, I noticed (not that it would be hard or anything) that there is a 65ms query DELETE FROM menu_router. There are also roughly 25 other queries, all coming from the _menu_router_save() function.

It seems to me that the Menu Router is being rebuilt on every single page request... Currently, our themer is rebuilding the theme registry on every build -- but that should be drupal_theme_rebuild(), correct? I don't see anything on that function's page that would indicate it also rebuilds the menu router..

Additionally, I recently installed a custom module, and hook_theme would never actually take -- I tried clearing the cache and rebuilding the menu router, but I ended up having to add the values manually to the menu_router table. This makes me wonder if the menu_router table is even being truncated during this ~65ms query.

Does anyone know why my Drupal 7 site would be trying to do this?


texts: How can I create unique path alias for image styles?

texts:
image_style_url returns the public url of an image in the files/styles folder. Is it possible to create alias to that? What I want is the following:

Call image_style_url from the image style and the uri, which gives me typical public url /sites/default/files/style/[style_name]/path/to/image/[image_file_name]. I want to serve simple url like /image/[randomized_number] to the user that will internally alias to the aforementioned public url. This is similar to asking what pathauto module does for /node/[nid], but for image styles.

Note that I do not want custom url to individual images per se, but rather a way to programmatically create unique unpredictable url aliases for image styles.


texts: How to get firstname in autocomplete when adding new members in og group?

texts:
I have created the group in og.

When adding the user for the group, In autocomplete its been displaying the user's email ID.

function custom_form_alter($form,&$form_state){ if($form['#id']== 'og-ui-add-users'){
     $form['og_user']['name']['#autocomplete_path'] = 'user/autocomplete';
}

}

But I want to get the name instead of email ID.

I have tried to change the user/autocomplete in hook_form_alter,but its displaying email id only

Is there any way to get name instead of email ID ?

Tell me how to sort out this problem?


texts: How to make Expose filter of Author Id from autocomplete to select list?

texts:
I added a exposed filter of Author and it showing me the autocomplete. How to change it in select list?

I found a solution here https://stackoverflow.com/a/3885759. Is there any other simple way to do it Because I have other filters also so I can't take a contextual filter?


texts: get taxonomy terms of parent node while in block

texts: I'm in drupal 7. Let's say I have a block on a website page.  The website page is a node that has taxonomy terms.  How do I programatically get the taxonomy terms of the website page node from my block?


texts:
Is there a hook responsible for generating the node object's data?

I want to add some custom data to specific node objects to help with the functionality of a very complex website.

Can anyone help, please?


texts: Rules: fire at adding term only when one of this term anscestors is other specific term

texts:
I'm trying to add menu items programatically by using rules - the item should be added after user will create a term, but I need a specific condition that I cannot accomplish - fire rule only if ONE OF THE ANCESTORS of created term is specific term. So for example if I have hierarchy:

Term 1
Term 2
 - Term 2.1
 - Term 2.2
   -Term 2.2.1

I would like the rule to fire when the added term is 2.x.x.x... How can I accomplish this? I was trying for few hours different approaches without luck.


texts: I have a content type called user registration under this one cck field called regid. i would like to fetch the entered values of this particular field through programmatically probably by using dbquery() functions and print it. Anyone guide me how to achieve it.


texts:
Bootstrap has templates like new age, creative, clean blog, etc. How do I add these templates to my site?

My workflow didn't work out well.

I copied the starter kit less to themes/custom
I renamed it to testtheme
I renamed all THEMENAME.yml files to testtheme.yml
I executed git clone https://github.com/BlackrockDigital/startbootstrap-new-age.git

Edit:
- Installed and set as Default (backend)

Unformatted bootstrap

edit 2:
global-styling:
 ` css:
    theme:
      css/style.css: {}
      css/new-age css: {}
      css/new-age.min css: {}

bootstrap-scripts:
  js:
    js/new-age.js: {}
    js/new-age.min.js: {}


texts: How to create a role without some permissions an "Authenticated User" has?

texts:
I have created a custom role. It automatically receives any permissions given to authenticated users. Is there a way to prevent this from happening?

What I would like to achieve is:

Authenticated user: has permission to edit email address and password

Custom role: doesn't have permission to edit email address and password

Currently on my site, users all have the permission "Authenticated user". I would like some new users to have the "Custom role".

The answer to this question: How can i create a user without role authenticated user role suggests to instead edit the "Authenticated user role" and swap the "Custom role" to being the one with more permissions.

So instead I would have to have:

"Authenticated user": doesn't have permission to edit email address and password.

"Custom role": has permission to edit email address and password.

BUT if I do this then all of the current users will no longer be able to edit their email address and password, as they will still be "Authenticated Users", and updating each user to the new role would require entering their password (which I can't do).

Note: I would still like all users to be able to edit other fields such as "First Name".


texts:
I am trying to create a content type (Quiz Question) in Drupal 8 that has a bunch of regular plain text fields. I also want to add a field that acts as a list of answers. Each answer should have a plain text entry and a boolean entry.

The data model for a node will look something like this:

    {
        "Question": "Does Drupal rock?",
        "Answers": [
            {
                "Answer": "Yes",
                "IsAnswerCorrect": true
            },
            {
                "Answer": "No",
                "IsAnswerCorrect": false
            },
            {
                "Answer": "You're a rock",
                "IsAnswerCorrect": false
            }
        ]
    }

Is there any way to do this without creating custom field types or entities using separate custom modules and plugins?


texts: How to create a select drop down that opens a URL?

texts:
I have a select drop down. When the user selects a value from the drop down, the user will then click on a button and based on what the user has selected it will open a url in a new tab. While this is quite simple in JavaScript I am struggling how to figure this out in drupal.

So far I have created a custom module which has a select form and the submit button. From here I am stuck as to how to write if user has selected value a open google.com etc. any suggestions or pointers would be greatly appreciated.


texts: 3-rd decimal digit has disappeared in the output

texts:
I created a field, attached it to the entity: coefficient_to_second_side. Type in the  database is decimal(10,3). Then I added a value: 1.001. When I select this field manually from the database, the value is correct. In the edit form it is correct:

But when I output the field on the entity page:

field_attach_prepare_view('event', array($entity->id => $entity), 'full');
entity_prepare_view('event', array($entity->id => $entity));
$entity->content += field_attach_view('event', $entity, 'full');

I get this:

Coefficient to second side:
1.00

The third digit has disappeared. How to fix?


texts: How to include a PHP Framework / Library in my module?

texts:
I wanted to include PHPExcel.php in a testing module. So I put this file and the rest of the lib into:
sites/all/libraries/phpexcel/
and I used this in my module:

function mymod_libraries_info() {

$libraries['phpexcel'] = array(
'name' => 'PHP Excel',
'version arguments' => array(
  'file' => 'PHPExcel.php', // Could be any file with version info
  'pattern' => '/Version (\d+)/',
  'lines' => 5,
),
'files' => array(
  'php' => array('PHPExcel.php'),
),
);
return $libraries;
}

But after a:

$objPHPExcel = new PHPExcel();

I get a:

  Fatal error: Class 'PHPExcel' not found in sites/all/modules/mymod/mymod.module on line 81

Should be an easy inclusion somewhere? But where and how?

I found a composer.json as well along with the PHPExcel Lib - should I rather try to install composer_manager and try to get the composer installation working?

Thanks in advance


texts: Display multiple timezone values from a single date/time entry

texts:
In Drupal 7 Views Date/Time field, is there a way to generate multiple timezone values from a single event date, with start and end values?
For example, if an event is entered into the start/end Time fields with 4:00pm to 5:30pm (using PHP date format "g:ia"), is there any way to decrease or increase the rendered values to reflect different time zones, as in "4:00pm to 5:30pm EST / 1:00pm to 2:30pm PST"?


texts:
It looks like all popular lazyload modules only work with Images. I would like to get lazyload to work on my inline images (images inserted with Media/FCKEditor).

Do any modules support this? Or is there another way?


texts: Is there a way to check if a custom form element exists in application

texts:
Suppose i am building a custom form element with

  hook_element_info()

Is there a way , in another module,to check this element's existence before inserting it to a form?


texts: Panels Node Add form and passing url parameters

texts:
I'm using panels to override a nodes display page. I also want to use it to overide the edit and add page. The cck type I'm trying to add has a node reference field, this needs to be passed in through the url.

So far, I've add the panel varaint, added a context (node add form), and added the form to the "content" of the panel, All I need to figure out is how to pass the referencing node ID to the form. Does any one know how to do this?


texts:
For our new Drupal site, it would be ideal if we could manage all images manually. We need to able to resize/crop and put the files where an author decides to put them. The reason is that these images are used in multiple locations, e.g. a podcast and as thumbnail images for the corresponding video. Another reason is that these images are served from a subdomain, which is connected to a CDN (through CloudFlare).

Basically what I/we need is a URL field where an author can paste the image URL, that is then turned into an image on the website. The author would generate the various image types, e.g. thumbnail, medium, large.

I could not figure out what the best approach is to add an image/text field to a content type in order to display the image on the website. Any pointers would be much appreciated!

Thanks.


texts:
I want to load a certain node. I don't know the id of the node but I do know that it has a certain hash field that is unique and I know that hash.

I want to load the node via the hash field. How can I do that?


texts: efficient organziation of geographic state/region/content for entries

texts:
This is kind of a general question, but maybe someone has an idea.

I have a database that will have 300,000+ entries. Each one of these entries will have multiple entries for 'location' - not specific locations, and not gps coordinants. It's regions, across the world. And there can be numerous locations for each entry.

The way I have it in attempt one, is to create a taxonomy of locations to choose from, with hierarchy of Contenent --> subcontinent --> country --> state/dept/province. Within the entry form for each item, there's a select list that pulls each region from the taxonomy, and drill down to smaller regions in a subsequent dropdown, with each selection.

I didn't think this would become such a load on the system, but it certainly has using such a large set of taxonomy terms in one vocabulary. Maybe someone has come up with a lighter way of doing this?


texts: How can I set a 'global' Exposed filter rewrite for taxonomy terms on a view

texts:
How would I go about settings a rewrite for display taxonomy (Rewrite filter options), but as a 'global', instead of having to set each individual value for exposed filter?

I can see the there is place to add individual value overrides for the filter display, but my taxonomies are many and may update occasionally.

So the issue is two-fold; The taxonomies to be displayed on the exposed filter are quite long in some cases (which is needed). And they will be adjusted on the fly by content maintainers.

Instead of:
1 | Display 1
2 | Display 2
3 | Display 3

I would be perfect if I can do:

[vocabulary:original:name]|[vocabulary:original:description]

But for some reason it's not working for me.

The additional application of this is that the short tax term can be used on the csv import, but front-end displays the complete long version tax.

So if I can get the actual term to be a 'keyword' and display to front-end users a long term, the back-end user will have a better experience as well.

Currently working with Better Exposed Filters and D7.
Thanks


texts: Rules Comparison Operator Is Missing The Direct Input Method

texts:
I have an "equipment" content type, which has a "manufacturer" field applied to it.  The "manufacturer" field is a taxonomy term reference to a taxonomy which contains all of the manufacturers.

When "equipment" is flagged, I want a "task" to be created.  The problem is, I need different tasks created depending on what manufacturer it is.

Task A applies to manufacturer terms 1,2, and 5.

Task B applies to manufacturer terms 3 and 4.

When I set this up in Rules, I use a "Data Comparison" to check what manufacturer the equipment belongs to.  When I use only one manufacturer, the "Data Comparison" gives me a Direct Input to compare to, I set the comparison operator to "Equals", and I can type in, for example, 2.  Everything works.

However, I want this rule to apply to manufacturers 2, 1, and 5, so I set the comparison operator to "Is One Of".  Suddenly, the Direct Input Method disappears, and I'm sunk.

Is there a way in Rules to compare if a field equals one of several taxonomy terms (OR logic)?


texts: How do I remove the revision information from a node edit form?

texts:
I'm hoping someone can help a Drupal beginner removing a view from my page. The purpose of it is a for data collection.

This is the section I am trying to remove:


texts: Can I connect via REST services with a mobile app I will develop?

texts:
I'm thinking of developing an e-commerce with Drupal 8 and Drupal Commerce, but I need to know if I can connect via REST services with a mobile app that I would develop too. The app would need to be able to create carts, make orders, payments, and so on.

I have already developed several apps which connect to Drupal 8 and created content, but I need to know if it's possible to create orders, carts, payments, etc.


texts: How can I have a video pop-up when a user logs into my site for the first time?

texts:
I have a website using Drupal 7.

I would like a video tutorial to pop up when a user logs into the site for the first time.

How can I do this?


texts:
How to display just the label from the object returned by the function
node_load().
the field_view_field() can hide the label and view the value
but i want the converse.


texts: More link not displaying in content pane

texts:
I've got a Content Pane View which I display multiple times on one page (it shows a grid of Employees and takes a Department as a parameter, so I show the View 4 times on a page, sending each one a different Department parameter).

Each view on this page shows only a subset of the results (it only shows 6 Employees from each Department). I want to add a More link at the bottom of each view that links to a page that shows all results for that Department.

However, in the View configuration (Content Pane variant) I enable the More link to show, but it doesn't show.

Any ideas why the More link wouldn't show? I've definitely got enough content and I've even tried setting the configuration so that it'll show the More link even if there isn't more data.

Are More links disabled when displaying the view in a content pane?


texts:
I'm trying to build a new widget for the entity reference module.
(nested checkboxes = tree according to entity references between nodes)

The only answer I'm looking for is :
"How to get the list of all entity reference fields and their params? (child and parent node)

Thank you for your help!

Ludovic

Edit : working on D7


texts: How to switch to other site's database in multisite enviroment?

texts:
The use case is the following:

I am in default site. I want to get the connection of the "preview" site instance database from the default site code. How is it possible?

I tried Database::setActiveConnection('preview')), but it didn't help. setActiveConnection method seems to choose only from your site settings.php.

* WORKAROUND *

If you want to handle multiple database under one site instance then you should declare their connection array under your site's settings.php!


texts:
I have multiple content types for consumer electronics goods, like "tv", "laptop", "mouse" etc. Every content type has its own fields and exposed using contexts and views with custom facet api blocks – "catalog/tv", "catalog/laptop" etc. The number of content types is more than 100 and growing.

I need to display custom blocks with description and images for each content type which would be displayed on the catalog pages with facets. The common way is to create block and manage the visibility with contexts or block interface. But it is to tricky for content managers, there is big possibility of errors and also I get 100+ blocks.

So I want to create custom content type which nodes would be displayed with contextual views on facet pages. But how to link node to content type?


texts: Where and how are escape quotes stripped when saving a taxonomy terms which include comas or quotes?

texts:
in taxonomy_autocomplete:
https://api.drupal.org/api/drupal/modules!taxonomy!taxonomy.pages.inc/function/taxonomy_autocomplete/6
we have the following code:

   // Commas and quotes in terms are special cases, so encode 'em.
      if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
        $n = '"' . str_replace('"', '""', $tag->name) . '"';
      }

Imagine we have the taxonomy term which is exactly the following string:

George "madcow" Stewart

THe above code would cause the taxonomy autocomplete to display:

"George ""madcow"" Stewart"

I have re-implemented the taxonomy_autocomplete in order to work with a single term (no comma separated list of terms allowed).
The problem now is that when we want to enter George "madcow" Stewart, a new term "George ""madcow"" Stewart"  is created, including all the extra quotes!

I cannot find where and how in core the escape quotes are stripped before insertion to the database…


texts: Drupal method to retrieve all existing roles and all users of a specified role

texts:
I wish to retrieve the list of all users that belong to a particular role.

The query is to know:

if there's any drupal method that provides list of all available roles created under Admin >> User Management (admin/user/roles) similar to retrieving all node types using node_get_types method.
if there's a drupal method to get list of all users who belong to a particular role.

Though I could get this done by querying the role table and using the result with user_roles table, I felt that there might be some in-built method in drupal which must enable me to achieve the desired result which i might've missed out searching.

I'm aware that it's not ideal to check user permission related stuff with roles and rather user permissions instead from this post.

It'd be great if I could get a definite answer for my above mentioned queries.


texts: Views exposed filter error "An illegal choice has been detected. Please contact the site administrator."

texts:
I am having a very odd problem with an exposed filter in one of my Views. The page I am talking about is here: http://epsindustry.org/eps-packaging-map2

When I select one of the last 2 options in the menu (EPS Packaging Recyclers or Loose Fill Recycling Drop-off) I get an error that says An illegal choice has been detected. Please contact the site administrator. This is really weird to me because it only happens with these 2 options. I don't believe they are set up any differently than the other taxonomy terms. There's nothing all that special about them, its just a term that the admin selects when creating a location for the map.

Any ideas as to why this is happening or how to fix it?


texts:
I am attempting to add a custom User action so that it will be available as a Bulk Update in the user_admin_people view. In /web/modules/custom/my_module/src/Plugin/Action directory I have this file called AssignDistributor.php"
<?php

namespace Drupal\my_module\Plugin\Action;

use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;

/**
 * Assign user to distributor node.
 *
 * @Action(
 *   id = "assign_distributor",
 *   label = @Translation("Assign distributor to user),
 *   type = "user"
 * )
 */
class AssignDistributor extends ActionBase {

  /**
   * {@inheritdoc}
   */
  public function execute($entity = NULL) {
   // Code here.

  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    /** @var \Drupal\taxonomy\TermInterface $object */
    /* $result = $object->access('update', $account, TRUE)
      ->andIf($object->field_push->access('edit', $account, TRUE));

    return $return_as_object ? $result : $result->isAllowed(); */
    return TRUE;
  }

}

and in /my_module/config/schema/my_module.schema.yml I have this entry
action.configuration.assign_distributor:
  type: action_configuration_default
  label: 'Assign Distributor'

and finally, in /my_module/install/system.action.assign_distributor.yml I have
langcode: en
status: true
dependencies:
  module:
    - user
id: assign_distributor
label: 'Assign a distributor to the selected user(s)'
type: user
plugin: assign_distributor
configuration: {}

However, my action does not show up as an option in the view. I have cleared my cache, and uninstalled and reinstalled my module. What else am I missing?
UPDATE: Interestingly enough, my action shows up just fine if I use Views Bulk Operations


texts: Everytime I create a View using Views Drupal times out

texts:
So if I create a view with more than 2 fields Drupals gets really slow and timesout. I am pretty much stuck here.

My content never shows. Anyone seen this behavior? This is a completely custom theme and I am very new.

I am using Views with Drupal 7.


texts: Redirect after login through different login form

texts:
I try redirect user to specific tab on user profile page. I found couple solution how I can do that but it doesn't work if I use login form modules like Super Login, Bootstrap login form, fancy login, etc. When I try redirect user via trigger It give me AJAX error.

Then I try use Rules module and it doesn't redirect after login at all. All of it works fine if I login through standard login form.

I spent 2 days for this issue and can't find any solution. Please give me right way how to do that.

I use Bootstrap login module

link to my tab: user/[account:uid]/mytab

This is my rule:

    { "rules_red" : {
"LABEL" : "redirect",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "user_login" : [] },
"DO" : [ { "redirect" : { "url" : "user\/[account:uid]\/mytab" } } ]
 }
}


texts: Ubercart show Prices without Tax For specific Role

texts:
I need to show prices without tax for specific user role. Other available roles should see prices with included tax.
How I can achieve this behavior?


texts: How do I insert a user picture's thumbnail on the "Submitted by" field?

texts:
I want to insert user picture's thumbnail on "Submitted by" field, which is displayed in teaser such as the following.

  Submitted by [some_user] [someuser picture's thumbnail] on xx/xx/xx

How do I do that as effortless as possible?


texts:
I cloned the Block property view and renamed it Block portfolio.

When I change the content type, the Block property and Block portfolio still use the same content type.

How do I override it?


texts: How do I implement the autocomplete functionality in Webforms?

texts:
I have a drop down box with college names that has 9000 options to choose from. I am unable to use the drop-down field in Webforms.

Is there a way to use an autocomplete in a text field for Drupal 6?


texts: saving JS settings in theme_settings.php file

texts:
i am working on a responsive D7 theme and need some JS settings to be saved via theme settings form not a custom module. i did following codes to give what i want but it seems that Using drupal_add_js() function to add JS settings in theme_settings.php file doesn't work. could you please point out what is the problem and is there any alternative solution?
some of my codes in theme_settings.php file is as followings:

/**
* Implements hook_form_system_theme_settings_alter()
*/
function glossy_form_system_theme_settings_alter(&$form, &$form_state) {
    $theme = alpha_get_theme();

    $lib_options = false;

    /** add mobileMenu options to theme settings */
    if (isset($theme->settings['libraries']['glossy_mobileMenu'])) {
        $lib_options = true;
        $form['alpha_settings']['glossy_lib_options']['mobileMenu'] = array(
            '#type' => 'fieldset',
            '#weight' => -10,
            '#title' => t('mobileMenu options'),
        );

        $form['alpha_settings']['glossy_lib_options']['mobileMenu']['mobileMenu_selector'] = array(
            '#type' => 'textfield',
            '#description' => t('Select the CSS selector of the container that all inner menus will be responsive. e.g. %example', array('%example' => '.navigation')),
            '#title' => t('responsive menu container selector'),
            '#default_value' => theme_get_setting('mobileMenu_selector'),
        );

        $form['alpha_settings']['glossy_lib_options']['mobileMenu']['mobileMenu_title'] = array(
            '#type' => 'textfield',
            '#description' => t('e.g. Select a page'),
            '#title' => t('First option text'),
            '#default_value' => theme_get_setting('mobileMenu_title'),
        );

        $form['alpha_settings']['glossy_lib_options']['mobileMenu']['mobileMenu_indent'] = array(
            '#type' => 'textfield',
            '#description' => t('e.g. !string', array('!string' => '&nbsp;&nbsp;&nbsp;')),
            '#title' => t('string for indenting nested items'),
            '#default_value' => theme_get_setting('mobileMenu_indent'),
        );

        // add submit handler
        $form['#submit'][] = 'glossy_mobileMenu_submit';
    }

    if ($lib_options) {
        $form['alpha_settings']['glossy_lib_options']['#type'] = 'fieldset';
        $form['alpha_settings']['glossy_lib_options']['#weight'] = -10;
        $form['alpha_settings']['glossy_lib_options']['#title'] = t('Libraries options');
    }
}

function glossy_mobileMenu_submit($form, &$form_state){
    // Add the mobileMenu options variables.
    drupal_add_js(array(
        'responsive_menu_options' => array(
            'selector' => $form_state['values']['mobileMenu_selector'],
            'title' => $form_state['values']['mobileMenu_title'],
            'indent' => $form_state['values']['mobileMenu_indent'],
        ),
    ), array('type' => 'setting', 'scope' => JS_DEFAULT));
}

thanks in advance.


texts: How to place size of file in the node in the title?

texts:
I want create page for issues of newspaper. Title of the issue page must contain the issue number, date of publishing and size of newspaper file in MB.

I implemented number and date in title with Automatic Entity Labels and Token modules. But how I can place in title size of the uploaded file?

I tried to use custom module:

/**
* Implements hook_token_info().
*/
function mytokens_token_info() {
$node_tokens['field_file']['size'] = array(
  'name' => t('File size'),
  'description' => t('File size'),
);
$node_tokens['field_file']['size']['mbytes'] = array(
  'name' => t('In MB'),
  'description' => t('File size in MB'),
);
return array(
  'tokens' => array(
  'node' => $node_tokens,
  ),
);
}

/**
 * Implements hook_tokens().
 */
function mytokens_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();

if ($type == 'node' && !empty($data['node'])) {
$node = $data['node'];

foreach ($tokens as $name => $original) {
  if ($name == 'mbytes') {
    $replacements[$original] = $node->field_file['und'][0]['filesize']/(1024*1024);
  }
}
}

  return $replacements;
}

But my tokens don't shows in the token tree and nothing replacements occur.


texts:
In my article content type, I've added a header image (field_header_image) field which I placed a default image into it so that all articles would have a default image used if one wasn't needed. However, when creating an article and leaving that field as the default value, it doesn't actually use that default value. The page is created as if that value is empty.

Is there any way to make sure that this default value is used?

Is there a way to do this through the .theme file? Is this the best way to do it?


texts:
I want to change the one-time login URL, which is the link being sent to the user in order to reset his password.

I want to make it smaller and not have the random letters in its URL.

Is this possible? Where can I change this?


texts: Notice: Undefined index: main_profile in include() (line 54

texts:
global $user;
$user->uid ;
print_r($user->uid);
print "print out the user value" . $user->uid;

$uid =3;

$account = user_load($user->uid);

$profile = profile2_load_by_user($account);

$print_first_name =  drupal_render(field_view_field('profile2',$profile['main_profile'], 'field_first_name'));
print $print_first_name;

What I have attempted to do is to pass the $user->uid to the user_load function.
When I pass $uid = 3 to the user_load function it seems to work fine. I am wondering what approach I should try to fix this problem.

error message:

EntityMalformedException: Missing bundle property on entity of type profile2. in entity_extract_ids() (line 7562 of /home/td6/public_html//includes/common.inc).


texts:
I'm looking for an easy way for my clients to re-arrange the order of nodes.
When creating a content type I added a "weight" field for them to change, but of course with a lot of content this is a lot of work.

Is there any module that allows drag 'n drop to change the order of nodes being displayed in a view?


texts: I want the date view filter on current date, not on current time

texts:
I have schedule view in my project. I want to show the current day schedule in my view. We have following option in date filter.

"An offset from the current time such as "+1 day" or "-2 hours -30 minutes""

which gives you option for show the schedule from current time. which did not allow you to show the current day result. I used the "Views between dates filter" module but it gives filter on node created date only.

We can override the view by using the "hook_views_pre_build" hook.

Is there any better solution for this?


texts: The best way to store drupal Configuration

texts:
I know three options to store the configurations:

Use the UI and store the values into the variable table.

Also you can store them in settings.php and use the $conf[''] array to store the information.

The last options is to store the values with variable module.

What do you thing is the best one, not for an final user but for a developer.

Oskar

I don't add "strongarm + features" because sometimes features is a little nightmare, and I'm trying to leave it far from me.


texts: What's the difference between 'commerce-line-item-unchanged' and 'commerce-line-item'

texts: In drupal commerce rules there are selectors like 'commerce-line-item' and 'commerce-line-item-unchanged' – what is the differnece between them? When should i use the one or the other?


texts: Change language of a JS element when language has been changed from Drupal language switcher?

texts:
First of all, sorry for the really confusing title, but I have no idea how to make it more reader friendly.
On my website, there are three languages: English, Finnish and Swedish. The user can change between these languages from the default Drupal language switcher.
Now the key part of the website comes from an API that I think is in JS. That JS element has its own language changing parameter.

  src="//www.websiteofapi.com/alpportal/oa_head.js?proj=api-of-our-company&key=api-key-goes-here&lang=sv&leaflet_gshim=1">

So in order to change the language of the JS element I would need to change that "lang=" part to what language I want.
I have that script with the address to the API in my page.html.twig file to make the API call to work all across the site.

Is there a way to change the lang=sv to lang=en and lang=fi when the user changes the language through Druapl language switcher?

From the companys API support they said:

  you have different pages for different languages:
  website.fi/drupal/ (englisch)
  website.fi/drupal/sv
  website.fi/drupal/fi
  This means that you should have a different script tag for each of these
  paths. I guess Drupal allows that with help of a language variable
  that is accessible in your page template. (But I really know little
  about Drupal, so that's just a guess)

I am sorry for a long and confusing post, but it is really crucial to get this to work and I am losing my mind.
PS! I am really new to Drupal.


texts: Change in module update function not saved

texts:
I have a module that uses update function in the module.install file.

When debugging these changes during development, I call the function from hook_init().

function mymodule_init() {
  require_once __DIR__ . '/mymodule.install';
  mymodule_update_7016();

Everything is just peachy. The update code is run, which makes changes to a the CiviCRM settings for a Drupal webform. When I load the webform edit page I can see the changes have been made.

Now I think I'm done with this, and I can just use drush updb to call my upgrader. I do so. My updater runs without errors.

However, when I check the page, there are no changes reflected in the webform. The exact same code is run from two different places, and in one case the results are saved; in the other, nothing happens.

I have tested making changes to the node title (which is unrelated to webform_civicrm) and it works in both cases so the problem seems to be related to webform_civicrm.

Why would the behaviour be different in an upgrading function compared to when run as part of the request lifecycle in hook_init()? I've added drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); to my code to see if it made any difference, but it didn't.


texts:
In Drupal Commons, we're using the Realnames module. Is there a way to extend this module's information to other search box fields?

For example in the Organic Groups invite (/og/users/??/invite), could my users search for other users by the user's first or last name? That is, in the form og_invite_link_invite_page_form's first field (edit-invitees), how could I search on an individual's Given Name (first name) or Family Name (last name)?

This addition provided what I needed. Basically, I needed to override the $form['invitees'] by using and slighly modifying og_username_helper.module ( http://drupal.org/project/og_username_helper ).

 74     if ($form['#id'] == 'og-invite-link-invite-page-form') {
 75       // print 'in';
 76       // print_r($form['invitees']);
 77
 78       $form['invitees'] = array(
 79           '#type' => 'textfield',
 80           '#description' => t('Lookup a username and add it to the list below.'),
 81           '#autocomplete_path' => 'og/username_helper/autocomplete',
 82           '#size' => 40,
 83           '#maxlength' => 60,
 84           '#weight' => -2,
 85           '#access' => $helper_access,
 86           );
 87
 88       return $form;
 89     }
 90


texts: How to prevent edit or delete of some content by its author depending on an approval status field?

texts:
Here is a screenprint to illustrate part of my current implementation:

This is what I want to achieve:

If the value of 'Admin Status' is not "Approved", then the author can still edit or delete his/her own content.
If the value of 'Admin Status' is "Approved", then the content can not be edited by the author.

I have tried a lot, even using the Rules module, but nothing works for me.

Any suggestions about how to get this to work?


texts: How to transfer data from views-view-fields.tpl to views-view-unformatted.tpl in D7?

texts: I need to collect some data within views-view-fields.tpl, and then transfer it to  views-view-unformatted.tpl to do some magic to the whole data-object. How could I do that? Thnx!


texts: How can you load redirects for a node to delete them? (redirect api)

texts:
I'm trying to create a module which creates a redirect when a node is unpublished and removes it if the node is published again.

The redirect module API, has functions for doing both redirect_save and redirect_delete.

However I can't work out how to load all the redirects for a specific node in order to delete them, I think you might be able to use redirect_load_by_source but I can't work out how to get it to function correctly.

Has anyone tackled this sort of problem before?


texts: Taxonomy term missing as type of data to store in new field for content type

texts: I have Drupal 6.2. I added a taxonomy term and I am trying to to add it as a new field to a content type. However, I don't see "taxonomy term" as a "type of data to store" when I try to select a field type.


texts: Memory size exhausted when trying to run Cron manually

texts:
On my Drupal 6 website, when I run cron manually the following error message shows up:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4181580 bytes) in /dirname/includes/database.mysql-common.inc on line 34

Cron is set to run every night automatically, but for a few days it was not running, so I tried it manually.

For Drupal, where should I increase memory? Should it be in settings.php, php.ini for php, or somewhere else? I'm using AWS RDS & EC2 instances.

I have this in the settings.php file:

ini_set('memory_limit', '128M');

Some help would be much appreciated.


texts: Twig LoaderError: Template is not defined

texts:
When I try to edit a page to upload 2 documents, I get an error.

Procedure: I edit the node, upload the first document. Then I insert a new field to upload the second document. However, the second field does not appear and I get the following error message in dblog:

  "Twig\Error\LoaderError: Template
  "themes/bootstrap_sbv/layout/sbv-personenseite-layout.html.twig" is
  not defined. in Twig\Loader\ChainLoader->getCacheKey() (line 10 of
  webpath/docroot/modules/ds/templates/ds-entity-view.html.twig).

I have tried to include the layout in the "ds-entity-view.html.twig" file.

{% include "/themes/bootstrap_sbv/layouts/sbv-personenseite-layout.html.twig" %}

But it doesn't work.

Curiously, everything works on the local environment. Only on the test and production environment I get the error. I have a custom theme on my Drupalsite.


texts: Is there a module to track future revisions of published content in Drupal 6?

texts:
I need to track a future revision of a published node that can be reviewed, edited, and eventually published over the currently published revision of the node.

The idea is that you have a page that is published and public but you are able to start making edits on a copy of the published page that are not visible to the public. When you are ready you can then publish this revision over the published, public one.

This feature is provided by the (excellent looking) Workbench module. However, Workbench is only for Drupal 7. Is there a Drupal 6 module that provides this future revision support?


texts:
How do I limit one role per user?

I want to see a select form field, instead of checkboxes for roles when I go to /user/#/edit.
So far I tried overwriting the $form['account']['roles'] in template.php, replace the checkboxes with a select dropdown, but failed.


texts: I have a fairly complex custom module that I'm trying to troubleshoot. The module runs several functions that get called on a user action via AJAX. The issue is that Drupal gives me a bunch of warnings and notices that various variables are undefined. However, I get these warnings and errors on page load - before the user has done anything. It almost seems like Drupal is running through all these functions and when the page loads, rather than when it's supposed to. I could simply edit php.ini, but I'd like to understand why Drupal would be calling these functions.


texts: How to present a field or another in a content type, depending on context

texts:
I have a custom content type, let's call it seo_data. I want that the user will be presented, in the Admin view, with some of the fields, not all, depending on the context. So for some nodes, based on nid and other database queries, the user will see, for example, fields field_image and field_image_alt or field_video and field_video_alt. So, sometimes the user will see the fields corresponding to video or image, depending on some values in other data.

The question is about how can I, programmaticaly (prefered) or with a custom module, present just a bunch of fields.


texts: How to grant user points to the product creator after the product is sold?

texts:
I would like to grant user points to a product owner in amount of 70% of product price after product is sold.
I have a rule and part of component

Rule

Events:
Completing the checkout process

Actions:
Loop (commerce-order:commerce-line-items)

Rules Component

Conditions:
Entity has field (Entity: commerce-line-item, Field: commerce_product)

In action I can not put the value for field POINTS and I'm not sure about the user. Now I have: commerce-line-item:commerce-product:creator

Actions:
Grant points to a user:

What should I do more for my purpose?
I have Drupal 7 installed.