texts: drupal_get_form not working when called inside a block

texts:
I have a custom module installed which displays a form at user/UID/apps/add. So, what this form does is lets user add node/nodes of "x" content type he/she wants in their app.
Form is created using this function-

function devconnect_developer_apps_edit_form(array $form, array &$form_state, stdClass $account, $app_id = NULL)

I'm trying to implement this form on every node so that the user can add that particular node to an existing or a new app on a button click.

Figured out I should be passing this nodeID as a default value to the form using drupal_get_form.
So created a block which renders the said form and to test if the form is being rendered I added it to a page to only see a 500 error.

Here is the block-

 <?php
    /**
     * Implements hook_block_info().
     */
    function sei_useapi_block_info() {
      $blocks = array();

      $blocks['MYBLOCK'] = array(
        'info' => t('My block'),
        'cache' => DRUPAL_NO_CACHE,
      );
      return $blocks;
    }

    /**
     * Implements hook_block_view().
     */
    function sei_useapi_block_view($delta = '') {
      $block = array();

      switch ($delta) {
        case 'MYBLOCK':
          $block['subject'] = t('My block title');
          $block['content'] = drupal_render(drupal_get_form('devconnect_developer_apps_edit_form'));
      }
      return $block;
    }

Don't have a clue what went wrong. Any ideas? Thanks for reading !


texts:
I'm just migrating a site that has a proxy pass in the vhost config like the following.

ProxyPass /n/ http://xxx.xxx.xxx.xx:80/n/
ProxyPassReverse /n/ http://xxx.xxx.xxx.xx:80/n/

I need to replicate that in the drupal .htaccess file as I don't have direct access to the hosting as we're using a fully managed drupal solution. I have tried the following but it does not work, when I navigate to the drupal site /n I just get a 404.

RewriteRule /n/?$ http://xxx.xxx.xxx.xx:80/n/ [P]


texts: Posting Data to an external site using APIs

texts:
I've been tasked with posting information from our website to recreation.gov, using their API http://usda.github.io/RIDB/

Is there a specific way using any sort of drupal module or built in PHP with drupal to do this? I've not done it personally in the past so any information that could help me would be greatly appreciated.


texts: Product reference field causes $title to be empty

texts:
Update: After removing fields one by one, I've discovered that the Product reference field caused $title to be empty.

I have several content types which are displaying both the <title> and $title well, but in my "Product Display" content type (of commerce kickstart) I find that the $title  header is missing, although the <title> tag is there, i.e. the title bar of my browser is displaying the page title correctly. The contents of <title> and $title are similar. Excep that <title> has the site name added to the end of the node title.

I've viewed page source it shows that h1 isn't printed. I've never written any code to hide any h1 tags. I'm using Display suite on that page and I've disabled it on that content type and it didn't help. I am not using Context on that page. Please advise me on how I should proceed, thanks!

Update: Devel->load shows that the title is set correctly, but when I created a template for that node (page--node--42.tpl.php), and tested if it worked by hiding the header and footer, I added this line of code

<?php print $title; ?>

but all I got is am empty $title

Update 2: I've inserted a block using  [current-page:title] and it works, however I'd prefer not to stick with this duct-tape solution if possible


texts: How to insert Google Tag Manager code into pages with variable account value

texts:
I need to insert the Google Tag Manager snippet code into each page just after the opening <body> tag. This is fine, except I would also like the user to specify the account number in an admin form, so what is put in this form will be output in the snippet.

In the snippet, the account number is required twice:

<noscript><iframe src="//www.googletagmanager.com/ns.html?id=<ACCOUNT NO HERE>"
...
(window,document,'script','dataLayer','<ACCOUNT NO HERE>');</script>

Setting up the admin form and storing and retrieving it by variable_set() and variable_get() is no problem, but what's the best way to insert it into the template?

My thought is to use hook_preprocess_page(), but I'm not sure if this is the right hook to use, and if it is - what part of the array I would need to change to get this to appear? Or would a better way would be to make a variable available to the tpl.php file and insert it there? In which case, how would this be achieved? Thanks!


texts: How to use the Rate module to rate things inside the content?

texts:
I'm quite new to Drupal so I haven't figured out how to use the Rate module for rating things inside the content of, for example, a basic page. I'm using Drupal 7.

Here is what I want to do, but I don't know how:

I have a basic page with links inside the content. I want visitors to be able to vote with thumbs up or down if the link is good. Also I want stars for voting for the contents of the other page. My problem is how to display the thumbs up and stars on my page. Do I create a widget? A view? How do I make them show on my page? A step-by-step explanation would be great!

I've spent so many hours on figuring this out, but I'm sure you can do it in just a few minutes.


texts: Use REPLACE in update query using db_update

texts:
I need to run an update query that involves using the SQL REPLACE and LEFT functions, and I need to do it with three different queries for multiple tables, so I'd like to do it in a loop. The problem I'm having is getting the REPLACE function to be interpreted properly. The query I need to run is this:

UPDATE field_data_field_myfield
SET field_myfield_value =
REPLACE(field_myfield_value,
'old_value', 'new_value');

From what I've found, I need to use the expression function like so:

foreach ($tables as $table => $field) {
  $num_updated_1 = db_update($table)
    ->expression($field, 'replace(:field, :old, :new)', array(
      ':field' => $field,
      ':old' => 'old_value',
      ':new' =>  'new_value',
    ))
    ->execute();
}

However, when I run it like this, the field just gets updated with the field name as a string for every field.

What do I need to change for this to work?


texts: How to add multiple value field in webform

texts: I want to add a file field called picture to a webform, and Want it to be a multiple value field to allow users to upload more than a picture


texts:
I am pretty new to Drupal, can someone tell me why ive got lots of node urls in my index on Google, is this because i havent given the post on my site a friendly url ?

Is there a way to fix this or do i have to edit every post with a node url ?

Is there a way to stop this happening in future

JC


texts: Is it good practice to style the panel layout?

texts: I have a panel layout. I was wondering if its okay to apply additional css ids / classes to this or to style elsewhere? I am using panels everywhere and I have moved the layout into my theme.


texts: I'm using the Values module for creating a list of subscriptions the user can choose of when they register (it's a field in the registration form). Now I've seen I can also create a list with the Taxonomy module. I'm just curious what's the best practice for this? Should I use the module already implemented or is Values module better in my case?


texts: Export Webform submission data into external database

texts: I need webform submission data to be inserted into an external sql database.  How would I go about doing this? Would this be a custom module, or be processed in template.php?  I am having trouble understanding how I can capture that data and have it sent over to an external database.


texts: Add a new field collection item to an existing field collection

texts:
I have 1 field collection

Field collection: CKT Info child2
  machine name: field_ckt_info_child2

In that have 2 fields:

Field1: English CKT child2
  machine name: field_eng

Field2: Maths CKT Child2
  Machine name: field_maths_ckt_child2

I have set field setting "unlimited" to this field collection. Now I just want to add new field collection item in existing Field collection(CKT Info child2) programmatically. I have tried below code but it's not creating new field collection item.

function createFC()  {
   $field_collection_item = entity_create('field_collection_item', array('field_name' => 'field_maths_ckt_child2'));
   $field_collection_item->setHostEntity($node);
   $field_collection_item->set('field_maths_ckt_child2', "SET SUCCESS");
   $field_collection->save();
}


texts: How to modify or override Main page content block in drupal 7?

texts:
I had wasted my 2 days but unable to find a way that how to modify or override the main page content block in drupal 7. Please help me.

I want to edit this main page content block.


texts: Why are my custom error pages returning HTTP status 200 headers?

texts:
Drupal 6 on IIS 7.
We have webconfig.xml setup to "Execute" the error pages when an error occurs, but the problem is that this now send status code 200 to the client (it is successfully serving the custom error content), which now means that unpublished URLs get indexed by search engines and other crawlers.

I notice that a default Drupal install send the correct HTTP status codes (404, 500, 403, etc), so it must be something in our configuration.

The option to use the default Drupal error pages is likely not on the table with this client.


texts: Why do i get a select dropdown when in mobile view from superfish

texts:
I have a navigation menu from superfish in the header for my site.  It looks fine in my regular desktop and even landscape view of tablets but when it gets down to the size of a phone the wheels kind of come off.  In the mobile view I still get the ususal three horizontal bars that expand into the dropdown menu. But a "select" element shows up for some reason.  I dont know what i changed because this doesnt show up in my original installation but in my dev sight it does.

Does anyone have any idea where this "select"  comes from?


texts: How to embed drupal content in other sites (remove X-Frame-Options: SAMEORIGIN)?

texts:
I tried to make a iframe with a drupal page but I received the following message:

  Multiple "Refused to display (page adress) in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'."

Then, I tried to change the header of response in page controller using

$response->headers->set('X-Frame-Options', 'GOFORIT');

And I received the following message

  Multiple 'X-Frame-Options' headers with conflicting values ('GOFORIT, SAMEORIGIN') encountered when loading '(page adress)'. Falling back to 'DENY'.

Drupal core puts the following code in all responses.

$response->headers->set('X-Frame-Options', 'SAMEORIGIN', FALSE);

So, how can I override the X-Frame-Options header for only this response to embed this page in other sites?

I'm using Drupal 8.0.0.


texts: How can I access block field values in mytheme_preprocess_block?

texts:
My fundamental question is this: in Drupal 8 how can I access block field values in mytheme_preprocess_block.

I am trying to achieve something like https://www.drupal.org/project/block_class_styles in Drupal 8.

So far I have created the block field, and extracted the raw field value in twig (and then add classes or conditional statements) by doing something like:

{{ content.field_layout_style[0]['#markup']|escape }}

This looks really bad, I would rather access this field value in mytheme_preprocess_block, and then pass it to twig, and/or access it in  mytheme_theme_suggestions_block_alter and make separate template suggestions based on it.

Help very much appreciated.


texts: Create link (url) to the full node from a Solr view (search results) with rewrite results

texts:
In admin/config/search/search-api/index/default_index/fields I added URI field.

But how can I create a link to the full content? In the view, when I click on Add fields I am able to select: URI (indexed field)    Index Default index A URI where the item can be accessed

But in the field settings, when I select:

Link this field to its item
Display this field as a link to its original entity or item.

It doesn't become a link? How do I create a link to the full content in a Solr view?


texts:
when using the Drupal FAPI and needing a float number field you have to use type textfield.  What's the best way to validate that this data is a float during hook_form_validate9)?  Is there a built in function. or do you have to do is_float()?

Thanks.


texts: Drupal 7 Click tracking / traffic per node

texts:
I'd like to track the number of times a node shows up in search results, the number of times it's clicked on in a search result, and the number of times it is displayed. I'd like all of this information to be readily available - perhaps stored in the content type? I could use some help determining the best practice here.

Alternatively. Could I use google analytics to track all of this somehow such that I could access the results from a custom designed module (which, can anyone point me in a direction on?)

Ultimately I want uses to look at a node and be able to see how much traffic came from in-site linking, off-site linking, and how many times users followed a link from the node to an external website.

Can I export google analytic data for each node somehow to drupal?


texts:
How can I get a list of the patches I submitted for issues on drupal.org?

I can see the list of my posts, but I need only those with a patch.


texts: Mobile website translation problem (losing language prefix)

texts:
I have site translations that works with language prefix

m.mysite.com/ - default language (lithuanian)
m.mysite.com/en - english
...

If i translate site to foreign language and pushed menu button on mobile website, it redirects to the default language.
For example, if I were in m.mysite.com/en (website translated in english) and pressed button "News" it redirects me to m.mysite.com/news-page that is in default language.

I should redirect to m.mysite.com/en/news-page that is translated in english and has language prefix /en/.

So, how to add language prefix to the link and redirect correctly (without losing current site translation)?


texts: Setting Drupal Image Field via Services, and image won't attach to node?

texts: I'm uploading an image via my iOS app and setting a created node's image field to the image through Drupal Services. Everything appears to be correct (see uploaded photo from 'Recent Logs'). However when I navigate to the node, the image field is empty? Any idea as to why this might be? All help is appreciated, thanks.


texts: Changing time format for comments in template file

texts:
I'd like to only change the time formatting for comments that we have attached to forum posts in Drupal 7. I have a custom template setup and to get the time that the comment was created.

Right now to do this I use print($created);

And I get Thu, 12/05/2013 - 07:20

I know how to change the date formats at admin/config/regional/date-time/formats, but how do I use one of those formats when I print the date in my template file?

I see in the template file it suggests "Preprocess functions can reformat it by calling format_date() with the desired parameters on the $comment->created variable." But I don't know how to do that.


texts: Cloning / Copying value of multi-value field

texts:
I do not wanna create another wheel but could not find a solution yet.

I have multi-value field (which I implemented myself) and I would like to have possibility to add 'new item' with already predefined values.

What would you recommend to do?

I googled and did not find anything suitable for me and considering to create my own module for this.


texts: How to make user profile page display extra fields in drupal 7?

texts:
I have added some extra fields to users under admin/people/ - when I click edit beside the user, I can see the extra fields I have added.

However, if I go to /user/ those fields are not displayed.

How do I display user profile fields when their profile is viewed at /user?


texts:
How is it possible to add an image upload table in the code of a custom module in Drupal 7?

In other words, I want to add the "Images Table" (the one with drag-able rows) to a custom form I'm creating in my custom module. And I need all it's options too, like thumbnail, title and description fields for each uploaded image row plus the remove button, with the ability to limit the number of uploaded images of course.

What is the code to be used to achieve that?

Thanks for your time and help in advance.


texts: Group results of same taxonomy term with search api and views

texts:
I have couple of products which are classified with taxonomy terms.

I am using Search API with views to display search results.

I want to show the search results in this way.

Term 1 Name

product 1
product 2
product 3

Term 2 Name

product 5
product 8
product 3

Term 3 Name

product 10
product 25
product 1

What should I look into? Any idea how canIi group the results based on the term?
Thank you.


texts: Acquia Dev Desktop MySQL database troubleshooting on Mac OSX 10.11

texts:
I changed the Acquia Dev Desktop configuration, then when Apache web server and MySQL were restarting MySQL never got back online.

I have enabled the debug option in Acquia Dev Desktop.
The logs don't show any clues:

/Applications/DevDesktop/piscript.log
/Applications/DevDesktop/mysql/data/mysql.err

Workaround

I am using the MAMP mysql in the meanwhile, it has this convenient shell script:

/Applications/MAMP/bin/startMysql.sh


texts: Drupal files folder owner/group for CentOS?

texts: This is my first time installing Drupal on CentOS. I know for Ubuntu it needs to be www-data as the /files folder owner, but what is it for CentOS?


texts: hook_node_access() doesn't work for anonymous users

texts:
I am new to Drupal 7, I am still unable to understand hook_node_access operation
I am trying to give view access to the basic content types nodes for anonymous users but it is not working. It is still giving access denied.
function modules_session_node_access($node,$op,$account) {
  $type = is_string($node) ? $node : $node->type;
  $is_anonymous = !user_is_logged_in();
  if ($op == 'view' && $is_anonymous && $type='basic') {
    return NODE_ACCESS_ALLOW;
  }
  return NODE_ACCESS_IGNORE;
}


texts: how to change save button to Save and keep published?

texts:
In the content form want to change the  publish checkbox and save button into the dropdown "Save and keep published" and Save and unpublish
How can i change the layout for all content type.


texts: Fatal error "Cannot redeclare template_preprocess_select()" on every attempt to install modules or themes

texts:
Fatal error: Cannot redeclare template_preprocess_select() (previously declared in /Users/ron/Sites/provgmc.dev/core/includes/form.inc:30) in /Users/ron/sites/provgmc.dev/core/includes/form.inc on line 37

This is not an issue with code I've written or altered. I'm just trying to install a theme using the user interface. I tried Bootstrap and Zymphonies, then a simple module or two; they give the same error when trying to install them.

I am using Drupal 8.2.6, running on Mac OS X Sierra, with PHP 5.6.28. I am not using OPCache, and there are no changes from Mac OS pre-installed versions.

I've used Drupal 7 (under El Capitan) in the past, and I have never had any issues like this.


texts: drupal_mail to users selected from database

texts:
In my Drupal 7 site I use custom tableselect form to manage some events. User can review profiles of people who applied for event and approve their participation. I want to send them email notification via drupal_mail on form submission. I have implemented hook_form_submit and added following code

foreach ($values as $key => $value){

    $sql = db_select('users', 'u');
    $sql-> fields('u', array('mail'));
    $sql-> condition('uid', $value['uid']);
    $mail = $sql->execute();
    }
    foreach($mail as $m){
    dsm($m);
    drupal_mail('event_manager','event_approved', $m, language_default());
    }

But in this case I have an error :

  Warning: explode() expects parameter 2 to be string, object given in
  SmtpMailSystem->mail()

How can I fix the code to make it work?


texts: ?format=json returns 'Not acceptable format: json'

texts:
I am trying to set up the REST module for Drupal8.2.7. Install went through without problems.

I tried to follow this documentation page https://www.drupal.org/docs/8/api/restful-web-services-api/restful-web-services-api-overview to set up a simple resource for getting nodes.

I followed the descriptions for 'Drupal 8.2 & Later: ' and created this yml file in the this folder  \Drupal\rest\RestResourceConfigInterface

id: entity.node
plugin_id: 'entity:node'
granularity: method
configuration:
  GET:
    supported_formats:
      - json
    supported_auth:
      - basic_auth
      - cookie

Once that was done I cleared the cache and expected to be able to get node 1 as json using this url:

/node/1?_format=json

However, all I receive is:
    {"message":"Not acceptable format: json"}

What am I missing here?

Update:
I went to here
    /admin/config/development/configuration/single/export
and exported
    entity.node

uuid: d44c745b-d69b-4893-8f31-b65d0fe80bf0
langcode: en
status: true
dependencies:
  module:
    - basic_auth
    - hal
    - node
  _core:
    default_config_hash: t_jfECmZhJqBOJuSOFn87EOi_TWi-_fRYTuJgd19vgg
  id: entity.node
    plugin_id: 'entity:node'
    granularity: resource
  configuration:
    methods:
      - GET
      - POST
      - PATCH
      - DELETE
    formats:
      - json
      - hal_json
    authentication:
      - basic_auth
    GET:
      supported_formats:
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    POST:
      supported_formats:
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
   DELETE:
     supported_formats:
       - hal_json
       - json
       - xml
  supported_auth:
    - basic_auth
    - cookie
  PATCH:
    supported_formats:
      - hal_json
      - json
      - xml
    supported_auth:
      - basic_auth
      - cookie

However, trying to get my node via the mentioned url '/node/1?_format=json' still returns {"message":"Not acceptable format: json"}


texts:
I have a form field with type select. The results values are taken from the database.
If the select list is with single value I'm displaying the value title on the submit like this:

   $selected_index = $form_state['values']['select_list']; //the field is select_list
   $display_value = form['select_list']['#options'][$selected_index];
   dpm($display_value); //it's showing the selected option value title.

When I'm using '#multiple' => TRUE; into the form field, It's showing error: Warning: Illegal offset type in...

How can I display the titles of the multiple values?

EDIT:

This is my code:

function mymodule_page($form, &$form_state) {

global $user;

$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid and type = :type', array(':uid' => $user->uid, ':type' => 'outlets'));

$droplist = array();
foreach($result as $record) {
    $title = $record->title;
    array_push($droplist, $title);

    $form['select_list'] = array(
       '#type' => 'select',
       '#title' => 'Select list',
       '#options' => $droplist, //I'm getting this list from my database
       '#multiple' => TRUE,
   );
}

function mymodule_submit($form, &$form_state) {
   $selected_index = $form_state['values']['select_list'];

   foreach($selected_index as $key => $sindex)
   dpm($sindex);
}


texts: Integrate the drupal distribution with already existing site

texts:
I have already existing Drupal 7 site, now I got a requirement for the jobs portal for the same site, I found there is a nice drupal distribution Recruiter which exactly satisfies my requirements.

I want to know is there any way that I can integrate this distribution with my existing site, so that i can access the functionality of this distribution from my existing site drupal dashboard, please let me know, I searched a lot on this but did not got any relevant info.

I am thinking of one more option if I will create a multisite on my existing drupal site then can I install this distribution on my multisite.

If any option among these two is possible then please let me know, otherwise I have to create a new installation of Drupal and I do not want two dashboards one of my existing site and other of this distribution.


texts: What's the best way to create a content type with multiple fields that link to an external URL?

texts:
I have a content type named "News Clip" that has four fields; Title, Description, Image, URL.

In my display, I want the Title and Image to link to the URL value.

Drupal has the concept of linking these fields to "Content", but that means the node itself.  I want them to link to the URL.

I use Display Suite for my other content types and would like to avoid having to use a field template.

Is this possible?  How?

Thank you.


texts: Own permissions for paragraphs and ECK entities

texts:
I have come quite far in my Drupal 8 development without needing to write much custom php code. However, I am using paragraphs and eck entities as referenced entities in content types. For users to be able to edit their own content, I need edit and delete permissions in paragraph and eck to apply to only own content. I looked up some hooks and wrote the below code in my theme file. It doesn't work. Will appreciate any help in taking this to finish line.
  function THEME_entity_info_alter(&$entity_info) {
    $entity_info['contact_information_fields']['access callback'] = 'THEME_ENTITYNAME_access';
  }

  function THEME_ENTITYNAME_access(\Drupal\Core\Entity\EntityInterface $entity, $op, \Drupal\Core\Session\AccountInterface $account) {
    $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
    switch ($op) {
      case 'update':
      case 'delete':
        if ($entity->uid == $user->get('uid')) {
          return TRUE;
        }
        break;
    }

    return eck__entity_access($entity, $op, $account);
  }


texts: Difficulties install Drush using composer

texts:
I have tried to install Drush on OSX 10.9 but it doesn’t seem to have worked. In terminal ‘drush status’ gives

  -bash: drush: command not found

I have followed the instructions on http://whaaat.com/installing-drush-7-using-composer

Composer’s directory seems to be correct as my .bash_profile contains:

export PATH="$Trotter/.composer/vendor/bin:$PATH"

Drush exists in the vendor folder of composer

When I tried to install Drush via composer the feedback seemed to suggest it had worked:

Pauls-iMac:~ Trotter$ composer self-update
Updating to version 8e9659bd8317ad3f623c4d17940380443cf8772c.
    Downloading: 100%
Use composer self-update --rollback to return to version 1.0.0-alpha9
Pauls-iMac:~ Trotter$ composer global require drush/drush:7.*
Changed current directory to /Users/Trotter/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing pear/console_table (1.2.1)
    Loading from cache

  - Installing symfony/var-dumper (v2.7.1)
    Downloading: 100%

  - Installing symfony/yaml (v2.7.1)
    Downloading: 100%

  - Installing d11wtq/boris (v1.0.8)
    Loading from cache

  - Removing drush/drush (6.5.0)
  - Installing drush/drush (7.0.0)
    Downloading: 100%

pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
symfony/var-dumper suggests installing ext-symfony_debug ()
d11wtq/boris suggests installing ext-pcntl (*)
Writing lock file
Generating autoload files
Pauls-iMac:~ Trotter$ drush status
-bash: drush: command not found

(Note I had previously tried to install Drush 6 but hadn't got this to work either)

I would appreciate any advice on what is going wrong here.


texts: enable jquery ui effects in theme .info file

texts:
Now I should add something like <?php drupal_add_library('system', 'effects.bounce'); ?> to my page.tpl.php to enable jquery ui effects to use in views_slideshow_cycle module.

is there anyway to do this inside theme .info file?


texts: How to move views pager to different region as a block?

texts:
I created a page view and results are showing up in main page content block. Now i need to move the pager attached with view to different region.
I am not sure how to achieve this. Please suggest any preprocess or backend feature which can do this?


texts: managed_file error when uploading multiple files

texts:
I am currently using a managed file with #multiple set to TRUE.

    $form[static::FORM_CONTAINER][static::ATTACH_RELEVANT] = array(
        '#type' => 'managed_file',
        '#name' => 'attach_relevant[]',
        '#title' => $this->sanitizeString(
            "Attach Relevant Documents"
        ),
        '#default_value' => $this->getFromCache(static::ATTACH_RELEVANT),
        '#attributes' => array('enctype' => 'multipart/form-data'),
        '#upload_location' => 'public://forms/complaints/',

        '#multiple' => 'true',
        '#weight' => 5,
    );

When I'm using PrivateTempStoreFactory in my form, file uploading throws this error.

  A fatal error occurred: Serialization of \u0027Symfony\Component\HttpFoundation\File\UploadedFile\u0027 is not allowed

When using pretty generic form, that contains only one upload field above, the file upload works fine for the first time. When the Upload button is clicked the second time,  it throws this error.

  An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (256 MB) that this server supports.

The mod_security module is missing from Apache.

Any help is appreciated.


texts: Routing path with Entity Reference field

texts:
I'm working on a custom module (my_module) which provides some functionality to a specific paragraph type (my_paragraph) created from the  user interface. In my routing file, I have the following route definition.

my_module_controller_action:
  path: '/node/{node}/my_paragraph/{paragraph}'
  defaults:
    _controller: '\Drupal\my_module\Controller\MyModuleController::action'
    _title: 'page title'
  requirements:
    _permission: 'access content'

Now I add a new entity reference field (field_paragraph) to the Basic page content type. Using this field I can add my_paragraph along with other paragraph types.

With this set up, I create a basic page, add a piece of my_paragraph, and saved it (/node/123). I can see my custom controller is not called (because now the path is /node/123), but if I go to /node/123/my_paragraph/1, my custom controller is getting called there and I get the output I want.

What should I do so that my custom controller can be used on /node/123 page?
If I add /about as path alias of /node/123, how do I achieve the same outcome?

I'm actually refactoring an old custom module I wrote and trying to move away from the hooks approach if possible. One of the main motivations for me by refactoring is I can use one or more services (together with dependency injections) to separate all the possible logics here.


texts: I've created a simple feature to export my custom views. I've downloaded the view and enabled it on the manage features screen. When I look at the view in views it tells me that the database is overriding code. I don't know why as I haven't touched the view since creating the feature. Surely the view should be 'in code'?


texts: Does creating multiple tpl files affect site performance?

texts:
I am creating different tpl file for each and every content type. (Including every view)

Is it a good practice? And does it affect site performance?

Any suggestions?

thanks


texts: Paypal displaying an error while submiting webform paypal

texts:
I am using Webform paypal module with webform for donation purpose. I have added paypal button and configured it as donation button. I have inputted correct button id which I have collected from paypal site.

All set well, but while I am trying to submit this form I will be redirected to test site with following error.

While I am debugging this I am founding url as following:

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxxxx&custom=http%3A//xxx.xxx.xxxx/submission/20

If anyone has an idea how to solve the above paypal error, the please let me know.


texts: Sending client to channel messages with nodejs integration

texts:
I've been struggling with this for some weeks now and so far I have not found a proper solution yet. I guess this is a bug, but since there is no response on nodejs issue queue I'd like to ask this question here as well. (Drupal.org issue)

The situation:

I am working on a conference plugin using webRTC, where the initial handshake is done using Nodejs integration module. (Needed Nodejs for some other applications as well so I thought this would be the best way.) There is some documentation on how to send messages from client > node server > backend (> other clients). However for my handshake it has no added value to use the Drupal backend, so I want messages to go client > node server > channel.

The Nodejs integration module has settings for allowing clients to write to channels and in fact the messages arrive on the server, the server sends them to the connected clients and the clients reject the messages.

The idea:

I've tracked it down to the following piece of client side javascript in the nodejs module, where both message.clientSocketId and Drupal.Nodejs.socket.sessionid are undefined (thus equal) and the callback is left.

Drupal.Nodejs.runCallbacks = function (message) {
  // It's possible that this message originated from an ajax request from the
  // client associated with this socket.
  if (message.clientSocketId == Drupal.Nodejs.socket.sessionid) {
    return;
  }
  ...
}

Is there somebody who managed to get client > node server > channel communication using only JavaScript? Did I miss an authentication step somewhere?

Commenting out the return statement does work, but then clients respond to their own messages, leading to undesired behavior.


texts: How to add a custom block on Print module?

texts:
I'm using the Print module. I wonder if there is a way to print a custom block on the print.tpl.php. Because I want to print a node but that node has its own custom blocks that is rendered on its .tpl. I want the PDF of the Print module to also get all those blocks on the display.

Any help would be greatly appriciated.


texts: How to change the title of the page dynamically?

texts:
I created a basic page in my drupal 7 site.

On that page I have some jquery tabs. When I click on tab1 its content displays and hides the contents of other tabs, and when I click on tab2 its content displays and hide other contents and so on.

So I want to change the title of the page in the content area according to the tab selected. If tab1 selected and its content are showing then title of the page in content area should be changed according to the tab content(for example Tab1) and similarly for others.

Is this possible?

I have tried drupal_set_title("Tab1") but it does not change the title of the page. and also it will not help me because it will change the title once and I want dynamic based on the tab selected.


texts:
What is the best way to create a piece of content with multiple fields... allowing users to edit the content as a whole yet blocking the ability to edit.

The setup I have is a piece of content that has 3 fields: Body, PDF, SWF... and a "Selector" (List Text) that's tied via dependancy. So the user chooses BODY, PDF or SWF and that's what available to edit and shown on the page when live.

What I want to do is add a PHP field... that's either:

greyed out (unable to edit) if your not admin...
doesn't show up in the Drop Down list... Can't select it if you can't see it
Shows up on the drop down, but the field doesn't show up in the editor without permissions.

I hope I'm making sense... I can provide an example if needed.


texts: D7 Node Field: Create OG Member Checklist in Node Edit Form

texts:
I'm using Drupal 7 to create an intranet site. I'm using OG groups to create committee and department pages. I want to create a field in a "Meeting Minute" node type where a list is populated with all group members. The node author could then select whether the committee member was present or absent at a meeting.

I'm able to use an Entity Reference field to select from all users on the site, but I want to limit these checkboxes to just group members.

I'm striking out here; any ideas on where to start would be much appreciated.

Using the OG 7.x-1.x branch.

UPDATE: I have tried to use the "Entity Reference View Widget" module to accomplish this, but that doesn't seem to work either.

I'm going to try to restate this for clarity — I need a field on a node edit page that allows me to select one or more users who are also members of a group from the organic groups module.


texts: How to order a view by access control on files?

texts:
I have a view that displays a series of nodes in a blog format.  Each node has a file attached to it.  How do I make the nodes with files that the user has to login to see come last in the list?

I've been looking through the options available in Views and have come up short there.  I was hoping I could create a relationship on the file, but I can't find any properties that relate to access control.

My other thought was that I could do this in a template, but I'm not sure if there is a template that will let me change the order of the rows in the view.  Are those variables passed to the template by reference?

Many thanks.


texts: What should I use to implement a shopping cart process?

texts:
I'm developing a website for a group of human resource professionals.

The customer wants a way for people to go to their site and do the following:

If they have a job listing they want to post to the website, they'll click on a "Post a Job" link.
The job submitter will then fill out the content for a job posting
Before the job can go online, the job poster will have to pay a fee to have it posted
Once the payment is received, the job posts to the website

I'm curious if anyone has any experience with this, and if so, what would you use to build it? It's a fairly simple shopping cart experience I suppose. It's certainly not like a store or anything. But, I don't have previous experience with something like this.

Can anyone guide me down the correct path?


texts: I'm creating a text filter that modifies links. I am processing all the hrefs, and I want to load a RouteMatch or Url object for all valid urls like "/node/1". I need this to also handle i18n URLs. How do I convert a string like node/1 into a RouteMatch or Url object?


texts:
I have created form by implementing custom module. Can anybody please guide about writing submit function for my form.

function custom_form_module_form($form,&$form_state) {
  $form['name'] = array(
   '#title' => 'NAME',
   '#type' => 'textfield',
  );
  $form['company'] = array(
    '#title' => 'COMPANY',
    '#type' => 'textfield',
  );
  $form['phone'] = array(
    '#title' => 'PHONE',
    '#type' => 'textfield',
  );
  $form['email'] = array(
    '#title' => 'EMAIL',
    '#type' => 'textfield',
  );
  $form['message'] = array(
    '#title' => 'MESSAGE',
    '#type' => 'textarea',
  );
  $form['submit_button']=array(
    '#type'=>'submit',
    '#value'=>t('SEND'),
  );
  return $form;
}

UPDATED

 function custom_form_module_form_validate($form, &$form_state)
{
 if((!isset($_GET[($form_state['values']['name'])]))||
 (!isset($_GET[($form_state['values']['company'])]))||
 (!isset($_GET[($form_state['values']['phone'])]))||
 (!isset($_GET[($form_state['values']['email'])]))||
 (!isset($_GET[($form_state['values']['message'])])))
 {
  form_set_error(t('Please fill the entire form'));
 }
 $valid_email = $form_state['values']['email'];
 if (!valid_email_address($valid_email))
 {
  form_set_error('email', 'Sorry. Your email address,' . $valid_email . ', is not valid. Please submit a valid E-mail address.');
 }
 if(!($form_state['values']['company'] > 1))
 {
  form_set_error('company', t('Company does not appear to be valid.'));
 }
 if (!($form_state['values']['message'] > 2 ))
 {
  form_set_error('message', t('message does not appear to be valid.'));
 }
}

and below is my submit function. Is this right? because I am not receiving email as I specified my own email address.

function custom_form_module_form_mail($key, &$message, $params)
{
 $headers = array(
 'MIME-Version' => '1.0',
 'Content-Type' => 'text/html; charset=UTF-8;',
 'Content-Transfer-Encoding' => '8Bit',
 'X-Mailer' => 'Drupal'
  );
  foreach ($headers as $key => $value)
  {
   $message['headers'][$key] = $value;
  }
  $message['subject'] = $params['subject'];
  $message['body'] = $params['body'];
}

 function custom_form_module_form_submit($form, &$form_state)
{
  $valid_email = $form_state['values']['email'];
  $body[] = 'Email: '.$valid_email.'<br />URL: '.request_uri();
  $to = 'me@example.com';
  $params = array(
  'body' => $body,
  'subject' => 'Welcome!',
  );
  if (drupal_mail('custom_form_module_form', 'some_mail_key', $to, language_default(), $params, TRUE))
  {
    drupal_set_message('Thanks, we will be in contact with more information soon.');
  }
  else
  {
    drupal_set_message('There was an error subscribing you. Please try again later');
  }
}


texts:
I want to create Feature with a list of development modules. I want to enable this Feature only in a dev environment.

However I don't see Dependency component in Feature components list.

Do I have any alternatives in D8 for this task?

Can module dependencies only be stored in core.extention.yml only? No alternative way?

But AFAIC this seems that I need to use drush cim/cex commands to keep configuration in current state. I don't like drush cim/cex way at all.

It seems that empty module with dependencies list is the only option


texts: Clean URLs not working in Drupal 8.1.8 and IIS 8

texts:
I am working on a new installation of Drupal 8 (8.1.8) on a Windows Server 2012 running IIS 8. I have installed PHP v7.0.9 and MySQL v5.7.14. During the installation process, I must have done something wrong. Upon completion, the home page is just the HTML without any styling and all of the links return an HTTP Error 404.

The error:

I've tried as much as I can think of (eg reinstalling IIS/Drupal/PHP/MySQL, triple checking passwords for MySQL, making sure URL Rewrite is working, etc)

UPDATE: I have also tried using drush to clear the cache.

UPDATE #2: It would seem as though my HTTP problem comes from the URL Rewrite module not working properly.

UPDATE #3: The site now has styling!!!!!! After reading this post, I realized that there was no 'tmp' directory in '/sites/default/files'. However, there is still a problem with the URL Rewrite. I have to include '/index.php' in every url to go to any pages.


texts: Creating a thumbnail Navigation for a Flexslider

texts:
I want to create this:

http://flexslider.woothemes.com/thumbnail-controlnav.html

Using Flexslider.

In Flexslider's Advanced Options I see there is an option to "Use as Navigation". I've tried setting another Flexslider slidehow (full of thumbnails) as the navigation but it doesn't seem to work right.

I just need to have a main slider and a slider under it full of thumbnails that acts as a navigation menu for the main slider. How can I do this?


texts: How can I create a link to permission group and configuration page on module install page?

texts: When you install modules I can see some modules have links on the install page directly to the permission groups and the configuration page. How can I create those links for my own module?


texts: What is the best method to build a form to track N number of values?

texts:
I have to create a block that will be a gallery of users. The users to be featured will be curated by site editors. So I'm thinking the best way to track this is a pretty simple Drupal form / settings page where they just enter in the usernames they want.

However, the form should track N number of users. Is there a way in the Forms API to have an element that includes an "Add another value" or something similar, to allow for unlimited entries?

Or would it be better to just have a text area and ask the user to fill out one username per line?


texts: Change default terminal in Acquia Dev Desktop

texts:
When I click "Open Drush Console", it opens a CMD window.
I would like it to open in a "Windows Terminal" window. How can I change the default terminal?
Acquia Dev Desktop: Version 2, Built: Sep 25 2020
OS: Win10


texts: Add a region to the page--front.html.twig

texts:
I've created a few new region in my yml

regions:
      header: "Header"
      jumbotron: "Jumbotron"
      chiffres: "Chiffres"
      steps: "Etapes"
      presentation: "Presentation des formules"
      map: "Carte"
      nav: "Navbar"
      content: "Content"
      footer: "Footer"

Those regions are displayed in my backend and I can place some block inside.

I've also created a region--thename.html.twig for each one of my new regions.

I want to do this in my page--front.html.twig

    {{ page.header }}

<main class="d-flex flex-column">
    {{ page.jumbotron }}
    {{ page.chiffres }}
    {{ page.presentation }}
    {{ page.steps }}
    {{ page.map }}
</main>

{% if page.footer %}
  {{ page.footer }}
{% endif %}

But my regions are showing only if I add a block inside it.

This is my first drupal, so i may have miss  something...


texts:
I have a content type with 4 fields

1.featured_pic
2.company_logo
3.background_color

I'm using views for the teaser rewriting the result.

           {{ featured_pic }}

      {{ company_logo }}

However the background color is not being picked up. How can I use it as an inline style value.

or is it possible to pass the value {{ background_color }} to jquery


texts: Domain Access: Subdomain -> same views-path - different view?

texts:
I am a beginner by module domain-access and have a question.

standarddomain: example.com
subdomain: m.example.com

In my standarddomain i use a views-page with path example.com/myviewsgallery (Views A) - this viewspage show 50 results, has a special pager and so on.

On my subdomain I need the same path m.example.com/myviewsgallery but here I will use an other (minimized) Views (Views B) with reduced results and other pager (and so on). The mobile version is intended to display reduced content.

I would like to use a mobile-switcher that automatically redirects the mobile user to the mobile subdomain - to the same path as on the desktop version.

But the problem is, I cant use a other (reduced) View-Page on my mobile-subdomain which has the same Views-path like standardomain.

At the moment:

example.com/myviewsgallery (show Views A)
m.example.com/myviewsgallery (show Views A too, but i need Views B
under this path)

Is there anyone here who can tell me how to solve this problem?

Excuse me my bad English, I hope nevertheless that I could bring the problem understandably.

Many thanks in advance
Matthias


texts:
I'm trying to import image with new media module on core 8.5.

I've a json source and on my .yml I've:

  field_media_image:
    target_id:
      plugin: migration
      migration: immagini
      source: fid

This works, immagini is another importer that imports files.

In the new media there is also an "alt" (mandatory) and "title" attribute on the media entity.
But if I try to add something like this, it doesn't work (alt_text is the correct source for alternative text). The media is created but is not referenced to the correct id:

  field_media_image:
    alt: alt_text
    target_id:
      plugin: migration
      migration: immagini
      source: fid

How should I pass the alt attribute to this field?
I also tried to use a syntax like:

  field_media_image:
    target_id:
      plugin: migration
      migration: immagini
      source: fid
  'field_media_image/alt': alt_text

But it doesn't work, the media is created but there is no reference to the correct id.


texts: After every cron job, the Media tags in WYSIWYG markup change to https upon a robot crawl

texts:
My site doesn't use https certificates.

The Media WYSIWYG markup changes the images protocol and caches them as https and therefore they don't display as there is no certificate on the website!!

The only thing I could do is re-save the affected pages if I spot them and then it's all good until another robot crawls them again in https after a cron job, which will revert the Media WYSIWYG markup from http to https and we are back to square one.

What is the solution for this?

Can the Pathologic module solve this?


texts: How to set field permission with time limit

texts: I want to set up a customer´s private recording system, where the customer can record his private issues. This record cannot be changed after one hour. The record includes time,episode and my comments. I used "field collection" module to set up the record first, then use "edit limit" module to limit the edit time-everything works fine but I found after one hour, though the customer cannot use the "edit" tab for the whole node, he can still click a "edit" link below each field (time, episode, etc.). Is there anyway to disable the "edit" link for each field after one hour as well?


texts: Column multiplication and keep the result in separate column

texts:
I am trying to create a report where in I want to perform the column  multiplication and keep the result in separate column, say column name as "total" and finally need to calculate the sum of the total column.
So far I have tried with view calc module and searched for other option but I am stuck I am not able to achieve this! I have attached a simple report also. Can anyone help on this please?


texts: theme still use caching even when flushed cache and using devel

texts:
I am having a lot of issues with CSS editing on my site! Some colors don't change and I have tried the following to no avail:
-flush all caches
-performance - development: disabled all caching and "Aggregate and compress CSS files"
-Devel module "Rebuild the theme registry on every page load"

I also removed the .css file and my page will still load with old colors in the body background and 2 other divs!
Any help would be greatly appreciated as this is keeping me from opening up my site!


texts:
This is my form "select" field.

$form['example'] = array(
'#type'=>'select',
'#title' => 'Example',
'#options' => array('return_value1' => t('Display Value 1'), 'return_value2'   => t('Display Value 2')),
);

On submit i get in my form_state['values'].. 'Display Value 1' instead of 'return_value1'.

Does anybody have an idea why?


texts: How to display a Rules Link only if access to display the linked content was granted?

texts:
I'm using the Drupal Commerce 7.x, Rules Link, and Content Access modules.

In my site Classified ads can be created, and then people can use credits (via User points) to pay for unlocking "contact informations".

For example, when an advertiser creates an ad, 2 things happen:

content (node) of type "Classified ad" is created, and
it is cloned and converted in another content (node) of type "Classified complete".

So there will be 2 different nodes: the first one is a "Classified ad" and the second one is a "Classified complete".

The "Classified ad" is the node which has limited information and the "Classified complete" is the node which has all information. They are all linked together with the "Rules link" module.

The "Classified ad" node is displayed for everyone and the "Classified complete" node linked to it can be accessed only if a user paid for it already.

More info about my current setup as described above is included also in my related question "How to access node properties of another node using the Rules Link module?".

Now I want to further refine the display of the link shown via "Rules Link": I want to display a link rules in "Classified ad" nodes only if all these conditions are satisfied:

The current user is an authenticated user (done, as per my linked question).
The current user already bought the node "Classified complete" so the user has an access granted to that node (with the Content access module).
A page redirect to the node "Classified complete"(done, as per my linked question).

How to check if my current logged in user already has the access granted to a node id (the 2nd condition in the previous list)?


texts: Views and how to get calendar taxonomy legend

texts:
In the below image example, the person has a taxonomy legend (lower right hand corner):

How did this person get the legend?  From his blog:

  After [adding taxonomy term fields] let's hop back to our Views settings for the calendar view. Go to "Format" and Calendar Items Settings. Here we have an awesome legend feature built right in.

Um, no we don't.  So how come he has a taxonomy legend feature (i.e. vocabulary legend types) in his Views and I don't?  See below from his blog:

All I see in mine is the below:

Notice that my term field pull-down is mysteriously blank. Something whacky is going on!


texts: Getting intermittent AJAX.js error on a Commerce site when changing product variation dropdown menu

texts:
We've been trying to troubleshoot this issue for weeks now without luck and am really hoping someone here can help point us in the right direction.
We have a D8/Commerce 2 site with a **very intermittent ** issue. When changing the product variation dropdown on the add to cart form sometimes the variation does not update (the sku, photo, etc) remain on the default even though the dropdown is changed. When this issue occurs the console log shows the below error but we are unable to make sense of it.
Also, the fact that it is intermittent really make troubleshooting difficult.

JS aggregation is turned off
When the issue occurs it seems to occur
until the caches are cleared and them will eventually pop up again
No custom caching or sever caching is being used

We've removed just about every extra service and script from the product pages but the error still persists.
Any ideas what it could be? Why it is intermittent? Or any suggestions for troubleshooting steps?


texts: How to add unique class to each checkbox elements

texts:
I am displaying checkboxes using form API in Drupal 8. For functional and theming purpose I need to add unique custom class to each checkbox element. Is there any way to add classes to each checkbox elements on wrapper/label/input level?

Here is my form API for checkbox element.

  public function buildForm(array $form, FormStateInterface $form_state,
   $items = array()) {
    $tids = [5,8,7,9,3,1,45];
    $terms = Term::loadMultiple($tids);
    foreach($terms as $term) {
        $name = $term->getName();
        $options[$term->id()] = $term->getName();
    }
    $default= [5];

    $form['category_type'] = [
        '#type' => 'checkboxes',
        '#options' => $options,
        '#default_value' => $default,
        '#ajax' => [
            'callback' => '::searchCallback',
            'method' => 'replace',
            'effect' => 'fade',
        ],
    ];

    return $form;
 }

I have tried to theme through hook_prepeocess_HOOK() but its not rendering in final my custom class.

   function mytheme_preprocess_input(&$variables) {
      $element = $variables['element'];
      if (isset($element['#id']) && $element['#type'] == 'checkbox') {
        $variables['element']['#attributes']['class'][] = 'my-custom-class';
      }
    }

Any help on this will be highly appreciated. Thanks in advance


texts: Can admins create new accounts without passwords?

texts:
When an admin creates a new account (admin/people/create), they're prompted to enter a password for the account. My client wants it to be that when an account is created in the back end, the admin doesn't have to enter a password, but the user is sent a notification message with a one-time log-in link and can then set a password after logging in using that. What's the best way to achieve something like this?

I've thought of maybe altering the form to set the #default_value of the password fields to a random password and then setting '#access' => FALSE, but I'm not sure if that's the best way to go about it.


texts: Use Entityform and rules to return username to the login form

texts:
The user accounts in my site are setup as such that they have a username which is unique as well as multiple barcode spans which are also unique. The barcode spans are an unlimited amount of text fields that are added through import when the user requests more materials (in a biological study). In the past the user has been allowed to login with the barcode or the username and of course their password. In porting this to drupal, I am looking to have them input the barcode span into an entityform field and then using rules (I am guessing), return the username and autofill (if possible) the username field in the login form -- is this possible?

Originally I was trying to allow them to login with a custom id (Is it possible to login to Drupal with a custom user field, instead of username/pass?) but that goes a little over my head in implementation.

I am new to drupal stackexchange and haven't used drupal in sometime, so am open to any suggestions or best practices on how to implement.


texts: What's the best way to get the email of the author of a referenced node

texts:
I'm looking to use a combination of Mailhandler with either Rules or Notifications. When a volunteer creates a "note" (a node that references another node), I want to notify the author of the referenced node. The use case here is a volunteer helpdesk where a volunteer logs a note on a ticket, and the ticket's author receives an email.

It seems like a custom token to locate the ticket author's email would be useful in either situation. Is that the right approach? If so, are there any code samples of creating a D7 token that does something like this?


texts:
I need to migrate an ordinary D7 multi-value long text field 'body' into D8 paragraphs . As paragraphs seem to be a reference, the migration will probably be more complex than just direct field mapping. Moreover, my target paragraphs include multiple fields, not only the text body but a title as well.
Any idea or link how to accomplish this task?


texts: Why do I get a notice after migrating the site to a new server?

texts:
I am getting this error after migrating the site to a new server:

  Notice: unserialize() [function.unserialize]: Error at offset 2 of 23 bytes in includes/bootstrap.inc on line 478

I'm sure somewhere a setting has been corrupted; however, the site does appear to be functioning correctly. This error does return inconsistently, for anonymous users, so I do need to take care of it.
The error does not occur on the old server.

I have full control of the server, both the new and the old are Amazon EC2 VMs. The only major difference in the infrastructure is that the old server used a MySQL DB in the same VM, while the new server is using a MySQL Server in RBS.

I've read somewhere that this issue could be caused by the SQL export/import process, and something regarding UTF8. I wasn't able to garner anything I could mold into instructions to follow, but I have a feeling that's a path I need to take; I'm not really sure where to start.


texts:
I'm using drupal 8 and webform module (multistep). In the webform submission settings, i enabled submit several drafts which adds the 'save' button for saving the progress.
When the user logs out and logs in later on, a messsage to 'load pending draft' appears. In my settings, each user is allowed one submission. Is there a way to automatically load pending drafts without clicking on the link in the said message?

Appreciate any help given, thanks


texts: How to programmatically add a custom field to Address?

texts:
I'm using Address module, and I need to add a Boolean field "Handicap access" for all addresses, whichever country is selected.

I digged into module issues, I carefully read provided docs, where there is an example about how to : Create a custom address field by repurposing an unused one.

  What about address field X? Can I add another property to an address
  field?

  No, not without great difficulty. But you can repurpose an unused
  property for a custom one.

But there is not any boolean existing field into Address fields. Any tip to put me on the right track is welcome. Thanks !


texts: How to convert static HTML template to drupal theme

texts: Is there any tools available to convert html template to drupal theme and is there any modules that make drupal 7 theming much easier ?


texts: Complete checkout for all orders Drupal commerce

texts:
I am working with Drupal Commerce and Commerce Billy to generate invoices. My question is :

In Complete checkout process I want to edit all orders status to
"Invoiced" !! .

I already created this Rules Component and it works fine. With component I can add 1 order for me(admin) and other orders to user concerned , is that make sense.

So what I want to do is : after complete checkout process I want to change all these orders status to "invoiced"

{ "rules_add_prod_to_cart_6" : {
"LABEL" : "Add Prod to cart 6",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_cart" ],
"USES VARIABLES" : { "commerce_product" : { "label" : "Commerce Product", "type" : "commerce_product" } },
"IF" : [
  { "entity_has_field" : { "entity" : [ "commerce-product" ], "field" : "field_user_concerned" } }
],
"DO" : [
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "site:current-user" ],
        "sku" : "[commerce-product:sku]\t",
        "quantity" : "1",
        "combine" : "1"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
    }
  },
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "commerce-product:field-user-concerned" ],
        "sku" : "[commerce-product:sku]\t",
        "quantity" : "1",
        "combine" : "1"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item2" : "Added product line item 2" } }
    }
  }
]

}
}

Example :
SKU | Label | Price | User |

001 | Product 1 | $10 | Userexample1 |
002 | Product 2 | $40 | Userexample2 |
003 | Product 3 | $20 | Userexample1 |
004 | Product 4 | $70 | Userexample2 |

what I already done:

So after Clicking on "Add product and generate order" button :
In the above example I get 3 orders
the owner of the first order = [site:current-user] and it will return :
All Products (Product1,Product2,Product3,Product4)
The owner of the second order =  Userexample1 and it will contain
Product1 and Product 3
The owner of the last order = Userexample2 and it  it will contain
Product2 and product 4

So the order status of all those orders = Shopping cart (because we didn't complete the checkout yet), and when we complete the checkout it will change ONLY the FIRST ORDER status to "Invoiced", because [site:current-user] is the owner of it.

I want to change all the above orders status when "Complete checkout process" event is fired !

Please see images below:

After Clicking on "Add products to cart and generate orders"

"New 3 orders"

Complete checkout process

First order status = Invoiced , BUT THE TWO OTHERS DOSEN'T CHANGE

Is that possible ? How could I do that using Rules Module ?


texts:
How do you pass an argument from a menu to an existing node? I've read many articles on hook_menu but they seem to all talk about creating a page which references the arguments.

for example:

function myModule_menu(){
  $items['node/123/%'] = array(
    'page arguments' => array(1),
    'access callback' => TRUE,
  );
  return $items;

In my Navigation menu, I'd want to use a menu item with: node/123/option1

How would I get the argument 'option1' available to me in for example, the node.tpl.php file to manipulate the rendering of node/123 ?

At the end of the day, I'm trying to do is execute some jquery code based on a menu's argument, but the initial hurdle, how do I get access to these optional arguments on the url?


texts: Entity reference multi level links in Views

texts:
I have 3 content types Speaker, Sub-category and Category.

On the Category detail page i would like to put a block-view with a contextual filter to show Speakers linked to that specific Category, but there is no direct reference link between those 2.

There are only 2 reference fields:
 - Speaker -> Sub-category
 - Sub-category -> Category

Is it possible (trough views UI?) to make this 2-step connection?

Thanks


texts:
How do I check if the page I'm viewing is a Views page? I want the breadcrumbs to be hidden if the user is viewing the view page I made, which I named "Products."

I am using Drupal 7 and Views 7.x-3.0-beta3.


texts: feed drupal 8 custom block with json decode content

texts:
i have created a block and try to feed it with WS request

function amu_news_preprocess_block(&$variables)
 {

  if ($variables['elements']['#configuration']['id'] == 'amu_news_block') {
    $client = new \GuzzleHttp\Client();
    $url = 'mywebserviceretrievingjson.org';
    $response = $client->request('GET', $url);

    //this display json:
    $content = $response->getBody()->getContents();
    // this generate server error although $content contains array of nodes as expected:
    //    $content=json_decode($response->getBody()->getContents(),true);

    $variables['elements']['content'] = $content;
    //why do i need to do that next line ? i dunno but this makes json content display on my twig template:
    $variables['content'] = $variables['elements']['content'];
}
}

i am trying to display feeds as array or object


texts: Want to change Currency with Language on language change

texts:
I am new in Drupal 7.

I am working on drupal commerce module. I want to built a site for multi-language and also for multi currency. I am using i18n and Commerce multi currency module as they gave me language selector block and currency selector block and both functionality working fine individually.

But I want to change both Language and Currency on language select, like if I select English language currency will automatically change to USD and if I select Denmark language currency will automatically change to DKK and so on.

So is there any possibility to change the relevant currency with language change on Language select?

Please help.


texts: How to list all taxonomy terms in a vocabulary followed by associated node titles in Views

texts:
I am trying to list all of the taxonomy terms from a vocabulary in views and have the node title of all of the nodes that have that term associated with them listed under each term. For example, I have a vocabulary of State names. The various nodes have a term reference field to link the node with a state. I then want to create a view that will show the state name followed by the nodes with that state name, then the next state name etc. I can create a taxonomy view that lists all of the state names, but can't find a way to add the node titles under each state name. I am converting an existing non-Drupal site to Drupal 7.

Here is a link to the current page that I want to make happen in Drupal. It shows the states following by what would be the node titles for each state.

http://www.cbfisk.com/do/DisplayInstrumentList/filter/geographic

Thank you for any help.


texts:
I'm extending core Classy theme so I have included my JavaScript code in theme.libraries.yml file like this:

js:
  js/blogger-list.js: {}
dependencies:
  - core/jquery

but still browser console shows error: jQuery is not defined

blogger-list.js is really simple:

(function ($) {
  $(".views-col a").hover(function() {
    $(this).css('background','red');
  });
})(jQuery);

I'm using Drupal 8

What do I need to do?


texts: How to load login, register and other forms and nodes in modal window?

texts:
I am seeking a module or technique to show forms (for example login form, register form etc.) and nodes in a modal window/pop up.

I found some modules that promise to do that, but none of them seems good for my use case:

Ajax Login/Register It does not work with programmatically created login link, I followed this post, without any success.
Modal forms (with ctools) Is seeking maintainer, so who knows whether or not development will be continued?
Colorbox Node Cant get it working for login, register pages/forms

What is the best way to have this feature. I would prefer a solution that is easily extendible to load nodes or other entities as well within a modal window.

What is the Drupal 7 way to do that?


texts: drupal course module adding payment object

texts:
Please Somebody help me. I have spent almost a week working on this functionality but haven't got any success yet.
I have a Learning management system in drupal7 using the course 7.1 beta2 module, the LMS has courses in it. The requirement is to have the user buy the courses in-order to take the course but I am not able to configure it. Please can any body show me a way on how to configure the payment object so that the user will have to buy before even starting the course. I need a step-wise solution on this

Thanks in advance


texts: What is the difference between $container->get('current_user') and global $user?

texts:
I've been looking at symfony's implementation of dependency injection, and it seems like a service locator pattern.

It appears, at first blush, that the service container is not entirely different from a global namespace, and that any of the objects located within could be requested and modified in unexpected ways by some other module.  It seems like symfony has built in a way around these Action at a distance anti patterns by setting Scopes on the container, (addScope, enterScope, leaveScope), but I only see one example of addScope in CoreServiceProvider.php with a 'request' namespace.

Should module developers be encouraged to scope their interaction with the container if they plan on modifying services?


texts: Configuration Manager or hook_update() to enable modules

texts:
In Drupal 7, if we wanted to push code to our environments enabling modules, we would call module_enable() in hook_update_N(). We no longer have that in Drupal 8, so how do we programmatically enable modules? Do we use Drupal 8's Configuration Manager or hook_update_N()?

A diff on the exported configuration yields this:

+++ b/cim/sync/core.extension.yml
@@ -10,6 +10,9 @@ module:
   config: 0
   contact: 0
   contextual: 0
+  ctools: 0

So it seems the module is enabled via code using Configuration Manager.
We're also working with the idea of this:

function mymodule_update_8003() {
  $modules = array(
    'ctools',
  );
  \Drupal::service('module_installer')->install($modules);
}

What is the correct method?


texts: Exposed Filters View is not functional with Anonymous Users

texts:
I created a Filtering Search with Multiple Exposed Filters. It all has been working fine except one thing; when I logout as an admin and use the site as an anonymous user, exposed filters don't work.

The screenshot of my exposed filters form is below:-

In a functional scenario, When I click on any value, let's say EMEA, the form auto-sumbits and show hierarchical values in all the below filters and show the data on the right side.

As an example, When I click EMEA, the form auto-submits, and all the offices from EMEA appear in the lower filter of Filter by Office and results are shown.

The problem is that all the filters, data and values are shown for anonymous users but not auto-submitting takes place. It seems it just refreshes the page when I click on any filter.

Any idea?

Best.

P.S

I used two modules within it:-

Better Exposed Filters (for making filters more readable)
Views Hacks (to use Views Selective Exposed Filters for showing hierarchy within Filters)


texts: Programmatically create a new node from an existing NID

texts:
Essentially I want to take a node and duplicate it. Take a node ID and programmatically create a copy of the node.
I want to be able to edit the newly created node, and maintain the data on the old node.


texts: How to programmatically alter feed item values before saving

texts:
Feeds Tamper does this job, which allows me to "tamper" with feed items' values before saving it to an entity.

My question is how can I do that programmatically in Drupal 8 with a custom module.


texts: List of all active modules used in a site

texts:
Is there a way of having a list of all the used (active) modules on a site ?

I am in the process of documenting a site and would like to list all the active modules, I know I can take them from admin/modules but there must be another way.


texts: Create short link automatically with ShURLy

texts:
I am using the ShURLy module to create short links for nodes. I would like to be able to create the short links when nodes are published, automatically, without having to do the extra steps of clicking on the Bookmarklet which opens a new page where I create the short link by clicking on a button/link.

How can I achieve this?

update

I am using workbench so I added

function my_node_workbench_moderation_transition($node,
$previous_state, $new_state) {
// Generate the short link when it is published.
  if ($new_state == 'published' && $previous_state != $new_state) {
    $link = my_node_create_short_link($node->nid);
  }
}

and the function my_node_create_short_link with shorten (shorten_url)

function my_node_create_short_link($node_id) {
 // Do not create the short link if already exists.
  $link = my_node_short_link_get($node_id);
  if ($link) {
      return $link;
  }
  else {
    $link = shorten_url(url('node/' . $node->nid, array('absolute' => TRUE)));
    // Insert the link
    my_node_short_link_insert($node->nid;, $link);
    cache_set($node->nid;, $link);
    return $link;
  }

}


texts:
This is odd, I have a custom module I've had installed on a site for a while. I recently went to write an update hook for it and saw that Drush was not picking up the update I wrote.

After some investigation I see that there's no entry for the module in the system.schema collection in the key_value table. It appears this data is used to track which updates have been run for which modules.

Uninstalling and re-reinstalling the module restores the data.

Anyone know what could have caused this missing entry?

I have a bunch of hooks defined in the .module file and they all run fine. It's just that this record is missing.


texts:
I am trying to enable clean URL in a Drupal 7 website. The clean URL is supported by server, as I can see the checkbox to enable it, but after enabling it, I am able to access only the front page of the website. For other pages, I get a 404 error. I can see the page just by putting /?q= after the website address.

How can I resolve this issue?


texts:
I have a multi-site setup where 3 different sites share the same codebase.  All of the modules are in the all/modules folder so they all have the exact same modules.  I want to update the modules and core for the codebase with drush but I can't find a way to do it.

There is no settings.php file in sites/default so drush is throwing an error.  Do I need to just create a dummy database so drush can connect and update the modules? Obviously I will have to run update.php on the sites after the updates are made.

The databases are separated, they just share modules and core.


texts: Ensure registered users can publish nodes only after paying some money

texts:
Is there a way to charge registered users who publish a node in a Drupal 8 site?

If I'm not wrong, the pricing process should be easier as Web services are now part of the core in Drupal 8.

Pricing should be through Paypal.


texts: How do I get the term name in a custom submit handler?

texts:
In Drupal 8/9, when you create a new term, the default status message is:

Created new term %term.

%term contains the term name, which is linked to the term page.
I want to override this and remove the link (I want to show the term name, but I do not want to link the term name to the term page).
I thought I could do this in a custom submit handler:
function MYMODULE_term_create_form_submit(array &$form, FormStateInterface &$form_state) {
  \Drupal::messenger()->deleteByType('status');
  \Drupal::messenger()->addMessage(t('The group @group-name has been added.', ['@group-name' => NULL]));
}

However, I don't know how to get the term's name from $form.  I searched the $form object with kint() and I could not find the form name.
Then I looked at core, which does this:
  public function save(array $form, FormStateInterface $form_state) {
    $term = $this->entity;

    $result = $term->save();

    $edit_link = $term->toLink($this->t('Edit'), 'edit-form')->toString();
    $view_link = $term->toLink()->toString();
    switch ($result) {
      case SAVED_NEW:
        $this->messenger()->addStatus($this->t('Created new term %term.', ['%term' => $view_link]));
        $this->logger('taxonomy')->notice('Created new term %term.', ['%term' => $term->getName(), 'link' => $edit_link]);
        break;

But, I don't have access to the term object in the submit handler.
What's the simplest way to do this without doing a quick-and-dirty patch to core?


texts:
This is another question that I am sure is very simple. I've been working through tutorials on setting up a Drupal site from scratch with the Zen Theme. I have my Sub-Theme working just fine, thanks to https://drupal.org/node/1549668 and http://drupalonlinetraining.com/youtube/linwclark/drupal-7-basic-theming-zen-and-css

Now, I want to edit the CSS. Unfortunately, the documentation that I can find references 25 separate stylesheets (including both of these tutorials and this page.) The version I have, however, has far fewer sheets than that (13 according to the ReadMe).

I did find the ReadMe that describes the new stylesheets, but as this is my first foray into CSS within Drupal, I'm still a little unsure as to where I should start to add styles. Is it in normalize.css? Is this where I would add, for instance, a background image?

Thanks for any help, and/or for pointing me to a tutorial that breaks it down for the latest version of the Zen Theme!


texts: I have a module which is misbehaving. An EFQ is returing unexpected results, but I can't see why just by looking at the code. Is there a dpq() equivalent for EFQs? Other ways of debugging them?


texts: I have been implemented Facebook style micro publsher in my project and now i can post text/media as like Facebook while updating status. Now i need to create a view that contains all posts from every user in a single page . How can i create a view like that ?


texts:
I have used a custom html link More search results   to link to the homepage.
When clicking the link,I am taken to this urlhttp://localhost/homepage instead of the correct one localhost/cars/homepage
What am I doing wrong?
thanks


texts: How to add a checkbox in checkout form to optionally add 5$ to the product price as a donation?

texts:
I have a Drupal site using the Drupal Commerce module.

I want to add a checkbox to the checkout form, some thing like this

    = Donate by 5$

If it is checked, then "5$" will added to the selected product price.

Any suggestions?


texts: How do I set up the active primary menu based on taxonomy?

texts:
I have set up a blog using a custom Article content type and a page View with a row style of fields.

I have set up taxonomy terms to label my Article content types as I make them. In my View I have a field for Taxonomy: All Terms, with "Link this field to its term page" checked on. This gives me a listing of the term links displayed for each Article posting. Each of these links go to a page displaying all of the Article(blog) postings labeled with each specific term. (For example I have a term of "Art", and have labeled multiple postings with this. When I click on the term "Art" on any posting this brings be to a page that shows all of the postings labeled with "Art".)

I have the same active Primary Menu "Blog" for my blog page and the Article pages, by using the URL Aliases and Menu Trails modules. The paths that give me an active menu are "sitename/blog", "sitename/blog/article-name", etc. (I tried using the Context module to do this but it didn't work.)

My issue is that I can't figure out what combination of settings I need to give me an active "Blog" primary menu for the Taxonomy term page views of the Article/blog postings. I've tried various settings in Menu Trails, and auto URL aliases, and even tried manually setting the URL alias (to "blog/art", for example) but I can't generate an active primary menu for these taxonomy term pages.


texts: Composer: require dev branch then go back to stable once current dev is stable

texts:
Let's say you need a patch in a Drupal module (or core) only included in the dev version yet.

It's already commited and should normaly be included in the next stable release.

So I'd like composer to grab the dev version for now but switch back to stable as soon as the next release is out.

If I do this for ex.:

composer require drupal/bootstrap:3.x-dev

It'll continue to update to the dev version even after the patch I need is included to stable, wich I'd like to avoid...

Is there a way to achive this ?

For ex. a way to tell composer "I want a version of this module that has to include that commit be it dev or stable, but I'd prefere stable if available".

So I can patch my module and forget about it.


texts: Check if logo, sitename, slogan, and secondary links exist

texts:
How do you check if logo/sitename/slogan & secondary links are enabled from within a function? (outside of preprocess_page)

This seems to work for logo:

$logo = theme_get_setting('logo');
if (empty($logo)) {
...
}

but this doesn't for secondary links:

$secondary_links = theme_get_setting('toggle_secondary_links');
if (empty($secondary_link)) {
...
}


texts: I would like to allow moderator to send an e-mail to choosen user. The e-mail will be sent when the moderator observes a mistake made by the user. After that, moderator sends email with warning. How can I do it?


texts: Hyphens or underscores when referencing a path alias in Drupal 7 templates?

texts:
I have a hyphenated path alias in my site and I need to reference it in a template hook, but it seems hyphens get converted to underscores in templates, so I'm wondering how I would go about outputting the code correctly.

My function is something along the lines of if my path alias is "change-directory" then use the "page__change-directory" template. So my question is, would it be "change-directory" or "change_directory" in my template?


texts:
My customer is using the "smokers" theme with Drupal 6.

Now we are observing a very strange behavior:

The menu bar that used to be on left side on the screen "disappeared", or more correct it is still existing on the left but out of the visible range.
After switching my page into maintanence mode and setting "Rebuild theme registry on every page." as it is stated in the upgrading information for the smokers theme all buttons have disappeared. They are invisible and it seems that I even cannot find the in the html source that is displayed in my browser.

So how can I fix these probs? Switching to a different theme could do the trick but this is not possible without buttons. drush is not installed on my server.

Can anybody help?

Cheers

Chris


texts:
I am trying to make a sub theme based on Bootstrap 3 Drupal theme.

I want to add a modal markup in every page. I can see in the base Bootstrap theme template files, there is a file called modal.tpl.php with corresponding HTML markup but I do not know how to include it into my page. Anyone can help?


texts: Drupal schema API not supporting MySQL date data type?

texts:
I am getting this error with my existing database:

  no Schema type for mysql type date.

I did some research and it seems like schema does not support date type in MySQL.  What would you guys suggest I replace it with?  I'm presenting income statements and balance sheets on my site and I need to have some sort of date reference of each row(otherwise I wouldn't be able to figure out 2009 earnings versus 1999).

What other options are available?


texts: Moving content fields to different theme regions with display suite

texts: I am trying to output node fields in different theme regions, particularly a node reference field into my theme's right sidebar region. I have read this is possible with display suite and display suite extra modules, but I only see display suite regions (left, right...) and doesn't seem to be aware of my theme regions. How can I accomplish this?


texts: How to send an SMS message when a Webform is submitted?

texts:
I am trying to have an SMS message sent when a form is submitted. The form is a quote request and I would like to send a simple message to my phone to alert me.

I have installed the SMS Framework module and the Clickatell module. I have set up an account on Clickatell and have the necessary username, password, and api id.

I can send a message by pasting the url in my browser using the example on the Clickatell site but I don't know how to send a message when the quote request form is submitted.


texts:
I am new on Drupal. I have a csv where I want to upload on a drupal site every week.

I tried to follow this tutorial enter link description here but "Data Processor" doesn't show. I have installed all the modules and clear the cache.

Any suggestions?


texts: default value when adding new item of date field

texts:
i'm using drupal 7 and in my content type there is a date field has start and end value with unlimited values, i set the default value to "Now".
but the problem is when adding new item of this field there is no default value in it.

is there a way to set a default value for new items?
thanks a lot.


texts: How do I exclude a node from an entity reference field?

texts:
I have a homepage content type which has a featured_article field, an entity reference field that allows the editor to choose a single node from the Article nodes. That node is displayed as Featured article on the homepage.

Together the featured article on the homepage, I'm rendering a view (block) that displays the latest articles. I would like to avoid the node selected as featured article doesn't appear in the view. How can I achieve this?

This is my first Drupal project (coming from Craft and ExpressionEngine), and I'm struggling to figure out how to properly configure the view. I expect that I need to use a contextual filter together with a relationship, but I haven't had any luck. I could probably work in a conditional in the Twig template, but I'd prefer to keep the logic in the view if at all possible.


texts:
Few months ago I've tried to uninstall drush 6 in order to put drush 8 instead (for D6 to D8 migration purposes). I absolutely don't know why, but it's been impossible to install drush 8 on my site, whatever the method used (either directly or via composer).

More precisely, at first glance it seemed that drush 8.1 had been properly installed, but a "drush status" command displayed curiously "version 8.0.3 installed", and no drupal site has been recognised when trying to use drush 8 in the drupal directories.

I precise that I'm hosted on a managed VPS with PHP 5.5 installed and that drush 6.7 worked perfectly well.

Here are the details while using composer at the time I tried to do it (no improvement since):

[~]# composer global require drush/drush:8.*

Changed current directory to /home/user/.composer

./composer.json has been created

Loading composer repositories with package information

Updating dependencies (including require-dev)

  - Installing pear/console_table (v1.3.0)
    Downloading: 100%

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Downloading: 100%

  - Installing symfony/console (v2.8.6)
    Downloading: 100%

  - Installing symfony/var-dumper (v2.8.6)
    Downloading: 100%

  - Installing symfony/yaml (v2.8.6)
    Downloading: 100%

  - Installing jakub-onderka/php-console-color (0.1)
    Downloading: 100%

  - Installing jakub-onderka/php-console-highlighter (v0.3.2)
    Downloading: 100%

  - Installing dnoegel/php-xdg-base-dir (0.1)
    Downloading: 100%

  - Installing nikic/php-parser (v2.1.0)
    Downloading: 100%

  - Installing psy/psysh (v0.7.2)
    Downloading: 100%

  - Installing psr/log (1.0.0)
    Downloading: 100%

  - Installing drush/drush (8.1.2)
    Downloading: 100%

pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)

symfony/console suggests installing symfony/event-dispatcher ()

symfony/console suggests installing symfony/process ()

symfony/var-dumper suggests installing ext-symfony_debug ()

psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))

psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)

psy/psysh suggests installing ext-readline (Enables support for arrow-key history navigation, and showing and manipulating command history.)

psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)

drush/drush suggests installing ext-pcntl (*)

drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)

Writing lock file

Generating autoload files

[~]# drush status

 PHP executable         :  /usr/bin/php-cli

 PHP configuration      :  /usr/local/lib/php.ini

 PHP OS                 :  Linux

 Drush script           :  /home/user/vendor/drush/drush/drush.php

 Drush version          :  8.0.3

 Drush temp directory   :  /tmp

 Drush configuration    :

 Drush alias files      :

 /home/user/.drush/en.aliases.drushrc.php

 /home/user/.drush/fr.aliases.drushrc.php

 /home/user/.drush/es.aliases.drushrc.php

[~]# drush version

 Drush Version   :  8.0.3

[~]# cd public_html/en/sites/en.mysite.com/

[~/public_html/en/sites/en.mysite.com]# drush cc all

No Drupal site found, only 'drush' cache was cleared.                [warning]

[~/public_html/en/sites/en.mysite.com]# drush ups

Command pm-updatestatus needs a higher bootstrap level to run - you  [error]
will need to invoke drush from a more functional Drupal environment
to run this command.

The drush command 'ups' could not be executed.                       [error]


texts: Making a block to show the status of the user account?

texts: How do I use a Views block (or other means) to show the status of the user account, specifically awaiting approval, approved, and not approved ?


texts: Is there a way to programatically create a commerce coupon fixed amount?

texts:
I'm using the Commerce Coupon Fixed Amount module to create fixed coupons, which works fine in the interface.  But I'm wondering if there is a way to programmatically create them.
I'm able to create normal commerce coupons with this helpful snippet of code.


texts: How to assign "Edit" permission per Webform?

texts: On Drupal 7, how can I assign the "Edit" permission per webform, beside using "Permissions per Webform"?


texts: Creating view content link that links to data based on taxonomy terms

texts:
how can I create view content link that links to data based on taxonomy terms?

I have stores in stores page...stores are in views..each store should have a link that links to its products.


texts: Pass a value from a block preprocess hook to a twig template that inserts that block

texts:
I use the D8 book module to manage magazines and their articles.

In the node--magazine.html.twig template for a magazine, I use the built-in book_navigation block to add a table of contents. This is done by drupal_block("book_navigation", {block_mode: "book pages"}). Works fine.

For certain "featured" articles in the table of contents, I want to display an image. I use MYTHEME_preprocess_book_tree(&$variables) to add the image url to the items array in $variables. I've sub-themed book-tree-html.twig to get the image url from the items array and include the image in the table of contents. Works fine.

BUT, I need to know in node--magazine.html.twig whether there are any featured articles in the table of contents to present a proper heading on the page.

QUESTION: What is the best way to pass a variable from THEME_preprocess_book_tree() to node--magazine.html.twig? It's not a direct connection. Getting preprocess variables in book-tree.html.twig is easy, but I need to pass a variable through to node--magazine.html.twig, where the book tree is inserted.

What I have tried:

In the book-tree.html.twig template, if there is a featured article, I add a hidden "featured-article" label to the html and then in the magazine template, I test for its presence via {% if "featured-article" in <rendered block html> %}. This works, but it feels unsavory.
In MYTHEME_preprocess_book_tree(), I add $variables['featured'] = $feature_count; and in the magazine template I {{ dump(featured) }}. This doesn't work. I just get NULL. I'm not sure what--if any--connection there is between the $variables array available in the preprocess hook and variables available in the magazine template.
In MYTHEME_preprocess_book_tree(), I could set a global variable and then in the magazine template, call a custom twig extension to check the value of that variable. I haven't tried this yet, but it seems like this should work. Just seems like there should be a more elegant way.


texts: Include Drupal modules inside composer.json file

texts:
I am doing a custom code of OpenSocial template/site.

In OpenSocial or other composer file, there are some modules that are added in the "require": {} section and they are installed properly when running the file.

Ex.

   "drupal/entity": "1.0-alpha4",
   "drupal/features": "3.5",

My question is how can I install module that requires to run composer for it to be properly working?

My goal is to include Simple Oauth in the composer file.
I can just do this, but is there any additional input outside the file?

"drupal/simple_oauth": "2.0-rc1",

Also I noticed that when adding the Address module in the require section, there is some lines added here, for example.

I am new to this method and I really appreciate your help! Thanks!


texts: How do I display my custom menu in administrative menu?

texts:
In my D7 website, I want to display my own custom menu in administrative menu (as in Dashboard, Content, etc.,).

I want those custom menu's available only for particular roles. How can I achieve this functionality without lot of code?


texts: I saw that Drupal 7 includes some kind of testing framework (I haven't tried it out yet since my existing sites are still in Drupal 6 and likely won't migrate any time soon). How can you write automated testing for a Drupal 6 site, is there a module for this? How much can actually be tested automatically rather than requiring manual testing?


texts: I want to look at the MySQL query built by Views. In views 2 it just shows while I can't seem to find it in the View 3 UI. Is it still available?


texts: Can't find my website page listed under admin/structure/pages

texts:
Driving me crazy!
I have a website page: http://www.randymtrader.com/contact that I cannot find anywhere in drupal admin/structure/pages. There is nothing with the path /contact. Where else could it be listed? I need to edit the page.  Any ideas?

Thank you!


texts:
I need a requirement like this. In my site, there will be 2 types of user role.

1) Role A
2) Role B

Role A users can able to create the new users and assign them a Role B. I want to provide the access among the Role A users.

Let say User 1 of Role A created 3 users of Role B and User 2 of Role A created another 2 users of Role B.

I need to provide access to Role A users like the users who have been created by User 1 of Role A cannot be accessible or editable for User 2 of Role A and vice versa.

Is there any custom module to achieve this or we need to go for custom implementation?


texts: Drush Site Install does not populate table prefix

texts:
sudo drush site-install standard -y --db-prefix='alaska_' --db-su='postgres'
--db-url=pgsql://drupaldbuser:password@localhost:5432/drupal
--account-name='admin' --account-pass='admin' --site-name='alaska'
--sites-subdir='alaska.jobcorps.gov'

This command does not populate the database with tables that have the table prefix.  This prevents us from installing Drupal 8 multi-site on a single database using Drush.

I've tried renaming the tables and then proceeding with the next sub-site install.  This fails because drush drops all tables when it runs subsequent installs on the same database.

I've also tried

install_settings_form.pgsql_prefix='alaska_'

Tried multiple versions of Drush.  Currently on 9.0-dev to see if that has a fix in it.


texts:
I have a site which needs to be responsive to several devices (mobiles and tablets)

I will do this using the Omega theme. Then I have the option to make the theme Responsive. In this way the general layout of the site changes based in the size of the screen device.

So far so good.

I need to change this behavior in this way: if the device is capable of scaling and showing the site in an acceptable way (ex: like the iPhone(iOS) and Galaxy S2(Android) do) then the theme should no behave like responsive and show the site in its normal layout.

My question: Can I make the Omega theme to either be or not to be responsive depending on the capability of the device to properly scale the site?


texts:
I am using jQuery Ajax Load module in my site to load some contents from url to show on specific div which has a required class. With this module I am able to fetch the Page content from URL through ajax & displays on specific block. I need to replace the blocks when click on the link. for-example I have a block A displayed on content area, also I have block B & C which are hidden for now. when I click on link B the block A should be replaced with block B & so on using AJAX.
Please help me?
Thanks


texts:
I'm wondering if there is a simple way to link the whole view item output without modifying the template files. It is easy to link some fields to the node but I would like the whole view output to work as a link. Any suggestions?

Thank you very much.


texts: Export block that exists in two or more regions

texts:
Does anyone know how to export block that exists in two or more regions into yaml file?

This is the scenario I'm facing. A 'sitebranding' block is placed onto header and footer regions. When I go to admin/config/development/configuration/single/export I can find proper configuration, however when the code is being generated I can see there is a region property and the value is 'header' although in Drupal UI it's placed in footer and header. Is there a was to include both of regions for particular block?