texts: recaptcha not allowing login on localhost

texts:
hi Not sure if this is specifically a Drupal question but I'll try it here first.

I am using Google recaptcha on my site, I set it up while the site was already online. but now I'm trying to make some changes I've backedup and downloaded my site to a localhost dev machine. now when I use this site I get:
"Google reCAPTCHA does not accept this submission. Try again please, or contact to Site support services."

its a bit frustrating and the only method I can think of is to remove this tool on the website, then dump the DB for my local version.

Anyone know another way around this, specifically to get it working properly?


texts:
I am working to install Aegir on an AWS EC2 instance (Amazon AMI) using an RDS mysql database. So basically a virtual box with a remote DB server.
I am using the manual procedure and am running into problems at the hostmaster-install phase.
The remote mysql server is correctly identified and the logon is accepted but the install fails.
Here is the command I am running:

drush hostmaster-install --aegir_db_user="root" --aegir_db_host="the_FQDN_of_the_remote_DB_server"

Install starts great but the starts giving warnings and errors which obviously have to do with problems running MySQL commands. Here is a small excerpt:

MySQL server has gone away                                                                                [warning]
query: SELECT filename FROM system WHERE name = 'jquery_ui' AND type = 'module' database.mysqli.inc:134

MySQL server has gone away                                                                                [warning]
query: CREATE TABLE variable (
name VARCHAR(128) NOT NULL DEFAULT '',
value LONGTEXT NOT NULL,
PRIMARY KEY (name)
) /*!40100 DEFAULT CHARACTER SET utf8 */ database.mysqli.inc:134

I noticed that the database was not created, so any table attempts will also fail.
The question is why is the database not created? I am not getting any clear output indicating this. I ran the command with the --debug option, but did not get any additional information to point out why it is failing.

Amazon Web Services (AWS) RDS service does put some limitations on the "root" user. For instance it does not have the "SUPER" privilege and also does not have the "CREATE TABLE SPACE" privilege. Could these be a reason fro the failure?

Where can I see what exact SQL commands are being run? I would like to try and run them manually to debug this issue.

Of course if anyone out there has successfully installed directly on to AWS with RDS as a remote DB, I'd love to know how.

Thanks, Eric


texts:
I'm wondering how I can change the layout of the node add form in Drupal 8. in Drupal 7 I worked with Panopoly and could overwrite the url in Page Manager and add a Panels Variant. I thought it would work the same way in Drupal 8 but in the Panels variant I cannot add the form items. Thus I get a blank page on activating the variant.

Any ideas?


texts: I am going to add a custom string by t() function in node.tpl.php. However, where should I add the translated string for the original string?


texts: Node edit form in overlay for selected content types

texts: I am using Drupal's core Overlay module along with Overlay Paths to display certain forms in overlay pop up. I have three content types and for one content type I want the node edit form to appear in overlay. If I override path by calling hook_overlay_paths_alter() then it adds overlay to all edit pages. How to I get overlay on only edit form of one node type?


texts: can you put views field values into a global token?

texts:
Suppose I want to use a paragraph field value of an entity for metatag title (by using metatag views module)

I can successfully get the value of the paragraph entity and display it on the view

Now, is there a way i can save those field to a token so i can use it here?

Regards,


texts: How do you give the content of a node a margin/padding without using html within the node?

texts:
How would you go about giving an entire node (the content) a margin or padding to the edge of the node - without using html within the node - in drupal?

Is there a module for this?
If not - how do you do so using CSS?


texts:
I have a page with multiple elements and pager. They are both created in the same function. Next to this i have a search box, and after clicking "search", ajax callback calls this same function and creates elements with pager depending on search term. This is working fine.

The problem is that once i search something, the first page shows results regarding the search but next pages don't. Like the pager didn't update which next items should show?!

my code is similar to this:

function mymodule_page() {
// this will be filled with an array of our content
$build = array();

// basic select query
$select = db_select('node', 'n')
  ->fields('n', array('nid'))
  ->extend('PagerDefault') // this adds the pager
  ->limit(10)

// execute the query
$nids = $select->execute()->fetchCol();

// do something to output your results here.
foreach ($nids as $nid) {
$content .= $nid;
}
// add the content
$build['content'] = array('#markup' => $content)

// Add the pager
$build['pager'] = array(
  '#theme' => 'pager',
  '#weight' => 5,
);

// return the renderable array
return $build;
}


texts: Customised user registration / sign-up forms in Drupal 7

texts:
I want to have 2 customised registration/sign-up form for different users with different fields for their account and profile (like buyer and supplier). How to make different form or multi step form for each kind of user based on role.

How can it be accomplish? Please help in this regard. As after lot of search, i could not figure it out. Is there better approach which is being used then please let me know.


texts: how to display a list of OG content depending on user group membership?

texts:
I've set up an OG Group type, and and OG Content type where I want to store some kind of articles.
I've provided fields where the author of an article can specify if an article can be:
1.  read by anyone, even unauthenticated users.
2.  read by all authenticated users, wheter or not they belong to a group to which the article is linked
3.  read only by users that belong to a group to which the article is linked.

I understand this has something to do with filters and relationships, but I can't get it to work....

Please help.... :-)


texts:
Is there a way where I can use the theme's default regions for displaying panels instead of a layout ?

or Without using page manager, Can I display panes in the sidebar ?


texts: Add captcha to last step of multi-step form

texts: I have a multi_step form which contains four steps. I want to add captcha to last step of the form.


texts: How can I trace a HTTP 500 (Internal Server Error) at `admin/reports/status`?

texts:
I get a HTTP 500 (Internal Server Error) at admin/reports/status

I see no errors at admin/reports/dblog

How can I trace this?


texts: How can I show field from profile2 instead of username depends on user's role?

texts: I have 2 profile2 types (and two common user roles) - "employer" and "applicant". I have "field_company_name" in "profile_employer" and "field_real_name" in "profile_applicant". I want to show field_company_name instead of username for employers and field_real_name for applicants (and "Editor" string for admins). How can I do that?


texts: How can I create a Install New Module-style "add button"?

texts:
In the Modules page, there is a button that looks like this:

Is this easy to reproduce? If so, how is it done?


texts: Changing the default "View" page when user logs in?

texts:
In Drupal 6 when a user logs in, they are presented with a completely useless page that has no information other than how long the user account has existed.

How do you edit this? Can you embed a view or something there? How would I make a Homebox the default tab? (I've tried using Tab Tamer to hide and disable the tab, but no effect -- still has the lousy "History" info.).

Thanks!


texts: Translation server suggests translation with old date

texts:
in admin/config/regional/translate/settings page, i had Check for updates set to never and translation server to Drupal translation server and local files.

i recently updated my site drupal version to 8.6.17.

after check for translation update manually i get a update available for drupal core translation with 2018 date for one of languages and i can't find .po file with this creation date.

my questions are:

how drupal check for available translations?
is it possible that it    suggests translation for a older drupal version?
and most important    is it safe to delete .po files from translation folder on my site manually and run check again?


texts: Save and Retrieve Admin Settings from the database

texts:
I created a config form in the admin/config page. (Just a link field that needs to be saved for later retrieval) Im confused as to how to save and retrieve the form data.

When creating a custom form in a block I have been successful using:

variable_get('link_title', '')

However when creating a custom form it seems to require a different way. I attempted to save the data in hook_form_submit. However Im not sure how to retrieve when you return to the form at a later date.

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

    function read_more_news_form_submit($form_id, $form_values) {
      drupal_write_record('readmorelink', $form_state['values']);
    }


texts:
I have a system which allows tagging users to a node. I would like to restrict the access to the comments so that the tagged user can see only the the future comments. So he cannot see the comments added to that node before he is tagged.

Is there some hooks like hook_node_access_records for comments entity.


texts: How can I set the language of nodes in bulk to existing content when making a site multilingual?

texts: I'm making an existing site with a few thousand nodes multiligual. Source is English. How can I set all of the existing content to langauge:English instead of neutral all in one bulk command?


texts: Check field on referenced entity to hide page title

texts:
I am using Fieldable Panel Panes for editors to be able to create panes that include an image, title description and link plus the ability to attach this pane to any content node through an entity reference. This gets nicely formatted in a template to format as a feature image on top of the page.

Problem: in some cases the feature image with title and description should replace the general page title, in others it should not.

I am considering to add a field to the pane that reads "Hide page title". If the editor ticks that field, I want to hide it in my page template like so:

<?php if ($show_title && $title): ?>
<?php print $title; ?>
<?php endif; ?>

I am trying to check the field value in preprocess_node like this:

function clf_preprocess_node(&$variables) {
  if ($variables['type']=='panel') {
$show_title=field_get_items('node',$variables['node'],'field_featur_remove_page_title');
  }
}

My problem is that this returns nothing as the field is not attached to the actual node, but a fieldable panel pane with an entity reference to the node.

What is the correct call to get the value of the field from the pane?

Thanks, J.


texts: Close a content type form in a modal popup and avoid redirection to the created node page

texts:
I have a content type reference on a user page. On clicking the add content button it opens as modal popup with the node form. Post filling the form on submission the page redirects and goes to the node created page.
Using this to open the form in pop up

Add New Article

How can i avoid the following - On form submission the pop up should close and the page should not redirect and the data should be added to article content type. Need to have Ajax form submit.


texts: Best place to add to Drupal.settings from a theme

texts:
I am working on a theme for a client, and have run into an instance where I would like to add to Drupal.settings via drupal_add_js() from the theme.

In this particular case, it is really most appropriate to do it from the theme itself and not a module hook, as the setting is related to the theme itself.

Doing it from template_preprocess(), or one of its relatives, is too late because $vars["scripts"] has already been built.  I suppose I could do something like the following code, but this doesn't seem right.

$settings = array(
  "bar" => "bar",
);

drupal_add_js(array("foo" => $settings), "setting");

$vars["scripts"] = drupal_get_js();

Is doing it from hook_theme() really the only option, or is the above approach kosher?


texts: Hook_enable vs hook_install [granting permissions to user role]

texts:
I'm trying to grant a permission to a user role using hook_install and it doesn't work(drupal 7.54). But it works with hook_enable. Do you know how to make it work with hook_install as well?

function porta_batch_editor_install() {
  $permissions = array('access porta batch editor');
  //grant 'access porta batch editor' permission to pb role
  foreach(array('pb role') as $role_name) {
    $role = user_role_load_by_name($role_name);
    user_role_grant_permissions($role->rid, $permissions);
  }
}

It works with the following approach:

function porta_batch_editor_enable() {
  $permissions = array('access porta batch editor');
  //grant 'access porta batch editor' permission to pb role
  foreach(array('pb role') as $role_name) {
    $role = user_role_load_by_name($role_name);
    user_role_grant_permissions($role->rid, $permissions);
  }
}


texts: Create new taxonomy terms on the fly and assign an icon for each one

texts:
This is in extend of this question: Create taxonomy terms on the fly

I would like to assign icons for news categories:

The editor should be able to create a news article, assign one or more new categories to it (taxonomy terms in News-tags vocabulary) and be able to upload an icon for each one of them.

The first part has been answered in Mechaflash's question, but I'm having a hard time implementing the icon requirement.

I've already created an Image field for the vocabulary items. I can create terms and assign images/icons to them. The problem is I can't find a way to display it on the new content creation form, so the editor can add them on the fly.

Is this possible somehow?


texts: How to display a node edit form in custom URL

texts:
I have a node created (using Default content) as part of the site install and it is available to edit at node/[nid]/edit. However, this node holds some of the site-specific content (for example, content to display on sitewide banner) and should be available under the site configuration section instead of node/[nid]/edit so that I can restrict the edit access with specific permission.
Why not the configuration/settings form? Because the node type has rich fields like image upload, entity reference, etc, and would be nice to use the node/entity's field API and display modes.
Is there a way to get the edit page of just this node at /admin/config/system/banner-settings?


texts: I cannot specify sender's address when sending email through rules

texts:
Drupal ignores the "senders email" parameter when I send emails via rules.
I cannot even specify the "sender's email field" directly, putting directly the address like "sender@drupalsite.com" - the mail gets always sent from the default website address. (My goal is to get the email from a taxonomy term proper to a commerce billing - which I can access properly).
I tried both regular and HTML mail.
What can be the source of the problem?


texts:
Was in my Drupal 6 site editing some pages and CKEditer suddenly disappeared in the Edit screens.

I did nothing to anything else & have no idea why the CKeditor fields are no longer showing up when I edit content?


texts: Organic Groups (OG) membership vs. og_user_node on a user profile

texts:
I am figuring out Organic Groups. I can't figure out the difference between a user becoming a group member vs the 'og_user_node' field that was added to user profiles. Could anyone help explain?

My Case:
I created a content type "Organization" that is a group.
I created a rule, when a user registers for the site a new "Organization" is created. This action also makes this user a member of that group and the group admin.
When I review that user's profile the og_user_node field is not set.

I could set it with another rule. Should it be set? What is its purpose? Am I doing this wrong?

Thanks


texts:
I have nodes from a content type that are put in a paged view (show 1/page)
You can see it here:
http://stage.e-clear.eu/en/chemicali%C3%ABn
http://stage.e-clear.eu/en/Energie
As you see this are multiple views for multiple pages (in example chemicals and energy)

I want a view that creates multiple pages like a published filter but invisible with nice url's like /energy.


texts: Service to interface with sessions table?

texts:
In my module, I need greater session control, beyond simple max_lifetime and other parameters taken from PHP config. What I did was to add a column to the sessions table that gives me the effective session expiration, which I can compare against to know if to revoke the session. (I also want to "cache" this in the local session, but this is unrelated to the question).

The question is, what is the best way to retrieve the new data from the sessions table? I can just send a direct DB query, such as:

Database::getConnection()->query('SELECT expires_at FROM {sessions} s WHERE s.uid = :uid', [':uid' => $uid]);

However, is there a built-in service for accessing this table, for greater abstraction?


texts: Daily cron job send email Webform submissions file

texts:
create an automatic excel extract of all requests and send it a specific email address every day.

How would I do this? Is there any existing Module to do this in Drupal 7?


texts: How to reference a custom field to content type entry

texts:
In Drupal 7 I've created a "Products" content type and a custom module that creates an entity "Orders" with a field "Products".

I want to reference my field "Products" with the products from the content type.
Any suggestions how to make it pro grammatically?


texts: How do I add edit/delete buttons to a custom module items list?

texts:
I have a custom form on my development site for visitors to create requests, with 3 fields: name, contact, and request.

This is the code in RequestForm.php.

public function getFormId() {
  return 'request_form';
}

This is the form builder.

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['name'] = [
    '#type' => 'textfield',
    '#title' => $this->t('имя'),
  ];
  $form['contact'] = [
    '#type' => 'textfield',
    '#title' => $this->t('контакт'),
  ];
  $form['reqtext'] = [
    '#type' => 'textarea',
    '#title' => $this->t('Текст заявки'),
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this->t('Отправить заявку'),
    '#button_type' => 'primary',
  ];
  return $form;
}

The validation handler isn't implemented; I just need to come up with the basics. The user data is stored in the database.

public function submitForm(array &$form, FormStateInterface
$form_state) {
  $name = $form_state->getValue('name');
  $contact = $form_state->getValue('contact');
  $reqtext = $form_state->getValue('reqtext');

  $connection = \Drupal::database();
  $result = $connection->insert('request')
    ->fields([
      'name' =>  $name,
      'contact' => $contact,
      'reqtext' =>  $reqtext ,
    ])
    ->execute();
}

The requests are saved in the database, and I need to view, edit, and delete them.
I created a route to list all of them, using the following code.

.routing.yml

request.list:
path: '/admin/request-list'
defaults:
    _controller: '\Drupal\request\Controller\RequestController::showdata'
    _title: 'Отобразить все заявки'
requirements:
    _role: 'administrator'

The route controller

class RequestController extends ControllerBase {
public function showdata() {
  $listall = \Drupal::database()->select('request', 'n');
  $listall->fields('n', array('requestid', 'name', 'contact',
'reqtext'));
  $result=$listall->execute()->fetchAll();

  // Create the row element.
  $rows = array();
  foreach ($result as $row => $content) {
    $rows[] = array(
      'data' => array($content->requestid, $content->name, $content-
>contact, $content->reqtext));
  }

  // Create the header.
  $header = array('requestid', 'name', 'contact', 'reqtext');

  $output = array(
    '#type' => 'table',
    #theme.
    '#header' => $header,
    '#rows' => $rows
  );
  return $output;
}

How and where  do I implement buttons to edit/delete a certain request?

I'm seeing something like a table:

Num Name    Contact        Request                     Options
1   Alex    +7898231231    I need a 10 litres of oil   Edit/Delete
2   John    +7231231231    I need a 50 litres of oil   Edit/Delete

I must be missing something, I guess. There is the "right" way to do this in Drupal 8.
Any help?


texts: Commerce - selecting attribute results in ajax error when product has many attributes

texts:
I've got a commerce store running well on a Windows IIS server. The only problem is on certain products which contain many attributes (e.g. around 10 or more) the ajax doesn't work when an attribute is selected. The js error in the console is vague as ever:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/ajax
StatusText: OK
ResponseText:

There is nothing untoward in watchdog or in error logs.

The fact that this happens on products with many attributes suggests some sort of PHP limit is being hit, but there are no errors to suggest this. Also worth noting that this is working fine on local/staging server so it's something server based that is the problem here.

Any ideas?


texts: How to map Feed Importer with my content type?

texts:
Here's my problem:

I'm using the "Feeds" module to import data from different RSS feeds. One of the feeds is:

http://www.happynews.com/rss/.aspx

As you can see, one of the elements is the "link" of each article.

How do I map that link with my content type? (note it's NOT the feed's link)

I've updated my content type "Feed item", adding a new text field to it called "Article link", attached it to the importer item and definitely can see the new field in the "target" options, however, it seems that in the "source" options there is no link field.

Is there a way to add "source" options to map them up with our targets?

Big thanks in advance for any help! I really appreciate it.

So far I found this article that might help to my problem above:

http://www.zivtech.com/blog/feed-feeds-importing-referenced-rss-data#comment-1378


texts:
In my gallery, what i write as image title is the caption of my image and that is great.
Now I would like to add a link (external url) to my caption, how can i do that?
I already try to write normal url and html a tag but is always ignored.

I see two option in Colorbox configuration related some link, i play a bit with that but I didn't really understand what i'm supposed to do with that

How did you do?

EDIT: Add screenshots step by step adding link for title

My Colorbox gallery is placed in custom 'Photo Gallery' Content type. Here there are a list of images with Alt and Title.
This images are automatically grouped thanks another view "Gallery Photo" which display the first image and then thanks to colorbox open all the other inside it as a gallery.

http://loungesquatt.com/drupal734


texts: Where are valid password reset tokens stored?

texts: When one submits the form on user/password or executes drush uli, a password token is generated. Where does Drupal store these?


texts: How dio I change things on module installation?

texts:
I've been looking around for several days now, maybe i'm just not fully understanding how the new Drupal 8 framework works entirely.  What i'm trying to do is create a module that is a complete product that runs on the Drupal framework. I need to be able to completely customize the Drupal settings when the module installs.  Changing things like the "Home" link to be "Dashboard" or just remove/disable it entirely or updating the front page url to point to the page i'm going to be creating programatically. There are also a myriad of administrative settings that i would like to set as well like the site email, error pages, email templates, and configuration of other required modules.

If anyone has any examples of how this can be done or can point me to the right areas of documentation that has the answers i'm looking for (googling has not yielded the answers and i like to think i have pretty decent google foo).


texts: Why isn't my controller returning AccessResult::forbidden()?

texts:
I'm working on a node access module. I've set up my logic. I can't seem to get my code to return AccessResult::forbidden(). I can't even get \dpm to run in access method. What am I doing wrong? Below are my routing.yml and controller.

/* nodeaccess.routing.yml */
nodeaccess.people:
  path: '/user/{uid}/edit'
  defaults:
    _controller: '\Drupal\nodeaccess\Controller\NodeaccessController::content'
    _title: 'Dashboard'
  requirements:
    _custom_access: '\Drupal\nodeaccess\Controller\NodeaccessController::access'

/* src/Controller/NodeAccessController.php */

<?php

namespace Drupal\nodeaccess\Controller;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Session\AccountInterface;

/**
 * Defines the Dashboard controller.
 */
class NodeaccessController extends ControllerBase {

 /**
  * Returns content for this controller.
  */
 public function content() {
   $today = date("l");
   if ($today == "Thursday") {
     // Return 403 Access Denied page.
     \dpm("You are not allowed.");
   }
 }

 /**
  * Checks access for this controller.
  */
 public function access(AccountInterface $account) {
  $current_user = User::load(Drupal::currentUser()->id());
  $user = User::load(explode("/", $_SERVER["REQUEST_URI"])[1]);
  if ($current_user->field_department->target_id != $user->field_department->target_id) {
    return AccessResult::forbidden();
  }
  return AccessResult::allowed();
  }
}


texts:
Me and my friend share a pantheon site that we are pulling / pushing from together. However when I go to the Dev site and I noticed some changes (like a page being empty) and on my local, that same page being full of text.. When I do "Git Pull Origin Master", it tells me i'm already up-to-date.

Why doesn't it pull the changes down?


texts: Date format - @ symbol has unexpected behaviour

texts:
I created a date format , then added that date format to a field within a view. But the @ symbol is automatically appending to the end of the date format (even though i specified it to go into the middle of the date format, and is reflected correctly in the preview). I used PHP:date - Manual as my reference.

My date format: l, F j @ g:ia and it displays as: Wednesday, June 17 @ 4:32pm

Now when I select that date format for my date field within my view, it outputs the said date as: Wednesday, June 17 4:32pm @.

I'm confused because whenever I have put other characters before, it always outputted what I wanted. I've also tried using the html equivalent of &#64; but it outputs the @ symbol at the end of the format as well.

I'm just wondering if this is a views, php, or date issue? And is there anyway I can output this date as: Wednesday, June 17 @ 4:32pm from a date format?


texts: drush ne-import doesn't import field_tags

texts: I'm using module node_export to migrate contents from my local to live. The content type has several fields with field_tags (multi-field term reference) being one. The exported file was created just fine. I tried exporting in xml, json and serialize, format and was able to search/find field_tags on each of the exported file. But when I ran drush ne-import --file='exported_file' the nodes were created without field_tags. Every other fields were created fine. I didn't see this on the bug report of node_export project page.


texts: How to get a field value in form validate

texts:
i have a custom form validate function. what is the correct/reliable way to get the field value and why? below two lines get the same value from a Select List.

a) $form['field_a']['und']['#value']

b) $form_state['values']['field_a']['und'][0]['value']


texts: Is there any replacement module for token actions and token starter modules in D7?

texts:
I am using TokenActions and TokenStarter modules in my one of the project which is in D6.

Now, I have planned to upgrade it into D7.

I have found the D7 version of Tokens module but I didn't find Tokens Actions and Token Starter in that module.

Is that modules are removed are is it still existing in some other names?

I had googled a lot. But I didn't find anything really useful...

Coudl you guys help me out of this issue ?


texts:
Mails must be sent to certain roles from certain domains.
Is it possible to setup SMTP server per role? (through rules or by coding)


texts: Do multi-level multi-value relationships work in a view?

texts:
In Drupal 8, I have a content type Story, with a multi-value entity reference to content type Project, which, in turn, has a multi-value reference to Team-Member, which has a single-value reference to Person. In my story node, I want to show a list of projects, and within each, a list of team members.

I have an embedded view (content type Story), to which I'm passing the nid as a contextual filter, with 3 relationships defined: referenced Projects, referenced Team-Members, and referenced Persons. I've added fields from all 3 types, each using the correct relationship, I'm pretty sure.

I'm getting Project fields correctly, each Project in a row. But I'm not getting anything for Team-Members or Persons.

Am I asking this view to do something views can't do, by having multi-value references 2 levels deep? Is there a better approach? Am I missing something?


texts: What function or $user variable do I edit to manually increase a user's session timeout?

texts:
I'm using the simpleSAMLphp module which redirects the user offsite to login and then hits them back to drupal in a logged in state, but for some reason the sessions aren't getting applied. When the user closes the browser it causes the user to be logged out.

But when I login via the drupal login page, the user session persists even if the browser is closed.

What function should I look for in the simpleSAMLphp module where it logs the user in?
What might I need to know or edit to make a assign a session time to a user?
Is the session information stored in the $user variable and can I manipulate it from there? or is it a database edit?


texts: Search results only for the current language

texts:
I have a site with 4 languages and am using the builtin search to look for content on the site. How is it possible to restrict the search results only to the currently selected language?

I tried looking into Configuration > Search Pages, but do not see any way how to do that there.


texts:
I have a serialized object in a field. I now need to output a float-value. Since the site has 2 languages (german/english) I now need to format the float-number based on the current language.

$value = 123456789.01;
// Language = english
print the_format_function($value); # => 123456789.01

// Lanuage = german
print the_format_function($value); # => 123.345.789,01

I'm lookin for the_format_funtion();.


texts: How to restrict node access to nodes based on field value?

texts: Im making simple private message system (no need privatemsg), just node with title, body, and user reference field (entity_reference) for recipient(s). How can I restrict access to node only for node author, and users listed in field?


texts: Using Commerce, how do I create a filterable view of "Who Bought What"?

texts: I need to create a list of users that have made purchases on my site. I need to be able to filter this list by product and show which users bought it. It is similar to how the Who Bought What module in Ubercart does it (but now I need it for commerce). Any thoughts are appreciated.


texts: Which external frameworks does Drupal use, if any?

texts:
I'm looking for ways to prepare and ease a transition to Drupal.

My department is planning on completely rebuilding our custom CMS in Drupal. There are 4 members on the team, two programmers. I've been researching ways to ease the learning process, as only our manager is familiar with it and he's not a developer.

My question is this: Is it possible to integrate any of the specific technologies or practices that Drupal uses in generic PHP-based websites? For instance, Drupal 8 will use Twig.

Are there other technologies or plugin components that we can learn and use before we start the process of moving to Drupal?


texts: Allow editing of own content but not show 'node settings' block

texts:
Hello all and happy new year! ..

I have a question that I thought would have been answered before, but could not find anything..

I want users of a certain role to be able to edit their own content (nodes of a specific content type).  This all works well.  However, they can also see the 'Node Settings' option, which is a block on the right hand side with settings such as: 'CSS class(es), layout box' etc.  (see picture below)

I don't want the above settings to be available to the particular role, although that role would have the right to edit the node - in other words, I want them to be able to alter content, but not be able to mess around with css classes, layout boxes and anything like that ...

Ideally, I would like that whole 'Node Settings' block to be available only to administrators, and not to users of any role - even if they do have permissions to edit the content of that particular node.

I looked carefully into permissions and searched the web, but could not find anything ... My feeling is that this should be done as it must be quite a frequent case ..

Any help would be greatly appreciated.


texts:
We are migrating our old site from plain PHP to Drupal 8. Passwords are hashed with MD5 in the old site; I need to migrate them in Drupal.

I tried the following code, but it takes the password as plain text and calculates its SHA hash.

public function prepareRow(Row $row) {
    $password = $row->getSourceProperty('user_password');
    $hash = \Drupal::service('password')->hash($password);
    $row->setSourceProperty('user_password', $hash);
  }

This is the configuration file.

id: users
label: User migration
migration_group: mymodule_general_migration_groups
source:
  plugin: mymodule_migration_users
process:
  pass: user_password
  mail: user_email
  init: user_email
  status:
    plugin: default_value
    default_value: 1
  name:
    plugin: dedupe_entity
    source: username
    entity_type: user
    field: name
    postfix: _
  created:
    plugin: callback
    source: created
    callable: strtotime
  changed: user_regdate
  access: user_regdate
  login: user_lastvisit
destination:
  plugin: entity:user
  md5_password: true
migration_dependencies: {}
dependencies:
  enforced:
    module:
      - mymodule_migration


texts: How to copy forum structure Advanced Forum?

texts:
I wish to use the Forum or Advanced forum module to create forums. But to save time I need to duplicate forum structure to create new ones. I've done Google search but did not find any useful information.

For example for a schools website, I can create another school just by copying a school structure that'll copy all child forums as classes which I'll not need to recreate.

Can anybody help me with this?


texts:
I created a content type in Drupal 7 "test" with the following fields:

Title;
Body;
Image;
Tag (taxonomy tagging)

I would like to customize the node creation page, by inserting the tag field function jQuery

<input type="text" name="tags" placeholder="Insert Tag" class="tm-input tm-input-warning tm-input-small"/>
<script>
jQuery(".tm-input").tagsManager();
</script>

The file name is page--node--add--test.tpl.php.

Where do I insert the jQuery code?


texts:
Everytime I try to edit content on one of my panels I get the following error message.

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /panels/ajax/editor/edit-pane/panel_context%3Apage-   sign_up_page%3A%3Apage_sign_up_page_panel_context%3A%3A%3A%3A/417
StatusText: Internal Server Error
ResponseText:

I am using Panels 7.x-3.5.  Anyone have any idea how to go about fixing this?


texts: How to render a form in custom template?

texts:
I'm looking to add a form inside a custom template. The form, if I open the path registered inside the file cmodule.routing.yml, works but if i try to use it inside a custom template it doesn't work: with a dump(form) or dump(form.anyfield) i get NULL.

cmodule.routing.yml:

cmodule.manageform:
  path: '/cmodule/manageform'
  defaults:
    _title: 'Documents'
    _form: '\Drupal\cmodule\Forms\RequestForm'
  requirements:
    _permission: 'access content'
cmodule.manage:
  path: '/cmodule/manage'
  defaults:
    _controller: '\Drupal\cmodule\Controller\CmoduleController::manageAction'
    _title: 'Custom Documents'
  requirements:
    _permission: 'access content'

RequestForm.php:

/**
 * {@inheritdoc}
 *
 */
public function buildForm(array $form, FormStateInterface $form_state) {

    $form['type'] = array(
        '#type' => 'radios',
        '#options' => array(
            '0' =>t('DOC'),
            '1' =>t('PDF')
        ),
    );
    $form['pid'] = array(
        '#type' => 'textfield',
        '#title' => t('ID:'),
        '#required' => FALSE
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => $this->t('Submit'),
        '#attributes'=> ['class'=>['glyphicon', 'glyphicon-search']],
    );

    return $form;
}

cmodule.module:

/**
 * Implements hook_theme().
 */
function cmodule_theme(){

    $templates = array(
        'manage_cmodule_page' => array(
            'variables' =>
                [
                    'id' => NULL,
                    'form' => NULL
                ],
            'template' =>'manage_cmodule',
            'render element' => 'form'
        )
    );

    return $templates;
}

the controller contains:

public function manageAction() {

        $id = 1;

        $form = \Drupal::formBuilder()->getForm('Drupal\cmodule\Forms\RequestForm');

        $form['type']['#title_display'] = 'invisible';

        return [ '#theme' => 'manage_cmodule_page',
            '#form' => $form,
            '#id' => $id,
        ];
    }

and then the template/view (contains):

<div>
 {{ form.form_token }}
{{ form.form_build_id }}
{{ form.form_id }}
{{form.type}}
{{form.submit}}
</div>
etc..

But as I said above the template doesn't show the form, but show (if i print it) the #id value passed through the controller.
Do you have any suggestions?!

UPDATE #1
I tried also to follow the suggestion of Beebee, and then this and this so the code is:

controller:

controller contains:

public function manageAction() {

        $form = \Drupal::formBuilder()->getForm('Drupal\cmodule\Forms\RequestForm');

        $render['#form'] = $form;
        $render['theme'] = 'manage_cmodule_page';
        return $render;;
    }

and the implementation of hook_theme in .module file is:

return [
    'manage_cmodule_page' => [
        'template' =>'manage_cmodule',
        'render element' => 'form',
    ]
];

The result is an empty page with an error inside the apache log:

  [php7:error] [pid 12660:tid 1592] [client ::1:59521] PHP Fatal error:
  Out of memory (allocated 270532608) (tried to allocate 266354688
  bytes) in
  C:\drupal\vendor\twig\twig\lib\Twig\Extension\Debug.php on
  line 60, referer: http://localhost/drupal/

if I remove the following row from the controller

$render['theme'] = 'manage_atps_page';

the page loads, but it is empty (without any form).

UPDATE #2

I fixed my issue following also the idea of Alex Kuzava. Thus I used the code of UPDATE 1, with the new directory of the form, and then I added these 3 lines inside the  part of my template (otherwise the submit button doesn't work).

{{ form.form.form_build_id }}
{{ form.form.form_id }}
{{ form.form.form_token }}


texts: How can I scrape data from the web into drupal?

texts:
I want to scrap location data from google. So for example; If I search for "Restaurants in Miami". I get over 14K results. I reviewed; How to import Nodes and Node Location data using Feeds module?. But that doesn't really help me with importing a query term from google.

How would I be able to scrap each one of the locations that the
query gives as a result and import them as a node into drupal?
Are there any pre-built modules that might assist in this process?
I'm I going to need to build a custom module for this use case?

UPDATE: I've found this page; http://drupal.org/project/example_web_scraper and will studying the info to see if this is what I'm looking for.

AH HA MOMENT:

http://drupal.org/project/geolocation
http://drupal.org/project/location_feeds
http://drupal.org/project/geolocation_proximity


texts: Drush command to show site information configuration

texts:
I would like to display all available information about a site using its alias name.

the closer thing I could find is drush status.

$ drush @loc.my-project-7-26-2-5-dev status

  PHP executable        :  xxxxxxxx
  PHP configuration     :  xxxxxxxx
  PHP OS                :  xxxxxxxx
  Drush version         :  xxxxxxxx
  Drush configuration   :  xxxxxxxx
  Drush alias files     :  xxxxxxxx

I would like the site information, such as Drupal version, profile name, default theme, temporary directory path etc.. to be displayed instead.


texts:
I want to add some specific treatment after creating the content.

Rules module is for similar cases but I look for a hook.

Is there a hook that triggers just after creating content (node)?

Thank you


texts: How to save session data in prod server?

texts:
I want to save my data in a session: under drupal 8.6

I worked with "Private tempstore" it works locally but not in the server prod only if user is anonymous.

if ($this->currentUser->isAnonymous()) {
  session_start();
}

The same for the native php session.

I ask if it can be stored with php configuration or how?

thank you


texts: How do I filter Search API results based on imformation stored on a related entity?

texts:
I'm working on adding Search Api to my sites. I need to be able to filter content in the search based on data not stored on the nose however. The content Types in Question are Story Pages, which hold the relevant data, and Chapter pages which reference the Stories.

In a normal view I would use a relationship and just do it that way, but the Search View isn't allowing me to set a relationship on filters.

How do I get there from here?


texts: How can I pass a fixed argument to a view within a panel?

texts:
I have a view that will be repeated on many pages, and to not replicate many times, has two arguments. These arguments do not come from URL, are fixed. This view is inserted into a panel.
Is it possible? How?
Thanks!


texts: Bootstrap blocks - getting positioning and padding right

texts:
I am using the bootstrap theme. I am generating pages that contain blocks from views. Getting the layout right is driving me insane.

For example, on one page I have one block generated from a view that should contain two bootstrap columns, followed by another block generated by a different view containing a single bootstrap column. So a row of three columns.

Bootstrap adds a clearfix to blocks so that immediately causes me issues - I remove it from the LHS block with Javascript, an inelegant hack. But then the padding is wrong if I don't wrap both blocks in a bootstrap row div. So I've been applying other classes to the blocks themselves to try to get around this.

I am aware I can make templates for pages, but using something like bootstrap is supposed to make layout easier, not cause headaches. Currently I would probably be better off just abandoning using Bootstrap and coding the layouts by hand.

What I am doing all feels very inelegant and hacky. Am I doing something wrong?


texts: How do I better play nice with weights, when overriding a form?

texts:
I'm attempting to use the Constant Contact module.
One of the features of this module is that it inserts a check-box into the user registration form. The problem is that it seems to set weights in a way that it interferers with my own  implementation of hook_form_alter(), on the registration form. The field order is a mess now: the field for the confirmation of the email address is now the first one.

The Constant Contact module is specifying a weight for the checkbox:

'#weight' => 11,

My implementation of hook_form_alter(), just left my new form element weights blank. I could just massage my functions form weights such that it didn't have the fields out of order, but then I risk to do it again the next time I need to add something to the form or use another module that does likewise.

Is there a 'best practice' way to handle form weights assuming multiple override sources?


texts:
I am using the drupal's built in search module, for this I have copied the search-results.tpl.php in my theme folder. Now I have to add images for search results too and also want to custom theme the template file. For images I have used the following approach:
In my template.php:

function MyTheme_preprocess_search_result(&$variables)
{
if ($result['node']->type == "content_type") {
 $node = node_load($result['node']->nid);
 $prod_image = field_view_field('node', $node, 'machine_name_img', $display = array());
 $variables['image'] = $prod_image;
}
}

and then in search-result.tpl.php:

<?php if($prod_image):?>
    <?php print render($prod_image);?>
<?php endif; ?>

but its not working, can anybody knows how do I get the images related to search results, and how can I theme search results?


texts: Drush sql-dump but exclude multiple tables with a pattern

texts:
I have a gigantic database due to having over 1000+ individual tables created for every time someone logged in. (wasnt me that made this).

I want to now create a dump of the database using drush sql-dump but the file ends up to be over 15GB and 1GB zipped.

Is there a quick and easy way to exclude a bunch of tables matching a pattern using drush? The tables I want to exclude all begin with the word "result-<username>"


texts: the javascript for dragging and dropping not loading - drupal 7

texts:
for some reason when I add new modules the tabledrag.js is not loading.  Tried taking the modules out, clearing cache several times.  Aggregated js as well.
Can anyone help.


texts: How can I get the content type of a node given its node ID?

texts:
I have a URL like track-new/15/51. arg(2) returns 51.

How can I check if the content type of the node whose ID is 51 (the value returned from arg(2)) is 'artist'?


texts: Media module and views. Cannot make video image linked to node

texts:
Using drupal 7.20,
Media 7.x-2.0-unstable7,
Media Youtube 7.x-2.0-rc2,
File Entity 7.x-2.0-unstable7,
Entity View Modes latest version.

Created new content type called "video", added video field type "Multimedia asset", Allowed remote media types "Video", Allowed URI schemes "youtube:// (YouTube videos)", "public:// (Public files)"

With Views 3 i am displaying Content: Video, File view mode "video_preset" (preset i created with Entity View modes module). But it only displaying an image, is there any working way to make that image a link?

Already tried "rewriting output of this field" thing, that not working at all.


texts:
One of many things I want to do in Drupal is to have

Hi: "User name"

link for /users page. (In the future I also want to have a control over visibility of menu tabs and their links depending on the logged user.)

Currently I have a quick, easy and relaxing solution - hacked page.tpl.php which works perfectly. Unfortunately I it is not a perfect (nor profesional) solution because the website will brake down as soon as I update the drupal core.

Is there any way of injecting php code into menu link/title without messing up the core?

I've been thinking about using translation module, menu module, and others but so far I have not been successful. I know that menus in drupal are designed to be static, but there must be a walk-around.

I know that menu_token can solve some of my problems but it does not work for me (when installed I have memory allocation issues in php server or crashing MYSQL).


texts: How to do multiple conditions for db_update by using OR condition?

texts:
I would like to convert the following UpdateQuery statement to work with multiple conditions by using OR instead of the default AND condition.
db_update('system')
  ->fields(array('status' => 1))
  ->condition('type', 'theme')
  ->condition('name', 'seven') // OR
  ->condition('name', 'rubik')
  ->execute();

Is it possible?


texts: Page cache not rebuilding after page cache maximum age is reached

texts:
I have a pretty minimal Drupal 8 install with some views blocks that show upcoming event node links. I've noticed that once an event is passed they still show up and it is because the pages of my site are cached. However, I set the "Page cache maximum age" on the performance page to 6 hours and Drupal continually caches pages for days or weeks. I have to manually click clear all caches before the site will update. Cron is also setup and running regularly without a problem. I thought maybe that triggered the cache rebuild but I've set it to 6 hours, 12 hours, 3 hours, etc. with no result.

I'm not sure why this is happening. I'm not doing anything else to cache, no other modules or server programs like Varnish or anything.


texts: Drupal 7 - Exposed form block also inside results

texts:
In Drupal 7 I created a view with an exposed form in a block.
The view has a "page" display.

Users can make their searches using the exposed form in the pages where I placed the block.

I would like to put the filter also in the results page, but it is placed always after the results, while I would like to have that between the page title and the results.

Example:

what happens

PAGE TITLE

VIEWS RESULTS

EXPOSED FORM

what I would like to do

PAGE TITLE

EXPOSED FORM

VIEWS RESULTS

Any idea?
thank you in advance

As I write below, I found the solution:

I had to:

1) Create the view
2) Expose the form
3) Add a "Global PHP" in the view header with the following code:

$block = block_load('views', '-exp-myview-page');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
print $output;

Surely it can be done also using template instead of the php in the header.


texts: Within Panels, get node ids that contain taxonomy term

texts:
I have a panel with a content pane that shows a node based on the Taxonomy Term Name in the URL of the panel.
This is working using  "(Content) Content: Has taxonomy term ID" as a contextual filter, and "From panel argument" within the content pane.

I am also wanting to add the add comments form to the panel. Which could be done using the nid of the node displayed in the above mentioned panel.

So, from within panels, how can I get the nid of a node that has the taxonomy term as a field, where the taxonomy term is within the URL?

Can taxonomy_select_nodes($array_with_tids); be used within panels?

Using Drupal 7, Panels 7.x-3.3

Thanks


texts: How to add custom checkout pane to drupal-commerce in drupal 8

texts:
I installed drupal-commerce on drupal 8, straightforward and easy using composer.
Now I need to collect some extra information from customer at checkout, and I understood, I need to install a custom checkout pane.

Unfortunately there is no module for that, so I guess, I have to write a custom module. I know how to generate it with drupal-console, but than I'm lost...

It should be possible to copy some of the code from commerce checkout module, but I have no idea where to start. Can someone help me with that? Thanks!


texts: Date Module / Date Repeat: Hourly or Minutely Recurrence?

texts:
I'm setting up a Drupal 7 based calendaring system ,and the Date module has been super amazing; it does pretty much everything I need out of the box. However, correct me if I'm wrong, but it doesn't look like there's a way to set an event to reoccur, say, once every hour.

Do you have any idea for the best way to accomplish this?
I know PHP fairly well, so I'm game for writing code, but I have no idea where to start. Do I need to create a custom module that implements the Date Repeat API? What form would take, and how would it integrate with the existing Date module? Is this an unreasonably huge undertaking for a Drupal newbie?


texts:
I was wondering if using hook_module_implements_alter() is a good practice in D8 also to alter the order of execution of hooks?

I came to hear that it is suggested to do this with events that was introduced in D8 which will be a better way, but I could not find any reference that says not to use hook_module_implements_alter() in D8. One such ref.

If using events is advised, can someone put up a small example as to how to do that?

Thanks


texts: PluginNotFoundException: The "MenuSettings" plugin does not exist

texts:
I'm getting the following error when saving nodes on a site that I just moved from one server to another:

Got error 'PHP message: Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException: "The "MenuSettings" plugin does not exist. Valid plugin IDs for Drupal\\Core\\Validation\\ConstraintManager are: Callback, Blank, NotBlank, Email, CommentName, DateTimeFormat, FileUriUnique, FileValidation, jsonapi_extras__duplicate_field, LinkAccess, LinkExternalProtocols, LinkNotExistingInternal, LinkType, PathAlias, TaxonomyHierarchy, ProtectedUserField, UserMailRequired, UserMailUnique, UserName, UserNameUnique, MenuTreeHierarchy, Bundle, EntityChanged, EntityHasField, EntityType, EntityUntranslatableFields, ReferenceAccess, ValidReference, UniquePathAlias, ValidPath, AllowedValues, ComplexData, Null, Count, Length, NotNull, PrimitiveType, Range, Regex, UniqueField, Uuid" at /data/sites/web/whatevs/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php line 53\n'

I haven't had this problem on the old server. I cleared the cache on the new server, and specifically the cache_discovery table. The problem disappears if I comment out the following line in /core/modules/menu_ui/menu_ui.module :

if (isset($entity_types['node'])) {
  $entity_types['node']->addConstraint('MenuSettings', []); // comment out this line
}

But I'm not too happy patching core just to get something working that ought to work and has worked. Does anyone understand where this comes from?

This is a Drupal 8 site where I imported an old Drupal 7 site's content; I don't know if this is relevant.


texts: How do I programmatically get the URL of an entity referenced media image field using on a custom_preprocess_html() hook on THEME.theme?

texts:
Reason: I need to create an Open graph meta tag og:image and pass the URL as content.

On THEME_preprocess_html(), I loaded the node using

$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
      $nid = $node->id();
      if($node->hasField('field_image')){
        $image_id = $node->field_image->target_id;
        $image = \Drupal::entityTypeManager()->getStorage('file')->load($image_id);
      }
}

I have loaded the node and I was able to get the field_image_entity_id as shown. I want to get the URL of the image field of entity referenced field.

The below code gives me NULL. How can I load the media entity and get this value?

$image = \Drupal::entityTypeManager()->getStorage('file')->load($entity_img_id);


texts:
When I create a new content, I would like to send an email that contains "node path alias".

Pathauto pattern

[title-raw]-[nid]

Rules

ON event After saving new content
IF
Created content is Les entreprises
AND
Created content is new
Add a condition
DO
Send a mail to a user

Rules email

[node:node-path]

I receive the email, but the content is 'node/16565'. I would like to receive 'les-entreprises-16565'.

If I inspect token with the Devel module, I get: node-path (String, 21 characters) les-entreprises-16565.

Why didn't I receive this node path alias? Is the Rules module sending the mail too quickly, and the path alias is not yet created?


texts: How to post xml data in drupal_http_request? I have curl code of it

texts:
This is following curl code

    $ch = curl_init(); //initiate the curl session
    curl_setopt($ch, CURLOPT_URL, $url); //set to url to post to
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // tell curl to return data in a variable
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlrequest); // post the xml
    curl_setopt($ch, CURLOPT_TIMEOUT, 10); // set timeout in seconds
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    $result['xml'] = curl_exec($ch);

How do I change the following code to use drupal_http_request()?


texts:
My project runs on Drupal 6, and I'm using Views.

I have a main menu with two submenus (menu -> sub1 -> sub2).

This image shows what it looks like on my "edit panel."

The box with an orange border is the second submenu, and the one with a black border contains the item content assigned to this second submenu.

All the items from all submenus assigned to first submenu (main menu -> sub1 -> sub2.1, sub2.2, sub2.3 ...) are showing up already in the first submenu. (Th first submenu is a drop-down in the main menu; I don't want to have all submenus in the main menu, but just the first one.)

I want to hide them from there and display only the item that belongs to ie. sub2.1 or sub2.3. When I click sub1, I see all items from all sub2; when I click sub2.1, I see the correct items assigned to this submenu.


texts:
I have a View block which renders a map through GMap formatter and includes two fields - Company Name and Address. When I export it through features and try to render it on another system, the map doesn't show up.
I've given custom height and width and some other configurations in GMap under Configurations > Web Services > GMap. I think the problem is that the configuration settings for GMap are not being exported with the feature. Is it possible? If so, how to export them?

Here's an image of the View


texts:
I have a True/False Quiz module question that I want to theme the output on...basically wrap the question with some extra stuff. I grabbed the truefalse-answering-form.tpl.php file from the module folder, copied it to my theme folder and made the needed changes, but my overriden theme file isn't being loaded.

I cleared the caches and still no luck.

Devel Themer isn't really providing me with useful info either...

Has anyone successfully themed a Quiz Module Question? Is there something extra that needs to be done?


texts: How to change Drupal module load sorting(weight) order

texts:
I need to understand how can we change module weight.

Do we really change that value for custom module.
What are the default values?
If we change weight value what will be effect on Drupal bootstrap process?


texts: Custom theme for form checkboxes causes AJAX behaviors to not attach

texts:
I have the following code implemented to override the theming for the checkboxes in a Drupal form.

    //themes neighborhood checkboxes with AJAX link wrapper
    function theme_mymodule_neigh_checkboxes($element){
        $output = '';
        foreach($element['element']['#options'] as $key => $val){
            $output .= theme('tfc_search_neigh_checkbox', $element['element'][$key], $key);
        }
        return $output;
    }

    function theme_mymodule_neigh_checkbox($element) {
        _form_set_class($element['element'], array('form-checkbox'));
        $checkbox = '
<input ';
        $checkbox .= 'type="checkbox" class="ajax-processed" ';
        $checkbox .= 'name="' . $element['element']['#name'] . '" ';
        $checkbox .= 'id="' . $element['element']['#id'] . '" ';
        $checkbox .= 'value="' . $element['element']['#return_value'] . '" ';

        $checkbox .= drupal_attributes($element['element']['#attributes']) . ' />';
        if (!is_null($element['element']['#title'])) {
            $checkbox .=  ''. $element['element']['#title'] . '';
        }
        $checkbox .= '
';
        unset($element['#title']);
        return $checkbox;
    }

The form elements look great, but now the AJAX callback associated with the checkboxes does not fire when a checkbox is clicked. THe "ajax-processed" class is not added to the checkbox inputs.

If I don't use the mymodule_checkbox() function, then AJAX works again. It seems like the AJAX behaviors are not being attached to the checkboxes anymore because I'm using a custom theme function.

Any advice?

AJAX looks like this:

    function mymodule_form_alter_buildings($form, &$form_state) {
        $output = '';

        $buildings = $form['more']['buildings']['#options'];
        unset($buildings['all']);
        $neigh_buildings = tfc_search_get_buildings($form_state['input']['neighborhoods']);

        foreach ($buildings as $nid => $building) {
            //disable the checkbox if it is not in the neighborhood and add asterisk
            $disabled = '';
            $disabled_msg = '';
            $asterisk = '';
            if (array_key_exists($nid, $neigh_buildings) == FALSE) {
                $disabled = 'disabled="disabled" ';
                $disabled_msg = t('* Building not available in selected neighborhood');
                $asterisk = '*';
            }
            $output .= '

                <input '.$disabled.'id="edit-buildings-'.$nid.'" class="form-checkbox" type="checkbox" value="'.$nid.'" name="buildings['.$nid.']">
                '.$building.$asterisk.'

';
        }

        return $output;
    }


texts: Allow users to add existing website photo content to their own user galleries

texts:
I'd like to have admin-driven photo galleries on my website, as well as galleries for each individual user. I'd like for my users to be able to upload images to their own galleries, but also for them to be able to select images from the admin-driven galleries and somehow pull them into / copy them to their own galleries.

Let's say I had three galleries on my site: car photos, insect photos, and fish photos. One of my users has been uploading a bunch of his/her own photos into their gallery, and they come across a really cool photo of a fish in the "Fish Photos" gallery I mentioned above. They want to add that fish photo to their own personal gallery. Yes, they could right-click>save-as and upload the photo to their gallery, but I would prefer a more automated "add this photo to my gallery" type of function.

Does anyone know of a module or some kind of other implementation that would provide this functionality?

Thanks!


texts: How to generate feature containing date types and date format?

texts: I have created new date types and date formats using Drupal 7 UI. But I can't generate feature for both of them (format and type). Only format is available in Strongarm but type isn't. Please tell me how to generate feature for both of them.


texts: What does the 'version' keyword mean in .libraries.yml?

texts:
In theme.libraries.yml, libraries have a version key. It appears to be optional, but Drupal core libraries (core.libraries.yml) set the version key value as version. What does this keyword mean?
so :

Why we use the version keyword ?
When should I change the version keyword?


texts: How do I alter webform values before submission?

texts: I am trying to add some values to a hidden field in my webform before submission. Is there any hooks to access webform submission in Drupal 8? I tried How do I modify a webform submission field right before it is saved? without luck.


texts:
I have tried to create custom tables for a module in Drupal via hook_install() and hook_schema() in module.install, and it works fine after disabling and enabling module using drush dre module_name. Is that the proper way to create tables in custom module ?

Can I use config/schema/module_name.schema.yml for creating tables? If not, what is the use of schema files in Drupal 8?


texts:
I am running a paginated query on a Drupal 7 site and the page seems to be working correctly (page 1 is the url with a # at the end, page 2 appends ?page=1, page 3 appends ?page=2, etc.).

However, the query itself seems to always load the results for page 1. Does anyone see something wrong with what I have below?

    $data = array();
    $query = db_select("my_table", "t")
        ->fields('t')
        ->extend('PagerDefault')
        ->limit(5);
    $result = $query->execute();
    $pager = theme('pager');
    foreach ($result as $row)
    {
        $data[] = $row;
    }

    return theme('my_template', compact('data', 'pager'));


texts:
I am working on Drupal website, and I heard about the MongoDB module. I installed and enabled it, but I don't understand how it works.

How can I switch all my data from MySQL to MongoDB?
Is it safe to purely depend on it? Can anyone tell me how to configure MongoDB with Drupal?


texts: Do I need to go to contrib to manage multiple files for a single node?

texts:
I have created a content type called 'audio'. I've added a field of type File which can take three values. So far so good. I've created a new audio node, given it a title and some body text and then uploaded two audio files. The same file but one is mp3 the other is ogg.

Now, I was expecting Drupal to keep track of which files belong to the node, but it only seems to keep track of the first file I uploaded. The second file is recorded in {file_managed}, but the {field_data_field_file} is not recording the multiple fids that belong to a nid of type audio. In the field_file_fid column there's only space for one fid, not an array of fids.

Do I need to go to contrib (FileField?) to manage multiple files uploaded to a single node? or am I doing something wrong? I'm hesitating to go to contrib because this seems like a basic feature that ought to be in core.

Thanks.


texts: How can I increase memory_limit for batch processes only?

texts:
I have a batch process that occasionally exceeds the memory_limit, which is currently 96M. Of course I know the ways to increase the memory limit for the whole site, but I prefer to increase the memory limit for batch pages only.

One way I could think of, is to implement hook_init in a custom module and do ini_set('memory_limit', '200M'); whenever arg(0) == 'batch', but I'm not sure if that is the best solution.

What do you recommend? I guess I could do it in .htaccess, but regex isn't exactly my forte...

[update]
Meanwhile, more searching tells me (Stack Overflow, Webmasterworld) that it is not possible to add a conditional php_value directive to .htaccess.


texts: Css redirect to other css file after logging out. Bug?

texts:
I have styled the class .tab-content and it works fine whenever i logged in, but i logged out then the css file is changed to a different file as you can see on the screenshoots below. I have ran drush cc all and drush cron as well as I don't have boost module installed. Do you have any idea to fixed this?

when i login

when i logout


texts: Using View to List a Member's Organic Group with Inherited membership

texts:
I am looking to create a view which will return any content a user has membership to.

Following steps from another post, I managed to return content which matches users membership. But this doesn't take into account content where membership is inherited. So a node which is linked to another node's audience doesn't appear in the view.
Steps taken:

Add new view. Show -> OG membership (important!)
Then in some display add a contextual filter:

OG membership: Entity id.

Provide default value: Type -> User ID from logged in user
Next to get the actual titles of the groups (as the base table is OG
membership, not node),
Add a relationship -> Group Node from OG membership.
Add a field -> Content: Title. Relationship -> Group node from OG
membership.

Using Views to List a Member's Organic Groups (7.x-2.3)


texts: Newbie Question: Modify forms before render

texts:
I'm trying to style all the text inputs with and text areas from the forms.

They are complex images so I probably will have to build a div wrapper in order to do this. There is anyway to replace all the

<input>...</input>

to something like

<input>...</input>

before rendering the content in a theme?


texts: I'm trying to set up a discount in Drupal Commerce for each additional product ordered. The first product is full price and all subsequent products should be discounted $20. I can have every product discounted, but have not been able to have the first product at full price. For example, if I have 3 of the products in the cart the discount is $60 (all three products discounted) and not $40 (only the second and third product should be discounted).


texts: Subscriptions depending addressfield field

texts:
I have a events web page based on Drupal 7.Each of the events has a adressfield field.

Now I need add a subscriptions functionality. I need each user can subscribe to the events taking place in one city (or one country).

I think none of the contributed modules can manage that.


texts:
How do I use views to create a block that display image and title.
The image is using IMCE module.

I have try create a views, select “node”, under "fields" section select "content" but can't select the imce image.

What is wrong?


texts: Is hook_init() still used? If it is not anymore used, how do I convert code implementing hook_init()?

texts:
Looking on Drupal.org API, I noticed that hook_init() is not documented for Drupal 8. Looking at the change records, I found Bootstrap hooks no longer exist, which points to Get rid of all 'bootstrap' hooks, where the bootstrap hooks are said to be hook_boot() and hook_exit(); nothing is said about hook_init().

I searched for hook_init in Drupal 8 source, and I found the following code. The first one is a reference to hook_init() made in a comment; the other two seem a hook_init() implementation, but they both get a parameter I am not expecting.

function overlay_enable() {
  if (strpos(current_path(), 'admin/modules') === 0) {
    // Flag for a redirect to <front>#overlay=admin/modules on hook_init().
    $_SESSION['overlay_enable_redirect'] = 1;
  }
}

/**
 * Implements hook_init().
 */
function phptemplate_init($template) {
  $file = dirname($template->filename) . '/' . $template->name . '.theme';
  if (file_exists($file)) {
    include_once DRUPAL_ROOT . '/' . $file;
  }
}

/**
 * Implements hook_init().
 */
function twig_init($template) {
  $file = dirname($template->filename) . '/' . $template->name . '.theme';
  if (file_exists($file)) {
    include_once DRUPAL_ROOT . '/' . $file;
  }
}

I also looked for any function invoking hook_init() but I didn't find any.

Is hook_init() still used in Drupal 8? If it is not anymore used, how do I convert Drupal 7 code implementing hook_init()?


texts: Allow users to select among various default images while creating their profile if none is uploaded

texts:
I'm using ImageCache, ImageField and Content Profile to create my user profiles and I'd like to offer different default images if the user doesn't upload one.

Currently, ImageField offers a default image if none is uploaded but how can you show your user a lists of profile images in order to let them select one or upload their own ?

I'm looking to get something like this:

Of course if the user upload one it will be used on their profile.

Any module you can recommend me or custom code to achieve this ? Does the Gravatar module allow this ?

Thanks a lot.


texts: Change contact form to email based on selection?

texts: I am attempting to change the email a custom contact form is sent to based on what selection the user makes when filling out the form. Is there a way to do this in Drupal 8?


texts: Elasticsearch-Connector: can't index with Search-API

texts:
Im using latest Drupal 8.x with Search-API 8.x-1.5 und Elasticsearch_Connector 8.x-5.0alpha1.

I can add a cluster and via Search API I can also connect to the Elasticsearch Server. But when I try to add an Index via Search API the following error comes up:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [id]"}],"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [id]"},"status":400}

Does anyone know of such an error and can help me with that?


texts:
I am using Commerce Kickstart 2 to build a store. I have several Feeds importers working well. I duplicated a working importer and updated the mapping for the "product variation" and "product display".

When trying to import, I now receive the following error:

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  'commerce_product-236' for key 'PRIMARY' SQLSTATE[23000]: Integrity
  constraint violation: 1062 Duplicate entry 'commerce_product-237' for
  key 'PRIMARY' SQLSTATE[23000]: Integrity constraint violation: 1062
  Duplicate entry 'commerce_product-238' for key 'PRIMARY'

I have re-run the working importers and do not have this problem. Reading other posts, it sounds like the importer is trying to import the same item twice, but I don't see why.

I checked the log and see that it isn't grabbing "SKU" from my csv and is assigning it something else. How do I deal with this?

  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  'commerce_product-236' for key 'PRIMARY'
  Original item

array(
  'title' => 'model',
  'brand' => 'brand',
  'product category' => 'prod',
  'primary use' => 'MTB',
  'intended use -alt' => '29+',
  'frame material' => 'Steel',
  'brake type' => 'Disc',
  'rohloff' => 'Yes',
  'rohloff axle plate' => 'OEM',
  'belt compatible' => 'Yes',
  'tensioning method' => 'Pivoting Dropouts',
  'build kit img' => '',
  'body' => 'Customized for Cycle Monkey: Rohloff-optimized designed for trail riding and versatile enough for...',
  'sku' => 'VN001',
  'price' => '738000',
  'dealer price' => '627300',
  'color' => 'Orange',
  'frame size' => 'XS',
  'wheel size' => '29+',
  'build kit' => 'Signature',
  'images' => '',
)

  Entity

(object) array(
  'type' => 'bikes',
  'product_id' => '236',
  'sku' => 'Bikes-236',
  'revision_id' => '233',
  'title' => 'model',
  'uid' => '1',
  'status' => 1,
  'created' => 1463278774,
  'changed' => 1463278774,
  'log' => 'Created by FeedsCommerceProductProcessor',
  'revision_timestamp' => 1463278774,
  'revision_uid' => '1',
  'language' => '',
  'is_new' => TRUE,
)


texts: Permission for specific role to edit ANY comment

texts:
I'm using the default Drupal 7 comments for my website and I would like to give specific roles the ability to edit any comment. My role can edit just about everything about a comment(Name, email, time etc.) but not the comment itself.

Only as user 1 I can edit the comments it seems.

Am I missing something here?

EDIT
I just figured out that it's not the permission for the field. It's the permission for the Rich Text Editor that was wrong. Checking the normal Administer comments and settings was enough. I'm an idiot.


texts: How to update a field in Drupal 7 without saving whole node

texts:
I wanted to update a field that is not seen by the user, but I would turn off and on (boolean) quite a lot (and for thousands of nodes). I initially used field_attach, but this had the unhappy effect of removing a file that was also attached to the node (this is a drupal bug).

It took a lot of searching, but I found the solution combining a couple of other peoples snippets. I put it below so hopefully may save someone some time.

For the record: Apparently it is bad practice to edit fields directly like this, however, I really needed to for this use case and I have yet to find any issues. You have been warned!


texts: View which filters based on URL matching field value

texts:
I'm trying to create a view for solr search results, what I'd like to do is have have a page in the view each of which pull data from the same set of results but filter them based on matching part of the URL to a field in the content type being indexed.

The problem is the part of the URL used for matching won't match the value of the field in content type, so I was thinking of having a list of some sort which would match the URL with the corresponding field value.

Is this even possible? If it's not I could always create a new view page for each possible URL & manually set a filter criteria. I was just hoping that rather than creating multiple view pages I could do it with one.


texts: Import a class via template.php or other ways

texts:
I'm using Drupal 7 and have this structure:

Lorem Ipsum

...

I want add a class top of this structure. E.G.

**
**

Lorem Ipsum

    ...

**
**

I don't use page.tpl.php files because using Views module. I put this code in template.php but don't working:

function mysite_preprocess_image(&$variables) {
if ($variables['style_name'] == 'node-ortaklar-cv') {
$variables['attributes']['class'][] = 'header';
}

}

Is is possible put a div in structure via template.php or some way? And how? Thanks.


texts:
I am trying to migrate user accounts from a Drupal 7 site to a Drupal 8 site.

On the Drupal 8 site, I have a module that programmatically adds users using the following code.

$user = User::create();
$user->uid = '';
$user->setUsername('test');
$user->setEmail('test@abc.com');
$user->set("pass", $S$E96L22SibwKw5GrZrrCqCz7mxSjr9Z2pSB3GqBs5eeheTBPxOlJc); /*hashed value*/
$user->save();

The module creates the accounts correctly, but the user passwords are re-hashed.


texts: Can't get workflow to show up on D7 Menus

texts:
The workflow menu doesn't seem to show in the menu system in Drupal 7. The only place that I see "workflow" is in the configuration section, and it appears as a section called "workflow" and it only has Rules in it!

This is the exact same problem on the documentation (https://drupal.org/node/872876), however that did not help!

I've installed workflow UI and workflow API, Rules and Rules UI,  flushed all caches, uninstalled rules and workflow modules, reinstalled, tried various combinations of the modules, etc. Still no workflow option in the configuration menu.

I must be missing something stupid because lots of people are using workflow...


texts: How to refresh/update a Block or View after a form submit?

texts:
I have a View of created entities displayed as a block. On the same page I have a form with which new entities can be created, and this form submits through AJAX because I do not want a page reload after submission. The issue of coarse though is that after submission, the View on the same page is not updated which makes it look like that the submit has done nothing. I could set a Rule to reload the page after submission, but I would like the View to update without reload.

What I have tried (Drupal 7)

I have experimented with the Views Auto-Refresh module, but constantly refreshing a View seems a bit of overkill since for performance reasons it would be better to only have this triggered on a form submit. The module Views Flag Refresh does exactly what I need but because it is a Flag and not a form element I am not sure how I could use a flag to submit the contents of a form. The following module does exactly what I need and refreshes a View after a form submit, but there is only a D6 version (Ajax Views Refresh) with no plans for a D7 port. The final possibility I have considered is Node.js integration (Views Node.js), but this seems hugely complex for such a small feature and I am not that confident in my ability to pull this off.

So at this point I'm not quite sure in which direction to go. How could I do a refresh after a form submit?


texts:
Site is hosted in fasthosts wherein <IfModule>  is not supported so they advice me to edit .htaccess to something like this.

Comment,
Order allow,deny
</FilesMatch>
Options –Indexes
Options +FollowSymLinks
DirectoryIndex index.php
Enable expirations
ExpiresActive On
ExpiresDefault A1209600
ExpiresByType text/html A1

Sample:

#<FilesMatch
#"\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Ta
#g|Template|all-wcprops|entries|format)$">
# Order allow,deny
#</FilesMatch>

It solved my first issue, 500 error.

This time, another error is showing, images are not correctly showing and css.
Instead of the path to be site.com/drupal installation/ image of path, image address become site.com/image of path.

By the way, I am installing drupal in a sub folder. site.com/dupalHere


texts: Views Relationship/Contextual Filter for sibling nodes

texts:
I have a content type 'property' and a content type 'park'. I'm using an Entity Reference field in the property to reference a park. The park is essentially a parent or neighborhood or that contains the property.

On the property page, I want to display the sibling properties (the ones that share a common park/parent). I'm able to show child properties on the park page, but can't for the life of me figure out the relationship/contextual filter combo to use to get this working. I see many examples online that use taxonomy, but this is an entity reference relationship. Setting up a relationship I have options for Entity Reference: Referenced Entity - A bridge to the Content entity that is referenced via field_master_park and Entity Reference: Referencing entity - A bridge to the Content entity that is referencing Content via field_master_park and I assume I use (at least) one of these combined with a contextual filter?

Anyone able to at least point me in the right direction?


texts: Problem: users are logged out automatically without any reason, while navigating to the website

texts:
Hi After some time Im having a very serius problem, while logged in users interact with the website they are logged out without any reason.

For example, I log in, then I interact some minutes with the website, then for example I try to access to create an article (or whatever) then I get an access denied because I was logged out automatically, I do not know why...

Any idea?


texts: How to display unpublished contents in views for all the users?

texts:
I need to display published as well as unpublished content for all the authenticated users. Also, site also has workbench moderation module enabled.

I have tried by pass access control permission, view unpublished contrib module.

Please suggest.


texts: How do I write to location field in an Entity?

texts:
I am having a custom entity called Micronews which has a bundle microupdate created in it. I am able to write entity to db for all fields but I am not able to figure out how to write location (using location module). It seems to be stored in db in multiple tables. Is there any standard way to store location to db?

function p_save_entity($name, $issue_type, $constituency, $location){

$name = "Testing programmatically";
$issue_type = "electricity";
$constituency = '22';

$e = entity_create('micronews', array(
    'type' => 'microupdate',
    'name'=>$name,
    'created'=> time(),

));

$ew = entity_metadata_wrapper('micronews' ,$e);

$ew->field_type->set($issue_type);
$ew->field_constituency->set($constituency);

$ew->field_location[latitude]->set('65.000000');
$ew->field_location[longitude]->set('65.000000');

$fl = $ew->save();

if ($fl){
    return "";
}

else{
    return "Something went wrong";
}

I am using this module.


texts: How to override filenames via file description field in uploaded files?

texts:
I'm using File (Field) Paths to change filenames of uploaded files. There's a nice option to enable file description. I want the files to be renamed according to that file description (I tried to find a replacement pattern for this; there does not seem to be one). In terms of doing so the file description field should be a required field, which is not allowed to be empty.

Any ideas how to accomplish this?


texts: How use Search api saved searches module for Views?

texts:
I used module Search API, to search users and I used module Search API saved searches to save result after search. This problem is after searched then it not display "Save search" to save result after search.

Please see the image below.


texts:
I want to modify my exposed view with a text below the view title.

How can I do this? Can I do this with hook_views_query_alter()? If yes, then how can I achieve it?

I need to add text below operational report.


texts:
I have a content type that has a multi-value taxonomy field. When I create a new item and select several values, I am presented with the following error:

  Array to string conversion in DrupalDefaultEntityController->cacheGet() (line 369 of /path/to/drupal/installation/includes/entity.inc).

The values are saved and everything appears to be working, but having this error appear every time is a little distracting, especially for the office staff who are actually entering the data.

Why does this happen?


texts:
I'm using Drupal 7 on an Ubuntu VPS, I'm trying to setup CDN module with Rackspace cloud files. I'm using file conveyor and the whole setup going well. the only problem I have that Drupal CDN module not altering the files url to use the cdn urls. it still use local files.
- the files already synced to rackspace.
- file conveyor working fine.
- Drupal CDN configured correctly  and it show me that it sees file conveyor working and it's sees the sync file database.

more details about the issue: I'm using multisite setup and I'm using file conveyor with the public files folder.

Any Advice? Thanks


texts: Using 2 code repos, one Acquia and one private gitlab server for Drupal code base tracking

texts: I run a few drupal 7 sites on acquia and I also have a separate gitlab server for sites that are not on Acquia. Is it possible to push to both repositories on Acquia and Gitlab?


texts:
I would create regions on my zen theme, reflecting the narrow columns side by side.

I want a layout that does not provide the content by default, but it plans to create 3 sidebar facing the same width.How can I do?

EDIT

Also, I want the page layout different from the initial layout of other pages, so I can have different layout templates with different regions?


texts:
When logging in via a POST to user/login?_format=json
I'm sent back a response that looks like this

{
    "current_user": {
        "uid": "233",
        "name": "test"
    },
    "csrf_token": "XXXXXR5HQwidW7CKIDL52tOg4JGKi7Pa-j87KKlr8Mg",
    "logout_token": "XXXX-G35feFznaapSggzlUQEhYKXqom6yYVDwCH5Zxc"
}

I'm also sent back a session cookie that looks like this

name: SESS95f37088bf4f23c4304d24270b7xxxxx

value: rqAupOwS2ieqwClBkwEaWj8-ywLqnQEcAL2xOG-xxxx

When I send a GET to session/token

I receive a seperate token that looks like this _XXXXXnX8k_prCNfdrHp6XeHOUx7DcuouqiLKBBn-Go

I understand that the logout token is used with /user/logout in order remove the cookie and log the user out.

My questions are as follows.

The Cross Site Request Forgery token doesn't seem to be required by any of my end points by default. Is this something I should have the backend require them on specific paths using _csrf_token: 'TRUE' (and be passing with each request using the X-XSRF-TOKEN header?) Is this automatically passed with the cookie by chance?

The same question goes for the session token from session/token should this be being passed with each request, or in general what is the purpose for this token? I've seen this token referenced in docs as another CSRF token. If this is the case why is it different than the one provided by the login POST?


texts: 7 - Sorting a Views exposed filter options alphabetically

texts:
I have a custom module which uses hook_form_views_exposed_form_alter() to sort the options of a select list into alphabetical order.

This appears to work because dmp($form) shows $form['field_keywords_tid']['#options'] to be in alphabetical order, but when checking the select list the order is different.

You can see the view and the dpm() output on the dev site.

My code so far is:

function dependant_keyword_filter_form_views_exposed_form_alter(&$form, &$form_state){
if ($form['#id'] == 'views-exposed-form-annotated-bibliography-page') {

    foreach ($form_state['view']->filter as $field => $filter) {
        if ($filter->options['exposed']  && $filter->options['id'] == 'field_keywords_tid' ) {
            $field_id = $form['#info']["filter-field_keywords_tid"]['value'];
            asort($form[$field_id]['#options']);
        }
    }
    dpm($form);
  }
}

I thought I needed to replace $form['filter-field_keywords_tid']['#options'] with the sorted array so I tried the following code after the foreach above, but this didn't work either.

$options = array('All' => '- Any -');
  foreach ($form[$field_id]['#options'] as $key => $val) {
      $options[$key] = $val;
  }
  $form['field_keywords_tid']['#options'] = $options;

I also tried the code below found in this Drupal Answers post with the same result. dpm() output sorted but select list not.

foreach($form_state['view']->filter as $filter) {
    if($fid = $filter->options['expose']['identifier']) asort($form[$fid]['#options']);
}

I'd appreciate any suggestions.


texts:
I've got a main website where it's possible to create and change menu items and I need to share this menu with other websites and programmatically(once per week or once per day) the other websites will import and override the menu.

This is very useful when a company has got more websites and wants to use the same footer menu for all its websites.

Do I need to use just Feeds and Rules to achieve it?
Is it possible to achieve it without adding the main website db menu in settings.php in all the other websites?

Thanks in advance


texts: Unauthorised users to view homepage without menu

texts:
I have installed the Front Page module on my site.
I want to show visitors (not-logged in users) to see the same homepage as logged in users but without the navigational bar.

I have used re-direct to the "/home" in the front page settings and removed menu permission in the anonymous users roles section but I am getting an access denied message.


texts: I have a profile type which uses an autocomplete field which references to another profile. As an entity type i selected user and for filtering the results i use an entity selection with views where i choose what view to filter my content. So far so good , but i've seen that i can pass additional arguments to the view. My question is: How could i pass the input from autocomplete to the referenced view ? ( what should i type in the view arguments field to get the input from autocomplete ? )


texts: Why is Cloud Zoom not functioning properly on new variation type?

texts:
I am using Commerce Kickstart and trying to add a new variation type to my webshop.

However, it seems that it won't work. This displays an extra block that I can't seem to hide and the controlls are 'jumpy'.

The cloud zoom settings are as followed (and exacly the same as in the functioning example).

Slide image style : product_full
Zoom area image style : full_original_size
Gallery settings
Gallery mode : 1
Thumbnails image style : product_thumbnail
Zoom area possition
Zoom width : auto
Zoom height : auto
Position : inside
Adjust X : 0
Adjust Y : 0
Zoom style
Tint : false
Tint opacity : 0.5
Lens opacity : 0.5
Soft focus : 0
Smooth move : 3
Show title : 1
Title opacity : 0.5

Functioning example: http://suppsbv.com/webshop/nl/productdisplay/lipo-100-60-caps

Not functioning: http://suppsbv.com/webshop/en/smaak/extreme-whey-deluxe-pouch

I can't seem to find the answer, so any help would be appreciated.


texts: Drupal 8 - What is the format for viewsreference arguments?

texts:
I am using a views reference field inside a paragraph on a node. I know that I may add optional arguments but how should I format the arguments? Two things I would like to do are:
 - Limit the number of results returned in the view to 3
 - Display only results with a certain taxonomy term

Here is a screenshot of the arguments field in the paragraphs UI.


texts:
I'm trying to understand sass and compass so that I can take advantage of them when subtheming Zen, but I'm having trouble finding a good tutorial.

All of the documentation I find seems to already expect me to understand what the heck they are talking about. :) I've got a full understanding of standard CSS, that's not the issue.

I'm trying to do just the simplest thing and I'm not sure what the next step is. For example, by default the max-width is 1200 in the sass/layouts/responsive-sidebars.scss. I would like to change it, but when I make changes to responsive-sidebars.scss nothing in my actual presentation changes (I'm assuming because the actual presentation is using the actual css files in css/layouts/responsive-sidebars.css).

What am I missing? Do I need to do something to actively translate the scss file into the css in the other directory?


texts:
I would like to edit my Panels (Panel Layout and Panel Content) in the administration theme, however when I click on the tab to go to panel layout (node/%node/panel_layout), it always opens in my default theme.

Is there a way to have it use my admin theme for panels?


texts: Drupal Views Table with Alternating Amount of Columns

texts:
I'm trying to make a view with alternating amount of columns. The first row should have only 1 column, while the second row needs 2 colums, third 1 column and fourth again 2 coulumns. The fields displayed are the titles of a certain content type.

I want to be able to use a table or a grid if possible.

Currently I'm using an unformatted list and used css to display it the way I want, but then it's no longer quite responsive.

What should I do?

ex.

title 1

title 2 I title 3

title 4

title 5 I title 6


texts:
I manage a lot of Drupal sites and drush is a lifesaver. I usually script what I need done and then loop over all of the sites.

Many times I need to execute several Drush commands on the same site. Because Drush has to go through the bootstrap process for each command it can be a bit slow. So if I do three commands, Drupal gets bootstrapped three times. Example:

drush cc all
drush dl freds_module
drush en --yes freds_module

So is there any way to run multiple commands with one bootstrap? Something like:
drush "cc all" "dl freds_module" "en --yes freds_module"

The idea is to bootstrap drush only once rather than three times. If it is not possible, I'll still be happy with Drush.

Thanks.


texts: Drupal commerce: How to retrieve VAT number from order ID?

texts: I would like to print the VAT number (provided by module vat_number) on the invoice PDFs generated by module commerce_billy, but I can not figure out, how to retrieve VAT number when an order ID is given.


texts: How to insert checkbox value in MySQL database

texts:
$languages_knows=array(
'English' =>t('English'),
'Hindi' => t('Hindi'),
'Marathi' => t('Marathi')
 );

$form['languages_known'] = array(
'#title' => t('Language Spoken'),
'#options' => $languages_knows,
  '#type' => 'checkboxes'
);
function lawyer_register_form_submit($form, $form_state)
{
//Does something with successfully submited form fields.
global $user;
 $user = db_insert('lawyer_details')
->fields(array(
'first_name' => $form_state['values']['first_name'],
'middle_name' => $form_state['values']['middle_name'],
'last_name' => $form_state['values']['last_name'],
'languages_known'=>$form_state['values']['languages_known'],
))->execute();

Please help me.they gives error

  PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {lawyer_details} (first_name, middle_name, last_name, street_address, city, country, phone, email_id, speciality, languages_known) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9);


texts: How can I fix the node list page broken by changing the reference field from a term reference to an entity reference

texts:
This answer explains the set up I currently have.  I have cloned the Taxonomy Term view built into views, and added some extra filtering etc. To create a depth aware list of nodes for taxonomy terms as linked by pathauto (pattern pub/by/[term:vocabulary]/[term:name]).  So for example previously a link to /pub/by/publisher/asian-development-bank would provide me with a list of nodes that had associated Asian Development Bank in a term reference field with the node.

This is site is bilingual, and the publisher vocabulary has an acronym field, and on the node creation form, I needed the autocomplete to return results for the name entered in either English or Japanese, or the acronym.(more detail in this question) Which required me to change the fields referencing the publisher vocabulary to be entity reference fields instead of term reference fields.

The problem is that now /pub/by/publisher/asian-development-bank is an empty list.  I'd like to override /path/by/publisher/% links to use an entity reference relationship to search for the term rather than the means that the default Taxonomy Term view does.  The issue is that the path in the Taxonomy Term view is /taxonomy/term/% utilizing the value coming from the destination query variable.

How can I create a view that will still use those links generated by pathauto, but actually return results from the entity references?

Just to complicate things a little, each node has two entity reference fields to the publisher vocabulary: field_doc_copyright and field_doc_publisher


texts: how to over-ride text box classname in drupal

texts:
By default text box class name is : class="form-text"
i want to over-ride the class name, with some othername.
how to over-ride ? Can any one give the suggestions.