texts: Fusion Starter Theme does not provide option to disable grid overlay for administrator on home page

texts:
Enabling the option to display a grid overlay using a subtheme of Fusion Core under Menu > Administration > Appearance > Settings does what it is supposed to, however, does not give me the option (i.e. button) to turn the grid off on the home page. To turn the grid off, I have to go back into the Administrator Settings page of the subtheme and uncheck the option to enable the grid overlay for administrators. Also, I am unable to enable/disable the Labels tag that appears on the top or bottom right corner of the home page.

My configuration is as follows:

Drupal 7.30
Fusion Core 7.x-2.0-beta2
Fusion Core Starter subtheme (the .info and .css files of which I have renamed according to my own subtheme)
Fusion Accelerator 7.x-2.0-beta1
Chaos Tools 7.x-1.4
Localization Update 7.x-1.0
Advanced Help 7.x-1.1
Libraries 7.x-2.2
Localization Map 7.x-2.3
Skinr 7.x-2.0
Skinr UI 7.x-2.0
jQuery Update 7.x-2.4
Superfish 7.x-1.9

What is really baffling is that I have configured another Drupal site with almost the same themes and modules (except for jQuery, Superfish and Localization Update). I have no issues enabling/disabling the grid overlay nor the labels on the home page. The label to enable/disable the grid overlay for this site appears on the top right of the home page.


texts:
I have just installed Drupal 8 development version (drupal-8.0.x-dev) but while running it on my web server I am getting this error:

Parse error: syntax error, unexpected '[', expecting ')' in C:\xampp\htdocs\drupal-8\core\vendor\react\promise\src\functions.php on line 62

Line 62 has code:

59   return resolve($promisesOrValues)
60          ->then(function ($array) use ($howMany) {
61              if (!is_array($array) || !$array || $howMany < 1) {
62                  return resolve([]);
63              }

My PHP version is 5.3.8

Is there anybody else who has faced same issue?


texts:
In D6, I have a custom module that I've developed. It has a view.

I've made some changes to the view in the module code, and I wanted those changes to go live on the site. I've clear the cache, but I don't see my changes.  What should I do,  disable, revert, delete?


texts: Problem with Ubercart post upgrading jQuery to 6.x-2.0-alpha1

texts:
I have Mucho menu module installed and it dose not support jQuery 1.5 on D6, So I updated the jQuery module to latest 6.x-2.0-alpha1. Post upgrading the muchomenu works, but ubercart payment process stopped working... i see a progress bar loading and never stops on checkout page.

How to make both the modules work? could someone please point me to the correct path?

Thanks,
Anand


texts: I have created a custom region regions['my_region'] in mytheme.info file. I have added a block myblock to the region. Now how can I add contents to this block? Currently I have created a template file region--my_region.tpl.php and added contents there. Is this the right way? How can a normal user will be able to edit these contents?


texts: Why do I get Template "@bartik/block" is not defined?

texts:
So I've created a small subtheme called bartik_graphql. It just overrides the 'Powered by Drupal' block. Besides it's bartik_graphql.info.yml file it has a templates directory containing one file block--bartik-graphql-powered.html.twig.

Contents of block--bartik-graphql-powered.html.twig:

{#graphql
query {
  admin:userById(id: "1") {
    name
  }
}
#}

{% extends "@bartik/block" %}

{% block content %}
  <div{{ content_attributes.addClass('content') }}>
    {{ content }} and some guy named {{ graphql.data.admin.name }}
  </div>
{% endblock %}

I've enabled my subtheme and set it to default. However I receive the following error:

  Twig\Error\LoaderError: Template "@bartik/block" is not defined. in
  Twig\Loader\ChainLoader->getCacheKey() (line 122 of
  web/core/themes/bartik/templates/page.html.twig).

What I expect to happen is have my subtheme's template override what is used by default to display the 'Powered by Drupal' message.

Drupal: 8.7.8
PHP: 7.2.17

Am I using extends wrong here?


texts: How do I remove a DIV from the rendered result of a BEF exposed form?

texts:
I'm using Bootstrap as my theme and Better Exposed Filters to generate check boxes for term filters that are exposed to my visitors/users.  Unfortunately, Bootstrap adds a "form-group" class to all elements of a form that aren't radio buttons and/or check boxes.  BEF (or something) adds a DIV around each of the check boxes and thus Bootstrap adds the form-group class and that messes with the formatting of the check boxes.

So it looks like:

 <input type="checkbox" name="field_list_crit_tags_tid[]" id="edit-field-list-crit-tags-tid-591" value="591"  multiple="multiple" class="form-control" /> WAAC

I need to remove either the DIV entirely or figure out a way to NOT put the form-group class on that particular div.


texts:
I have an online store using commerce and rules, with products that can be bought in different quantities.  Commerce stores the line-items in an order as a list, but it stores the quantity-per-line-item as a flat number.

I have a rule that needs to fire once for each tangible product- ie. number of line-items x quantity.

Rules can loop over lists, but I don't have a way of representing the quantity as a list.  Is there a way to loop using just a number?  Is there a way to turn a raw number into a list Rules can loop over?


texts:
I am new to Drupal, and I am trying to write a module with an .install file which will create a database table. The table isn't being created (as seen from the error codes when I try to access it. It also doesn't show up in the Schema module listing) and I don't know what I did wrong. Can someone see if they can find the error?

This is the code:

function email_form_schema() {
  $schema['subscription_info'] = array(
    'description' => t('The base table for nodes.'),
    'fields' => array(
      'first' => array(
        'description' => t('The first name'),
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => '',
      ),
      'last' => array(
        'description' => t('The last name'),
        'type' => 'varchar',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => '',
      ),
      'email' => array(
        'description' => t('The email address'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => ''
      ),
      'phone' => array(
        'description' => t('The phone number.'),
        'type' => 'varchar',
        'length' => 10,
        'not null' => TRUE,
        'default' => '',
      )
     ),
    'primary key' => array('email'),
  );

  return $schema;
}

function email_form_install() {
  // Create my tables.
  drupal_install_schema('email_form');
}

function email_form_uninstall() {
  // Drop my tables.
  drupal_uninstall_schema('email_form');
}

Here's the error when I try to access it:

  user warning: Table 'drupal620x120318224310.subscription_info' doesn't exist query: INSERT INTO subscription_info (first, last, email, phone) VALUES ('','','','') in C:\EasyPHP-5.3.8.1\modules\drupal620x120318224310\sites\all\modules\email_form\email_form.module on line 123.

I was missing the return $schema; line (which I modified above), but it still doesn't work. In the schema module it lists the "subscription_info" table as missing. What does this mean?


texts: How do I customize the date-submit part in comment section?

texts:
I am formatting the Date/Submit part of the comment. By default when we post any comment, it comes in the format of,
Submitted by author-name on Sun, 06/12/2016 - 20:34. I am using Adaptive theme.

I would like to change (1) date part in the ago format, like

1 minute ago

24 minutes ago

an hour ago

2 hours ago

1 day ago

20 days ago

1 month ago

1 year ago

etc...

AND the (2) Sentence part as described below,

From Submitted by author-name on Sun, 06/12/2016 - 20:34 To
author-name ------- ago

Now, Sentence part I did achieve as described below,

I did some change in comment.tpl.php as shown below

From->

<?php if ($picture || $submitted): ?>
<footer<?php print $footer_attributes; ?>>
  <?php print $picture; ?>

<?php print $submitted; ?>

To->

<?php if ($picture || $submitted): ?>
<footer<?php print $footer_attributes; ?>>
  <?php print $picture; ?>
  <?php print $author; ?>

<?php print $created; ?>

So, by doing this, I can add author-name separately and date separately, so this will allow me to format the sentence the way I want

Hence now, I am getting,

author-name Sun, 06/12/2016 - 20:34

Now, how can I change the date part. Thanks


texts: Create donation product with Commerce Kickstart

texts:
I've installed a fresh copy of Commerce Kickstart 2 and then installed Commerce Donate.

After the installation, step 1 of the Commerce Donate readme says:

Create a donation product at Administration » Store » Products

I go /node/add/add-product and choose the type Donation. When creating the product there is a select field called product with no options.

It seems like I'm creating the display node not the actual product.

How do I create the actual product?

EDIT: Just found the same question on the Commerce Donate issue queue: Problem Creating Donation Product.


texts:
I'm currently using Drush Make to pull custom modules, installation profile, and various other modules/libraries when I provision a new Drupal site.

What I'd love is if I could use drush upc to update my custom modules.  I'm not sure if this is possible if I provide some magic meta data to drush or include my .git with a specified remote host.

My understanding is that Drush leverages the update status module in core for this functionality so this may not necessarily be a Drush specific issue.

Any help or suggestions on where to look would be appreciated.


texts: How to Determine a View Row's Content Type

texts:
I'm putting together a view with multiple content types. In my my_theme.theme file I want to set the template suggestion based on the item's content type (e.g. Content-Type-A gets Template-A.twig and Content-Type-B gets Template-B.twig). Digging through the $variables[] array I can't find if or where there is an element that specifies the content type for the current view row.

Does any know how I may determine the content type of view row in the $variables[] array? If it's not in there what's the best way of adding it?

Thanks!


texts: How to redirect a menu item to the anchor?

texts:
I have created menu with sub-menus. The menu block is placed on the specific page.

Drupal menu path allows only allows normal path to be given to menus(like node/nid and pagepath).
I want to give path like node/256#myblock.

I do not want to go with contributed modules(void menu or any other) as this is for the single link in my site.


texts: Display events from last/next month's visible days in Calendar Month View

texts:
I'm using the Calendar Module with the Month View to display events. My problem is that I need the last/next month´s visible days on each page of the calendar to also show their events instead of being grayed-out as shown in the image (Jan 29 to 31):

Has anybody solved this already?


texts: Custom error page: The path is either invalid or you do not have access to it

texts:
I'm trying to add a custom page, by using admin/config/system/site-information

When I enter the field, as follows:

Default 404 (not found) page

http://mysite.com/errors/404.html

It shows the following error:

The path 'errors/404.html' is either invalid or you do not have access to it.

Though when I enter in my browser: http://mysite.com/errors/404.html it opens just fine.

So, what's wrong with Drupal, why it doesn't see it?


texts:
function doLookup($baseRootDir) {
  if (variable_get('xmldata')) {
    $xmldata = variable_get('xmldata');
  } else {
    $xmldata = '';
  }
  $rootDir = realpath($baseRootDir . DIRECTORY_SEPARATOR . $xmldata);
  $di = new RecursiveDirectoryIterator($rootDir);

  foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
    $fileInfo = new SplFileInfo($filename);
    if (strtolower($fileInfo->getExtension()) == "css") {
      // Include this CSS file in drupal
      $cssFileName =  preg_replace("@[\\\]+@", DIRECTORY_SEPARATOR, str_replace($baseRootDir, "", $filename));
      drupal_add_css($cssFileName, array('type' => 'external', 'group' => CSS_SYSTEM, 'every_page' => TRUE,));
    } elseif (strtolower($fileInfo->getExtension()) == "js") {
        // Include this JS file in drupal
        $js = str_replace($baseRootDir, "", $filename);
        drupal_add_js($js, array('group' => CSS_SYSTEM, 'every_page' => TRUE));
    }
  }
}

Function is running properly.

Here $cssFileName= "/bijli/model/model.css" which is correct, here bijli is general directory not root directory.

I am not able to see any error. What can be the reason?


texts: Views Ticker missing views, what are views and where can I get them

texts:
I have just installed the module called "views ticker" but I cannot activate it as apparently it requires : views(missing).

Today represents my first experiments in Drupal (I am using V7), so I'm finding some things a little less straightforward than I would expect. For this reason I'm a little lost here, I don't know what "views" are being referred to here much less do I know how to give the module the "views" it requires!

So, any pointers in the right direction would be appreciated.

Many thanks


texts: Does hook_node_access_records() and hook_node_grants() change permissions for existing nodes?

texts:
When I install a new module containing hook_node_access_records() and hook_node_grants(), Does it change permissions for existing nodes? Or it affects only on new nodes?

If it doesn't change permissions for existing nodes, Is there a way to rebuild node_access table?


texts: How to add a new tab to user profile in administration?

texts:
How can I add a new tab to user profile beside View(active tab) and Edit. I want to add for instance New User Tab which will be visible only by administrator (not by the user itself).

I want to add in this tab some informations related to the user and to make some associations with specific nodes related to the user.


texts: How to show messages starting with "Debug : " to an administrator only?

texts:
I'm developing a lot of complex rules in D7 and for debugging reasons it is very handy to have different messages (the standard Drupal message) within the website. For this I use "showing a message on the site".

If a message of this starts with "Debug : " then I want it to only be displayed for the role of administrator. I do not want to add a condition to every message. That's is just to much.

How to achieve this?

Note: I wrote my first "Hello world" module last month, so I have a custom module in the site. I have to find the correct hook for this, so I looked into https://api.drupal.org/api/drupal/includes%21module.inc/group/hooks/7. But I cannot find a good hook for this.


texts: How to filter articles that are in front page with taxonomy

texts:
i have made quick moqup of the site to explain it better :

At this moment i made site in drupal 8 that has some articles in it and thous articles are shown in front page (landing Page).

I have made new taxonomy -> vocabulary -> and Add 4 term as shown in picture.

I have created new region and placed it in the front page and from views i call all articles that i have...

My problem is that, how to filter thous articles accordingly to the taxonomy and if there is possible not to refresh page (if Can't than there is no problem)...

Thanks in advance


texts: Enable fields in manage display programmatically D7

texts:
I have just started to use Drupal and I'm trying to add programmatically field in the .install file.

 $field = array(
   'field_name' => 'title',
   'cardinality' => 1,
   'type' => 'text',
   'settings'    => array(
     'max_length' => 1024,
   ),
 );

 field_create_field($field);

 $instance = array(
   'field_name'  => 'title',
   'label' => $t('Title'),
   'type' => 'text',
   'widget' => array(
     'type'    => 'text_textfield',
     'weight' => 1.0,
    ),
   'display' => array(
     'default' => array(
       'label' => $t('label'),
       'type' => 'text',
      ),
    ),
 );

$instance['entity_type'] = 'node';
$instance['bundle'] = 'mytype';
field_create_instance($instance);

The field is added correctly but it is disabled in the Manage Display. How can I change the region column from 'disabled' to 'content'? I tried to add 'region' => 'content' in the instance array but it is not working and I cannot find a good example or documentation about the problem.

Thanks.


texts:
I have a custom D7 module that I have placed in sites/all/modules/custom/mymodule folder. It appears on the modules page, and when I enable it, there are no errors.

The only code inside of it is:

function mymodule_init() {
  exit;
}

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  var_dump($form_id);exit;
}

Yet, neither of these cause an exit. If I place an exit outside of these functions, it definitely exits.

What is the issue?

Edit: Info file contents:

name = My Module
description = Form modifications for user forms (register, login).
core = 7.x
version = 7.x-1.0
dependencies[] = html5_tools
dependencies[] = elements


texts: Settings vs Code: Can I turn off Broadcast Message through settings?

texts: I manage a Drupal Commons site (that relies heavily on OG). I've a request to turn off the ability to broadcast to groups. Is there a box that somewhere that I can un-check or is it better to use hook_menu_alter() in a custom theme to disable the og/users/%/invite path?


texts: why would $form_id be an array instead of a string?

texts:
function my_custom_form_alter(&$form, $form_id) {
  sdpm($form_id);
}

This is giving me large arrays that include a line like this:

$form_id['build_info']['form_id']

So technically I can access the ID via $form_id['build_info']['form_id'] but it seems like a bad idea to write that in my module.

$form_id is an array, not a string as the docs say it should be.

What could possibly be going on here?

Has anyone ever seen this before?


texts: How to change view's field (Custom-Text field specifically) value based on other field value using hook_view_pre_render?

texts:
I have created a taxonomy-term view.
I have added two fields in a view: term-id and custom-text field.

I want to check if term-id has children and depending upon the result, I want to set markup inside custom-text field.

I am able to get term-id in hook_views_pre_render with following code, but I am not able to set the value of custom-text field

function mymodule_views_pre_render(\Drupal\views\ViewExecutable $view) {
 if ($view->id() == 'test_view' && $view->current_display == 'block_2') {
    foreach($view->result as $value){
        $tid = $value->_entity->get('tid')->value;
        kint($tid);

        //trying to set value for custom text field, with foll. line of code
        //'nothing' is the field-name you get for any custom-text field
        $value->_entity->set('nothing', '
This is my custom mark-up
');
    }
 }
}

I referred the code from these following 2 sources, but they are not dealing with custom-text field:

How to change views field value using a hook
https://api.drupal.org/comment/62573#comment-62573

Or should I use template_preprocess_views_view_fields(), if yes then how can I get term-id value to check if it has children terms.

Any help will be appreciated.


texts:
I am programatically generating nodes in my local Drupal 6 installation.  I have to do it locally because I don't have access to some of the more nifty PHP commands / modules that I need in order to create the modules on the production server.

These nodes come out properly formatted with aliases already created, and I would like to export those to the production server with aliases intact.

I have been attempting to use the Node Export module, however that doesn't preserve aliases (as far as I can see anyway).  The Deployment module has never left alpha for Drupal 6, and I have been running into errors while using it.  When it did work, aliases were not preserved.

Is there a method to preserve aliases available?


texts: drupal_is_front_page() fails when using alias

texts:
If I set the default front page to use a node with an alias, e.g. 'home', drupal_is_front_page() fails as it compares the un-aliased path ($_GET['q']) with the value of the 'site_frontpage' variable. Would it not be better to save the 'site_frontpage' variable as un-aliased path, or am I missing something?

Sorry, this is actually what happens. The variable must have been set to 'home' by something else.


texts:
I have an article content type linked to an event content type via entity reference.

In the Articles view, I would like to offer a filter allowing to filter articles by linked event title.

With Drupal 7, we used to manage it with better_exposed_filters module but I can't find a way to do it in Drupal 8.


texts:
I'm creating a website for a company. One of the requirements is to have their price lists displayed on the website. All the data is in the MS SQL database. The question is, what would be the best way to:

Feed the data to Drupal (is it easier to connect directly to MS SQL database, or import data in XML or whatever else format?)
Display the data on the website (create a separate node for each separate price list and display the table it it? How to build that table?)

I'm using Drupal 7.


texts: Status message "The changes have been saved" displays when updating user data using AJAX and Services module

texts:
I am using navigator.geolocation.getCurrentPosition to get the user's current location, and then using the Services module to update the user's location (part of the user object) via AJAX.

Here is the AJAX call to the service:

jQuery.ajax({
  type: "PUT",
  url: "/api/internal/user/" + uid,
  data: JSON.stringify(geolocation),
  dataType: "json",
  contentType: "application/json",
  success: function(r) {
    console.log(r);
  }
});

The update works just fine, but when I navigate to another page afterwards, I get the status message: "The changes have been saved". After some digging, I found that this status message gets displayed any time user data is updated, which is fine usually, but will be confusing in this scenario since data is being updated behind the scenes. I'm assuming that since the user update is taking place via AJAX, the status message doesn't get displayed until next page load.

Is there any way to prevent Drupal from displaying this status message only when user data is updated using Services?


texts: Insert Revision log message programmatically after form submission

texts:
I am trying to pragmatically set the revision log message after values of certain fields are changed (thus if a user has edits certain fields). More information is in the code comments

 function home_hub1_form_alter(&$form, FormStateInterface $form_state, $form_id){

//    Hide Revisions log message text box
$form['revision_log_message']['#access']= FALSE;

//set revision check box to false since we are creating a revision progeammatically
$form['new_revision'] = array(
    '#type' => 'hidden',
    '#value' => FALSE
);

// monitor every field if its from edit
if ($form_id == 'device_entity_edit_form'){

    $form['actions']['submit']['#submit'][] = 'home_hub1_form_device_entity_edit_submit';

  }
}

function home_hub1_form_device_entity_edit_submit(array &$form, FormStateInterface $form_state){

$form_state->setTemporaryValue('entity_validated', TRUE);

//check if a field has changed and if it has write a revision log message
if ($form['field_city']['widget']['0']['value']['#value'] != $form['field_city']['widget']['0']['value']['#default_value']) {

    $message = 'CITY changed from: ' . $form['field_city']['widget']['0']['value']['#default_value'] . ' to: ' . $form['field_city']['widget']['0']['value']['#value'];

   $form_state->setValue('revision_log_message', $message);

}

I am getting the following error: Error: Cannot unset string offsets in Drupal\Core\Field\WidgetBase->extractFormValues()

I also tried to get the node object so that i create a revision directly from it like below:

function home_hub1_form_device_entity_edit_submit(array &$form, FormStateInterface $form_state){

$node = $form_state->getFormObject()->getEntity();

//check if a field has changed and if it has write a revision log message
if ($form['field_city']['widget']['0']['value']['#value'] != $form['field_city']['widget']['0']['value']['#default_value']) {

$message = 'CITY changed from: ' . $form['field_city']['widget']['0']['value']['#default_value'] . ' to: ' . $form['field_city']['widget']['0']['value']['#value'];

  $node->setRevisionUserId(\Drupal::currentUser()->id());
  $node->setRevisionCreationTime(REQUEST_TIME);
  $node->setNewRevision(TRUE); // enabling revision for the entity save.
  $node->setRevisionLogMessage($message);

}

How can I create a revision after form submission?


texts: I m trying to build a form that has questions with radio button answers when someone clicks on a radio button the next question comes up and it should have a next and prev button is there any php code i need to put in? or will it be just jquery as i m very new to php and javascript


texts:
How can i set different language for 2 different domain?
I have 2 different domain for single drupal installation
www.example.en
www.example.fr
i want to display 2 different language based on the user coming from any domain?


texts: Can I display all token values available for my Drupal installation?

texts: Is there a way that I can display all possible values for tokens available on my Drupal installation? For example, I'd like to see all of the possible values for the [termalias-raw] placeholder that I use with the Pathauto module.


texts: How to setup a development server on Linux?

texts:
I am developing a new web site for a client who is already on the web with an old site.

I need to develop the site under a different name (dns) and when it's ready, move it safely to a right name.

I am developing and hosting on AWS under Ubuntu using multi-site setup.

When I am ready I will pointing the DNS to my development server and by doing so I will be on air with the real site.
My question is: While developing I will be directing another domain to the development server say something like deveopment.com by the time I am ready to go live, I will be pointing the real domain to it, say real.com
Other than the dns' what else will I have to change on the server?
Will I have to change anything in the DB? Remember it’s on the same server and I can use the same DB.

Am I likely to run into any trouble?


texts: How do you set the alt attribute with the Media module widget?

texts:
I've tried both 7.x-1/7.x-2 branches of the Media module and can't find a way to set the alt-attribute on a image field using the media-widget.

When I change to the image widget it's possible to set title/alt.


texts:
I use the Better Exposed Filters module. I need to style the checkboxes (change the background of the checkbox).

I tried to do with CSS, but it doesn't work. I use jQuery to add a class to the input of the checkbox, and then apply style for this class, but this doesn't work.

Does anyone know how to do this?


texts:
I have the following situation. A content type called cities holds all the cities in my country. A second content type holds all sales per city.

When a user logs in, I need him to see just some cities to which load sales. this means that a second user will see other cities.

How is this doable?

Regards,
Martin


texts: Splitting Atom categories into two fields

texts:
I am using Feeds to import an Atom feed into my site.  The feed has categories as

<category term="cat:Foo" scheme="http://www.sixapart.com/ns/types#category" />
<category term="tag:foo" label="foo" scheme="http://www.sixapart.com/ns/types#tag" />

I would like to split the categories to one taxonomy, and the tags to another.  I have been playing with the Feeds Tamper for a while, but I cannot get any of the existing tampers to do what I want.

Mapping one Atom element to two fields is easy.  The problem is to exclude certain terms from being created.

From the plugin list, the filters work on the item level and not the value level.

Is the only option to make my own plugin?


texts: How to link a view to the current language with a no results fallback to the default language?

texts:
I've already figured out how to link views to content language by the Content: Language filter. I know that I can create a second view to use as the No Results fallback and use the Global: View area to feed the other in. But to do this I have to:

pollute my site's blocks with Localized and Unlocalized duplicates and hope
the client understands that they should only enable the Localized block.
make sure to maintain a duplicate of the original with only the Content: Language filter changed.
tolerate a full second set of queries to generate the block? Some blocks are ordered by random, so they can't really be cached well.

Isn't there a better way to do this?

Also, I know I can use the rearrange feature on the languages to set up conditions like:

Content: Language (In user's current language) OR
Content: Language (In default site language)

But the issue is that then these languages are mixed. I need the default site language to appear only when there are no nodes in the current user's language.


texts: How do you programmatically delete a field?

texts:
I found this page: https://www.drupal.org/node/2012896 which lists this:

// Deleting field storage.
FieldStorageConfig::loadByName('entity_type', 'field_name')->delete();

// Deleting field.
FieldConfig::loadByName('entity_type', 'bundle', 'field_name')->delete();

but, of course, I get:  Fatal error: Class 'FieldStorageConfig' not found.

Any hints as to how this gets used?


texts: DOMPDF with Print module printing a black background

texts:
I have downloaded the print module and tested it with TCPDF, but had a hard time styling things. I then decided to use DOMPDF. It picks up the print.tpl.php from the site/themes/templates folder, and the styling from site/modules/print/css/ folder from print.css. All good so far.

However, when I try to print a PDF, I get a black background, and I have tried to get rid of by giving the body a background, but to no avail.


texts:
I'm new to Drupal and my first project is turning out quite complex, at least it is when I'm trying to do it with Drupal.

I would like a "project" content type, which on creation will be more than just a page. It should be a page with it's own taxonomy term. On this page there should be a view to show recent media posted to that taxonomy term, along with downloads, articles and a couple of other content types. Essentially the new project page pulls all the other content together.

As I am hoping to hand this site over to less technical people (I barely understand Drupal yet nevermind trying to teach all of this to a non-technical person!) and would like this page to just be set up automatically.

I think the process is this: On creation the page should add it's title as a taxonomy term under the current vocab, then set up a view for each content type to pull the newest content posted under it's term.

Does this make sense? If not I'll update it with more information but if anyone has any pointers/tips or actually knows how to do this then I would appreciate the help!


texts: A Multi-step Form to display Database Data at the End

texts:
I'm fairly new to Drupal but I'm building a site using Drupal 7. Most of the stuff is pretty standard Drupal things, but one of the things my stakeholders want is a tool that does the following (and I'm not sure the best way to implement this using Drupal 7- suggestions appreciated!):

A multi-step form (with 1 question per form) with checkboxes and radio buttons only.
Data is saved temporarily for users. At the end of the form when users request their recommendatios the site displays a list of resources (from the database) FORMATTED in a specific way (ie. image, text, and link to resource) IN ORDER of relevance BASED ON the selections they made in the form itself. And all of this should be displayed in a list view.

I'm imagining some sort of FORM API + Views interaction but like I said I'm new. Any suggestions from the community?


texts: Is it possible to add a dependency file from another module in my module.info?

texts:
In the docs:

  files (Optional)
      Drupal supports a dynamic-loading code registry. To support it, all modules must declare any code files containing class or interface
  declarations in the .info file, like so:

name = Really Neat Widget
...
files[] = tests/example.test

  When a module is enabled, Drupal will rescan all declared files and index all the classes and interfaces that it finds. Classes will be loaded automatically by PHP when they are first accessed.

But, it is posible to add a file fomr another module?

For example:

files[]: myothermodule/includes/file.inc


texts: route not working when using encoded url as upcast parameter

texts:
my route

   amu_hal.publicationsPerYear:
      path: '/publications/{year}/{url}'
      defaults:
        _controller: '\Drupal\amu_hal\Controller\AmuHalController::publicationPerYear'
        _title: 'publicationPerYear'
        year: 2016
        url: 'default url'
      requirements:
        _permission: 'access content'

that type of request

http://my_site/publications/2016/my_encoded_url

gives

The requested page could not be found.

and does not enter

   class AmuHalController extends ControllerBase {
           public function publicationPerYear($year,$url) {

this

http://my_site/publications/2016/hallo

does enter into my controller action

but this not:

 http://my_site/publications/2016/https%3A%2F%2Fmy_webservice%2Fsearch%2F%3Frows%3D5%26sort%3DproducedDate_tdate%2Bdesc%26fl%3Dtitle_s%2Cen_title_s%2Clabel_s%2Cen_label_s%2CdocType_s%2CauthIdHal_s%2ChalId_s%2CstructId_i%2Curi_s%2Ckeyword_s%2Cen_keyword_s%2CauthLastNameFirstName_s%2CjournalTitle_s%26fq%3DauthFullName_t%3A(%22M.+trump%22+OR+%22donald+trump%22)


texts: Drupal http get Request for external URL?

texts:
I have to send a request to external Api that returns me the redirection page but it is printed on my side as var dump, the dump is the page it i supposed to be redirected to, any help ?

Code :

$url = 'xyz';

try {
  $response = \Drupal::httpClient()->get($url, ['headers' => ['Accept' => 'text/html']]);
  $data = (string) $response->getBody();
  if (empty($data)) {
    return FALSE;
  }else{
    return $data;
  }
} catch (RequestException $e) {
  return FALSE;
}

Returned $data looks something like this :

    <!doctype html>
<html lang="en" dir="ltr" class="h-100">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="asdsad">
    <!-- CSRF Token -->
    <meta name="csrf-token" content="aaaaa1231231">
    <title>TEST</title>
    <link rel="canonical" href="tamal.com">
    <!-- Bootstrap core CSS -->
    <link href="http:xyz.css" rel="stylesheet">


texts: t() and {% trans %} show no effect although rest of site is translated

texts:
I'm a bit hesitant to ask this, but I have a drupal 8 site with 2 languages enabled - English as default and German. I have URL prefixes 'en' and 'de' to detect the chosen language. When setting German as default, the menus are translated, fields etc. It all works reasonably well. However, none of strings I use in my custom modules are translated. A very simple example

class testController extends ControllerBase {

...
drupal_set_message(t("Sorry, that does not work"));
....
}

The string is not translated when using german as the site's default language. Furthermore in my twig templates {% trans %} Hello {% endtrans %} have absolutely no effect.

Is there something I am missing here or I have to specifically set up ? I have used google for hours but do not find any solution to this weird problem. I've also tried all kinds of language detection methods in the Drupal settings - no effect. I have modules: Configuration Translation, Content Translation, Interface Translation and Language enabled.


texts: How to make vertical tabs display on a custom entity?

texts:
I have a custom entity in Drupal7 created using the Entity API. I am attempting to make it work with the meta tag module. I have added

'metatags' => TRUE

to hook_entity_info, and metatags display as a field under "manage fields" for the entity. The trouble is that the vertical tabs that usually display on every node do not show up on the entity. Thus, I have no way of changing any of the information in the meta tag field on the custom entity. How do you make the vertical tabs appear when using entity api?


texts:
I'm wondering if the following construction is posible with Views in Drupal in combination with relationships. I build this in Drupal:

Manager <--(Entity Reference)--> Group <--(Entity Reference)--> User

A manager can control groups with different users, so I have the following setup:

  Manager A <--> Group A <--> User 1 Manager A <--> Group A <-->
  User 3 Manager A <--> Group A <--> User 5 Manager B <-->
  Group B <--> User 2 Manager B <--> Group C <--> User 4
  Manager B <--> Group C <--> User 6 Manager B <--> Group C <-->
  User 7

I'm looking for a way to generate a view with the logged in manager to get all the users of the group the manager is part of.

So we get this result when I'm logged in with manager B:

  User 2 User 4 User 6 User 7

I tried to create an Contextual filters with an default value of the logged in user. Then 2 relations: one for the

Manager <--(Entity Reference)--> Group

ans an second one for the

Group <--(Entity Reference)--> User

And then I tried to make fields with an relationship. But only I get is no results. Is there a way to get this working?


texts: Deleting all Webform Submissions and Content from specific IP

texts:
Is there a great way to delete all content and webform submissions from a specific IP address? I'm sure it can be done with MySQL commands, but I'm hoping there's a 'safer' way to do it than manipulating the database by hand.

Thanks!

Drupal 7.50 Commons


texts:
By adjusting URL alias patterns I've made nodes types and taxonomy terms have overlapping URLs. The nodes have a 1 to 1 relationship with terms. At the URL I want to show the node and not the normal term page.

This seems to be working perfectly for what I need, but are there any risks or edge cases I'm not aware of? When a node and a term have the same URL does the node always win out?


texts: Using drush to sql-sync local to remote, without remote MySQL binaries on remote

texts:
I'm working with a prod and staging environment where the MySQL binaries (like mysqldump) are not installed. PHP can interact with MySQL just fine, but for reasons that are not relevant, the binaries aren't installed.

It appears that when performing an sql-sync, drush will attempt to ssh into the remote server, run the dump, then rsync the file down, then import it. Is there a way to avoid this, maybe a way of telling Drush to perform all the database operations locally? My workstation has access to the remote databases, so it is capable of performing mysql imports and dumps on the remote databases.

I understand that Drush cannot account for all edge cases like this. I wonder if anyone knows if there are workarounds for this or suggestions? I can just write my own scripts to do the syncing of databases, but would love to leverage drush.


texts: The "more" link does not direct to the page

texts: I am very new at using Drupal some of the answers I see here seem to be the solution but I don't understand the terminology, so if some could explain in simple terms step by step I would be grateful. The problem is that I create a press release which appears on the front page as expected together with a "more" link, however, this does not direct one to the actual article but back to the page I am already on. Please if someone could help me and guide me through the procedure to fix this I would be very happy. Ian


texts:
How can I fetch the Inviter of a user in Rules?
I'm using Drupal 7 and the invite-by-email module (part of the invite module https://www.drupal.org/project/invite), to allow users to invite others.
Now i need to create a Rule that grants points to Inviters whenever their Invitees vote on the site.The voting is controlled with the voting api module, which gives a Rules event.
The event is User votes on a Node
The Invitee is [vote:user]
For the inviter I tried  [vote:user:invite:inviter] but it didn't work.
Been going around in circles, but just can't find the Inviter.

any help appreciated.
d


texts: Lists the organic groups current user is not a member

texts:
I want to create a view that lists the groups user is not a member of.
Tried to add the filter criteria -:(author)user:current(no),but it displays the groups user is a member & only filters the  groups manage(created) by user.
Views-:7.x-3.7
og-:7.x-2.3


texts: How to restore taxonomy terms and node relationships?

texts:
I was using the Delete Orphaned Terms module to delete unused terms. Today, bad things happened: it deleted lots of taxonomy terms although they're are not orphaned. Then I found a serious issue about this.

I have a backup of my whole system. Now, I want to restore only these taxonomy terms (25 terms) and the node relationships. How can I do that? Is it possible to make it via phpMyAdmin etc?


texts: 7 - Panels node form, file/image gets removed when field not present in the custom form

texts:
I am using Panels to customise node forms by separating them into multiple pages.

On one page I have text fields and on another file/image fields, when saving the text field form variant all the files get removed from the node - if I add a field in that form variant, it will get saved (not removed).

Is this a normal behaviour?


texts: creating a new content type with a series of blocks

texts:
I have just started with Drupal and I have a question regarding how content types work in Drupal. What i would like to know is how a content type can have a set of blocks attached to it?

If it helps I am trying to make a content type in which the user just gives a topic and then this content type will populate these blocks with information such as the latest news on that topic etc. But I'm unsure the best way to achieve this.


texts: What is difference between a custom block and a Bean block?

texts:
As I am new to Drupal 7, I want to understand the difference between custom block and Bean block.

Can someone please help me on this?


texts: What is an alternative to hook_node_submit() for Drupal 8?


texts: How can I use one of the pre-set email texts for user registration in a custom module

texts:
At /admin/config/people/accounts, there are several stock email messages set.
How can I use one of these when I am sending emails from a custom module?
The text that's being used in "Welcome (new user created by administrator)" is all that I need, plus there's the bonus that our client can edit this email in the future if they want to.
I can send the message easily enough using:
$params = [
   'title' => "My Title",
   'subject' => "An Account Has Been Created for you",
   'message' => Html::escape("Some text here")
 ];

$result = $mailManager->mail($module, $key, $to, $language_code, $params, NULL, true);

Is there a variable somewhere to get the pre-entered text?


texts: Migration of field_collection with migration_d2d

texts:
In D7 to D7 migrations, when it comes to field_collections I know “ Your field collection migration should be run after the host entity migration. ”.

I have done my host entity migration via the migrate_d2d module.

For my field_collection I have written a custom module and added migrate_d2d class name (7f4f1882cNodecook_committee_vote) as a dependency.

Has this logic flowed?

I ask because my field_collection migration does not update the previously migrated cook_committee_vote nodes, rather it makes empty stubs for them!!!


texts: Pulling Custom Content Type field value into a token

texts:
I need to create a custom token for a custom content type in Drupal 8.

there is a field, e.g 'field_image'  I'm trying to use Token Custom module to pull the value of the filed and into the token.

The token itself is used in the 'Metatag' module to provide a value for an OG:image

this means that the Content-type needs to assign the image name into the token so that when the content is viewed, the image URL appears in the property.

I have no idea where to start on pulling this value from the field, I've looked at field_tokens module but I'm not sure where to start with this one.

The Custom Content type is from a third party module that I have no control of its development but I can develop for D8 no problem.

Does anyone have any ideas?

Many thanks


texts:
I am looking for a way to create a dynamically-generated SVG graphic based on data returned in a view from the Views module. Since Views creates lists and SVG is ultimately XML and therefore DOM-based, they seem perfectly well-suited to work together.

I have seen a few posts around saying that SVG support/integration in Drupal is very limited, and I have only ever seen Javascript used to create an SVG and then manipulate it's DOM. There are some popular javascript libraries already in use, such as Raphaël and svgweb.

Has anyone seen PHP used to do this as well? I have seen the svg_embed module but it's very new, hasn't been updated since July, and almost nobody is using it.

Does anyone know of a better way to integrate SVG and Drupal Views?


texts: Filedepot - Where is the file management interface?

texts: I have installed the module and additional libraries as required in the README but I don't see where the file management interface is. Can someone give me the link or point me to the right direction?


texts: I want to change the layout of the forum

texts:
I would like to redesign how the layout of the forum threads; very specifically, this is for a B/S/T website I am working on.

I have included a drawing of how I would eventually like them to appear. I am working with panels and views, which should be fine for putting together a page to draw it all out, but how will I be able to set these pages as the default routine to display forum threads?

Update: I am starting to get somewhere. Using "Panels > Node Template," I was able to modify the forum topic template, which allowed me to at least predicate my forum topics with a view at the top of the page. I setup this view to pull pictures from the forum topic being observed by the user.
I then modified "Content Types > Forum Topic > Manage Display," where I then changed the Picture field to "HIDDEN" in terms of display. This cleans up clunky, large pictures being shown, and in the View at the top, I have setup Colorbox to display the pictures.


texts: How to create an organic group in ERPAL?

texts:
I find organic group it a good solution but i'm a little lost because i'm just a beginner who try to discover ERPAL and Drupal in base.

I like the organic group module and it's like you said is the best add for ERPAL.
I'm using this article to follow the installa of groups but i did not find how to add this block and where.
https://www.drupal.org/node/861436.
 in the step 2, i find that erpal has a pregonfigured blocks, so how to activate my group that i've add it in the first step so i can add it from the erpal dashboard by the "add a block button".

Thank you very much


texts: Use HTML tags inside rows of a table in a render array

texts:
I'm creating a table within a render array.
I can easily create rows within the table like so

$rows = [
    'test 1',
    'test 2',
    'test 3',
];
$header = [
    'header 1',
    'header 2',
    'header 3',
];
$render['table'] = [
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $rows,
];

However when I attempt to include html tags within the row like so:

$rows = [
    'test 1',
    'test 2',
    'test 3',
];

it spits it out with the tags written out. It shows

test 1test 2test 3

instead of showing

test 1 test 2 test 3

Is there a way to use html tags inside rows of a table element in a render array?

UPDATE:
I've also tried

'#rows'    => [
                        'test 1'  => [
                            '#type'  => 'html_tag',
                            '#tag'   => 'h1',
                            '#value' => 'Test 1',
                        ],
                        'test 2'  => [
                            '#type'  => 'html_tag',
                            '#tag'   => 'h1',
                            '#value' => 'Test 2',
                        ],
                        'test 3'  => [
                            '#type'  => 'html_tag',
                            '#tag'   => 'h1',
                            '#value' => 'Test 3',
                        ],
                    ],

But that returns a table with 3 rows and 3 columns that say

'html_tag' 'h1' 'Test 1'

'html_tag' 'h1' 'Test 2'

'html_tag' 'h1' 'Test 3'

Instead of actually producing an html tag.


texts:
I have created a date field that prints out the time for a list of courses offered at a local employment office. I have used a custom input format (h:i A) for the user to input their course start/end time. When the new course listing is created the date field displays 0000-4:30PM to 6:30PM. I assumed the 0000 is representing the year attribute which is selected by default and I am unaware how to change it’s default setting.

I have also included a screen captures below:

I’m still rather new to Drupal so I’m not sure what step I am missing.

System Information:

Drupal 7
Bartik 7.12


texts:
I've build a custom module and a custom form with form API.
I also allow users to come back and edit so I re-populate their old values.

The issue I have is that some of the form is in a collapsible fieldset, how do I save the users' fieldset state so I can open it op again for them when they go to edit the form?


texts:
I have a custom template to display content (Resources) in a certain display mode (Feature Card) which is a web component. When I have labels set to display on the fields, no labels show up. I have tried using kint(field[i]) to look for the label because I thought that maybe I was missing a variable, but I couldn't find anything. Is there something else I need to add to my twig to get labels to appear?

<feature-card {{ my_attributes.addClass(my_classes).setAttribute('id', 'feature-card') }}>
{% for field in content.title %}
    {% for i in 0..1 if field[i] is defined %}

{{ field[i] }}

    {% endfor %}
{% endfor %}
{% for field in content.feature_top %}
    {% for i in 0..field|length if field[i] is defined %}

{{ field[i] }}

    {% endfor %}
{% endfor %}
{% for field in content.feature_left %}
    {% for i in 0..field|length  if field[i] is defined %}

{{ field[i] }}

    {% endfor %}
{% endfor %}

{% for field in content.feature_right %}
    {% for i in 0..field|length  if field[i] is defined %}

{{ field[i] }}

    {% endfor %}
{% endfor %}

{% for field in content.feature_center %}
    {% for i in 0..field|length  if field[i] is defined %}

{{ field[i] }}

    {% endfor %}
{% endfor %}

</feature-card>


texts:
I have a multisite installation with common modules code (all modules are in sites/all/modules). When I update the modules, after that I need to update the database of each site with drush updatedb -l site.com
It is a time consuming task to do this for each site.
Is there a way to batch update the database in multiple sites?

Thanks


texts: How to show cart with number of items in Ubercart?

texts: For his cart, my client wants a cart icon with the number of items in it. Not a list of all items. I searched around a little bit but didn't find anything.


texts:
How do I add #markup or #suffix to MENU_LOCAL_TASK in Drupal?

$items['user/%/checkins_history'] = array( //add to to user's profile
            'type' => MENU_LOCAL_TASK,
            'title' => t('Checkins History'),
            'suffix' => '
Num'.$num_of_results .'
', // NOT WORKING
            'access arguments' => array('Administer Checkins'),
            'page arguments' => array(1),
            'file' => 'manager.inc',
            'page callback' => 'manager_checkins_history_page'
        );


texts: Access licensed files only after admin changes order status to completed

texts:
I watched the Commerce File screencast which shows how to create a downloadable file as a product. It appears to be for version 7.x-1.x but currently the recommended version is 7.x-2.x which has since changed significantly.

I'm trying to achieve the same outcome as the screencast whereby the user can only see his licensed files after the order has been changed to completed by an admin. Currently, the moment the user submits his order, he can already see his files. I tried checking the checkout rules, however, the only event option closest to what I want to achieve is "After updating an existing commerce order", and that did not work either.

How can I prevent users from accessing the licensed file until the order has been processed?


texts: Not able to alter field value/s using hook_views_pre_render or views api hook functions

texts:
I have a search result page created using search api and views. My search result page is based on  this tutorial and it seems to work properly,however I need to tweak some field's output value and I used  hook_views_pre_render to try to alter the field values however I cant see my fields that I added from the views UI interface on the $view->result array  but  they are rendered on the page. All I see when I krumo($view->result) is (see attached image).
I seem to only get  entity and entity_properties array but not the fields in the array. I need to access the field to make the necessary tweaks like we have in the normal $view->result.


texts:
What I want to do is to render a region in a panel -> add content -> new custom content.
I tried <?php print render($page['region_name']); ?> but it didn't work.

I'm using panels to be able to create more complex layouts and the Context module to show blocks (with menus) on different pages. Thats why I need to render a region in a panel: to put menus on selected pages.


texts: How to create custom access permissions for entity form

texts:
I am using Entityforms on my site. I want to be able to create custom access permissions, which would prevent users of role 'member' from submitting more than 2 submissions. I am fine doing this programatically, but I haven't yet found a good way of doing this.

I tried using the hook_entityform_access_alter, but I dont see where its called. I tried printing some dpms and they never showed up anywhere:

/**
* Implements hook_entityform_access_alter().
*/
function wai_scholarship_access_entityform_access_alter(&$access, $op, $context) {
 dpm($access);
 dpm($op);
 dpm($context);
}


texts: How to selectively import and export specific content without overriding existing destination database?

texts:
I want my client to contribute content to the website, but the problem is, I'm simultaneously doing work on the site, modules, theming, adding stuff also etc...

I'm aware of the features module and can import and export selective tables with backup migrate or even phpmy admin, but it's tedious and error prone...

What data I want to import and export is:

- Content type
- Taxonomies
- Content itself including text and images(can ftp them manually no problem)

What would be an easy and simple solution for this without getting into code or shell access?


texts:
How can I style Drupal 8 modal window to achieve Instagram style and behaviour?

I'm creating modal through extending ControllerBase class, thus have full control of content. However I can't figure it out how to control outer DIV with ui-dialog classes.

class CustomModalController extends ControllerBase {

  public function modal($nid) {

    $options = [
      'dialogClass' => 'popup-dialog-class',
      'width' => 'auto',
      'height' => 'auto',
    ];
    $response = new AjaxResponse();
    $response->addCommand(new OpenModalDialogCommand(t('Modal title'), $html, $options));

    return $response;
  }

}


texts: Benefit of processing multiple entities at once?

texts:
I am about to port renderkit to Drupal 8.
The D7 version contains an interface EntityDisplayInterface, which builds render arrays from entities.
In the D7 version, this contains one method buildEntities($entity_type, $entities); which allows to process multiple entities at once. The idea here was that this could speed up performance.
For D8, I wonder if this is still relevant. E.g. it seems that D8 views really renders each entity separately. And even though there is EntityViewBuilder::viewMultiple(), this really does most of its processing within the foreach(), so separate per entity.
So.. should I drop the buildEntities() method in D8, and only leave buildEntity()?


texts: How to disable Ctools modal form from running on mobile devices?

texts:
I am using Drupal 7 Totem distro (a responsive site). My problem is that the pop-up modal form works fine on large screens but doesn't respond well on mobile devices/smartphones.

How do I disable the modal form from runnning on mobile devices?


texts: Inserting Fields from A Custom Content Type into Custom Form

texts:
I created a custom content type called 'Building Location' that contains a custom field called 'US_States'.

Is there a way I can access and include the 'US_States' field into a custom form I'm building without having to re-create it with the Form API?

I'm looking to include the same drop down list, 'US_States,' from the 'Building Location' content type in a custom form that is part of a module I'm building, ensuring the two will always have the same options available.


texts:
I have a local install of a Drupal 7 site that will only display admin pages over https such as login and admin type pages. I was unable to disable them before downloading the database. In settings.php I have set secure pages to 0. However when i attempt to login the page simply refreshes and the form is displayed again and i am unable to visit any admin pages. Is there a way to login using mysql instead of having to go through Drupal?

EDIT:

finally got drush running correctly and used
    drush cc all
after attempting to sign in i got the error message:
Warning: Cannot modify header information - headers already sent in _drupal_bootstrap_page_cache()
Warning: Cannot modify header information - headers already sent in drupal_send_headers()

the latter is repeated 7 times, the page simply refreshed again.

I ended up creating a temporary sign-in using drush command:
    drush user-login


texts:
I have a custom form:

\Drupal\module\Form\CustomForm

I want to be able to embed this form in a basic page by adding a shortcode/variable to the basic page such as:

[form][/form]

or

form

This is very easy to achieve in WordPress but really difficult in Drupal.

How can I achieve the above?


texts: What does this error mean and how can I fix it?

texts:
I do not know what this "notice" means:

  Notice: Undefined index: content in ds_render_block_field()
  (line 947 of
  /home/magpie/public_html/mysite.com/sites/all/modules/ds/ds.module).
  Notice: Undefined index: content in ds_render_block_field() (line 947
  of
  /home/magpie/public_html/mysite.com/sites/all/modules/ds/ds.module).

I am tempted to just delete the line but I think it is best to check first and verify that it is not important.

Can somebody help explain how errors like this occur? And how to prevent them and deal with them?


texts: Rules - show information after certain time

texts:
I'm wondering how can I achieve this.
I have built a page, on which the content of certain type was being unpublished after 2 weeks. I created rule for that (component + component schedule) and it worked without problem.

But now I have to change the behavior - instead of old content being just "removed from sight of users", it has to remain visible but display a message. Something in the line of "this content has expired, but you can check for available offers on the main page".

I thought that setting the rule and picking up the "display message on site" could be what I'm looking for, but seems like I was wrong. No idea if I can do it in Views (how to link specific Rule to it?), so I'm looking for help.

Any ideas how to achieve that message displaying to users after certain time has passed?


texts: Programatically change the base theme of the current theme

texts:
I have a theme that is a child theme of 'stable'.

Currently the base theme is defined in the info.yml file, however i don't want its parent theme to be so permanent.

I am looking for a way to be able to programatically change the base theme in code so that the theme could switch its parent on demand.


texts: How do you convert an existing order into a shopping cart order?

texts:
I would like to be able to have an existing order that has already been checked out back into a user's shopping cart.  From what I have read from the documentation, a shopping cart is just an order for a user.

This is relevant because when my user's checkout the order, it only does an authorize only transaction, which means the funds have not been transferred yet.  I want to allow my user's a window of time to change their order.

So, I figured the best way to do this was to take the order that they want to edit, void it out, and then put it back into their shopping cart.

I can't seem to find an api call for this.   I saw hook_commerce_cart_order_is_cart_alter in the commerce_cart API, but I couldn't figure out when this was called or if this was a use case for this API call.


texts: How to write a module that provides its own content-type using CCK?

texts:
I have to write a module that provides its own content type. In the drupal-documentation there is a guide for that; yet, I would have to deal with the CRUD logic inside of my module. I thought I could use CCK to create my new content-type with its fields inside of hook_install();. But I couldn't find any guides on how to do that.

Can anyone give a short example or provide a link to some decent guide? That would be awesome.


texts: The database is not bootstrapped in another docker container

texts:
The following problem occurs when running certain Drush commands, such as drush en features which outputs:

  Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
  The drush command 'en features' could not be executed.
  Drush was not able to start (bootstrap) the Drupal database.
  Hint: This may occur when Drush is trying to:

  bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See drush topic docs-aliases for details.
  connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

  Drush was attempting to connect to:

  Drupal version: 7.58
  Site URI: http://default
  Database driver: mysql
  Database hostname: mysql
  Database port:
  Database username: default
  Database name: default
  PHP executable:  /usr/bin/php
  PHP configuration: /etc/php/7.2/cli/php.ini
  PHP OS: Linux
  Drush script: /var/www/vendor/drush/drush/drush.php
  Drush version: 8.1.17
  Drush temp directory: /tmp
  Drush configuration:
  Drush alias files:
  Drupal root: /var/www
  Drupal Settings File: sites/default/settings.php
  Site path:  sites/default

This problem has been reported previously, but in different contexts, not in the specific setup I am working with, which consists of separate docker containers on a linux hosting server.

Apache 2
ElasticSearch
Workspace
PHP
MySQL

All the docker containers are running, as well as the (development) website that is built with drupal, which does connect to the database. Drush had previously been used for setting things up, but something seems to have broken during the development process. Drush had been added to the project using composer, as suggested on Install a site-local Drush and Drush Launcher.

The error seems independent of the directory where the command is executed. Moreover, the settings.php file exists at the path mentioned in the output above and contains the correct database configuration.

Finally, drush sql-cli returns the following message.

  sh: 1: mysql: not found
  SQL client error occurred.

Do you have any idea on what the problem might be?


texts: Set Value to a select field by its key in webform

texts:
I'm trying to set a select field to one specific default value by it's key (one country, which i retrieve from another form), and then disable the field.

I implement hook_form_alter, i get the correct field inside the $form array, but, when i want to set the select field to one value, nothing happens. I'm trying this way:

 $form['#node']->webform['component'][91]['value']['#default_value'] = $country;

But, this does not work. Any guess on how i can achieved this, and if this is possible or the right way to do it?

Thanks


texts: What is the purpose of Master Display in Views module of Drupal 7? Why is it not present in every Drupal 7 installation?

texts:
I have been using Views on Drupal 7 a lot and I enjoy it every time. Great module. I have always noticed the existence of "Master" display while creating views but, never bothered about its existence until today when I noticed that there is no "Master" display in my another server running the same instance of Drupal 7 (same version of Views and Views UI modules)? The two servers differ only in OS, Apache, MySQ and PHP versions, shown as follow:

Core      : 7.31
Views     : 7.x-3.8
Views UI  : 7.x-3.8
PHP       : 5.3.3 and 5.4.16
Apache    : Apache/2.2.15 and Apache/2.4.6 (CentOS)
Database  : 5.1.73 (MySQL) and 5.5.37-MariaDB
Centos    : 6.5 & 7.0

I am a bit confused why "Master" display is not present in recent server but, is available in my other server even though both run same instance/version of Drupal 7? I would greatly appreciate if you could share your knowledge/understanding of "Master" display and its existence/use/purpose (in theory or practical examples if you got any).


texts: Automatically insert images to translated page

texts: I have a bilingual D7 website. It seems odd to insert all images twice, one for the original and one for the translated version, so my question is: Is there a way to automatically insert the image I upload for my orignal site into its translation?


texts: Form API image upload form and File Entity; images not listed in admin/content/file

texts:
I used Form API to create an image upload form, where images get uploaded via managed_file. The upload process works just fine, but the uploaded files don't get listed in the admin/content/file overview that is provided by the File Entity Module. The overview only shows those files that were uploaded via file/add, File Entity's own upload form.

My code is:

/**
 * Create an image upload form
 */

function upload_form_image_form($form, &$form_state) {

  // Image file
  $form['image'] = array(
    '#type' => 'managed_file',
    '#name' => 'image',
    '#title' => t('Image file'),
    '#size' => 40,
    '#description' => t("Image should be in JPG format."),
    '#upload_location' => 'public://',
    '#required' => TRUE,
  );

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

  return $form;
}

/**
 * Submit the upload form and scale the image down to standard resolution
 */

function upload_form_image_form_submit($form, &$form_state) {
  if (isset($form_state['values']['image'])) {

    $image = file_load($form_state['values']['image']);

    $loadedimage = image_load($image->uri);
    list($width, $height) = getimagesize($image->uri);
    if ($width/$height >= 1) {
      image_scale($loadedimage, 900, null, $upscale = FALSE);
      }
    else {
      image_scale($loadedimage, null, 900, $upscale = FALSE);
      }

    image_save($loadedimage);
    $loadedimage->status = FILE_STATUS_PERMANENT;

  }
}


texts: How to send order confirmation email in Commerce Kickstart?

texts:
I want to send an automatic email when a customer makes a purchase ie thank you for your purchase of x, y, x (and I have seen this described as "outrageously complex"!).

Commerce Kickstart 2 has a rule called "commerce_order_message_order_notification" where the action is "send message with message notify". (Screenshot 1 below)

Where does the rule define which message this action refers to ie does it already refer to the message "commerce order: order confirmation" (Screenshot 2 below) or do I need to configure this?

Also do I need to configure the data selector in the rule reaction (Screenshot 3 below)

In other words I think there is no order email confirmation out of the box with CK2 so what configuration do I need to do?

Thanks...

Screenshot 1

Screenshot 2

Screenshot 3


texts:
I am quite new to Drupal and Drupal 8.

I have created a custom module that creates a custom content type. I am attempting to extract those entities and display them as JSON or XML.

I have read through the Entities Api on loading, querying, and rendering entities but I am struggling to find view_mode_name types :

$build = $view_builder->view($entity, 'view_mode_name', $language->getId());

Would I be able to do something like :

$build = $view_builder->view($entity, 'xml', $language->getId());

or does this only produce a 'render array' ? If this is the case then should I be looking at the Serializer Api ? If so would anyone be able to guide me in the right direction on using this ?

Here is my code so far :

public function display() {
// use the debug component
Debug::enable();

// get node -> testimonial content types
$entity_ids = \Drupal::entityQuery('node')
->condition('type', 'testimonial')
->execute(); // fetch

$node_storage = \Drupal::entityManager()->getStorage('node');

$data = $node_storage->loadMultiple($entity_ids);

$view_builder = \Drupal::entityManager()->getViewBuilder('node');

// render multiple
return $view_builder->viewMultiple($data, 'xml');

}


texts: How to change background color of Nice Menus parent item

texts: After trying everything I could find via FireBug, I still can't find a way to change the CSS for the background color of a horizontal menu set which uses the Nice Menus module. The menu is inside a custom region with a custom background color, but always picks up the overall page background color. It acts as if it's a window to the page background, and changing the page background in theme settings will change its color.  The theme being used is MAYO. Thanks for any suggestions.


texts: Using drush to run a local script on a remote site

texts:
I frequently use drush scr for little tasks throughout my day.  Sometimes these end up a proper commands in my environment, but more often they are just standalone things.

If I have @foo set up in my drush aliases with remote-host, and try to run a local script, I get

$ drush @foo scr ./foo.php
Unable to find any of the following:                                     [error]
/home/mpd/drush/commands/core/./foo.php, /home/mpd/./foo.php

Can this command run a local script on a remote site?


texts:
I realize this is quite a specific Drupal commerce question, but perhaps I can get some insights as I am stuck here.

I need to control access to commerce orders on a per-order basis based on an entity reference field. So users will not have access to view commerce orders, except if they are related to them.

My custom access check requires an operation, and entity and a user.

Looking at all the hooks Drupal commerce executes in order to determine access:

commerce_order_access() calls the generic access helper, commerce_entity_access() for view operations, this constructs an access query based on the entity, which relies on Database API invoking hook_query_TAG_alter(). For orders, this is hook_query_commerce_order_access_alter().
commerce order's implementation of this hook, commerce_order_query_commerce_order_access_alter(), calls a generic implementation back in commerce module, commerce_entity_access_query_alter().
commerce_entity_access_query_alter() checks entity type and user access permissions for the entity and builds an OR conditions array that you can alter for Orders using hook_commerce_entity_access_condition_commerce_order_alter().

All these functions however never get a specific entity to operate on and always check 'global' permissions with user_access().
The committed patch Pass entity to Commerce entity access check contexts changes this so the entity is added to the query metadata in commerce_entity_access() and as such can also be used in hook_commerce_entity_access_condition_commerce_order_alter().

So far so good, this works and I can check access to my order in hook_commerce_entity_access_condition_commerce_order_alter().

The real problem

The problem I run into occurs when loading the orders through Views;

Views does not load the entity but just adds it to the select query and then performs the above access checks, starting with commerce_order_query_commerce_order_access_alter() (hook_query_TAG_alter()). This way the entity is not set (commerce_entity_access() is never called) and thus not available for access checking and all there is for me to alter is the query.

The thing I came up with

Actually the only thing I could think of was to load all commerce order entities, run them all through my access check and save the id's of the allowed orders. Then in hook_commerce_entity_access_condition_commerce_order_alter() add all these id's to the query in a condition.
I am however afraid this will be a huge performance drop once there have been made some orders

So is there a way I can fetch entities from a Views select query? Or id's? Or do I need to implement my check elsewhere?


texts: Unable to find a matching SQL Class on drupal 8 drush command in Acquia Dev Desktop

texts:
I get this error when i run sql-connect --debug
C:\Devdesktop\public_html>drush sql-connect --debug
Cache HIT cid: 8.1.18-commandfiles-0-cad2978683eacbb2b6166a982f0652f5 [0.12 sec, 3.03 MB]                        [debug]
Bootstrap to phase 0. [0.41 sec, 7.7 MB]                                                                     [bootstrap]
Bootstrap to phase -1. [0.41 sec, 7.71 MB]                                                                   [bootstrap]
Found command: sql-connect (commandfile=sql) [0.41 sec, 7.71 MB]                                             [bootstrap]
Calling hook drush_sql_connect [0.42 sec, 7.97 MB]                                                               [debug]
Drush bootstrap phase : bootstrap_drupal_root() [0.45 sec, 8.81 MB]                                          [bootstrap]
Initialized Drupal 8.6.7 root directory at C:\Devdesktop\public_html [0.47 sec, 8.82[bootstrap]
MB]
Find command files for phase 1 (max=3) [0.47 sec, 7.62 MB]                                                       [debug]
Cache HIT cid: 8.1.18-commandfiles-1-4d681924793d846935eee95c1410194c [0.48 sec, 7.62 MB]                        [debug]
Cache HIT cid: 8.1.18-annotationfiles-1-67c3b884213a861fb5d13d03d098f389 [0.48 sec, 7.7 MB]                      [debug]
Drush bootstrap phase : bootstrap_drupal_site() [0.54 sec, 8.33 MB]                                          [bootstrap]
Initialized Drupal site default at sites/default [0.54 sec, 8.33 MB]                                         [bootstrap]
Find command files for phase 2 (max=3) [0.56 sec, 8.33 MB]                                                       [debug]
Cache MISS cid: 8.1.18-install_profile-66ecfeb9791a023150773849f1550c5d [0.57 sec, 8.33 MB]                      [debug]
Cache HIT cid: 8.1.18-commandfiles-2-922fe8da44dce18f081805a74eb1725e [0.57 sec, 8.33 MB]                        [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.58 sec, 8.49 MB]                                 [bootstrap]
Create from request [0.58 sec, 8.51 MB]                                                                          [debug]
add service modifier [0.6 sec, 9.07 MB]                                                                          [debug]
Find command files for phase 3 (max=3) [0.6 sec, 9.08 MB]                                                        [debug]
Drush\Sql\SqlException: Unable to find a matching SQL Class. Drush cannot find your database connection          [error]
details. in C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\commands\sql\sql.drush.inc:549
Stack trace:
0 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\commands\sql\sql.drush.inc(221):
drush_sql_get_class()
1 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\includes\command.inc(422): drush_sql_connect()
2 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\includes\command.inc(231):
_drush_invoke_hooks(Array, Array)
3 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\includes\command.inc(199): drush_command()
4 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\lib\Drush\Boot\BaseBoot.php(67):
drush_dispatch(Array)
5 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\includes\preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
6 C:\Program Files (x86)\DevDesktop\tools\vendor\drush\drush\drush.php(12): drush_main()
7 {main} [0.6 sec, 9.1 MB]
Command dispatch complete [0.6 sec, 9.04 MB]                                                                    [notice]


texts: Redirect from edit page and prepopulate form

texts: I would like to redirect user from node edit page to node add page but with prepopulated form. So all fields of the form would be pre-filled with copies of values of node edited before. Is there a way how to get these values and fill them in the form?


texts: I'm trying to import over 5000 users into drupal by using Feeds module. Can I import user "id" into "uid"? If so, how can I do that? I saw the GUID mapping target, but that is not "uid". Thanks.


texts: Display fields from a view in node template

texts:
I'm learning views in drupal 7 and I just created an unformatted list view that is displaying the titles of a few nodes. The preview looks great and so does the view page.

I have a div block in a custom node template that I want now to view this "view" in. What code do I need to put into my node template to access the view function?

I looked at the system view template (views-view.tpl.php) that is generating what I want and I see that there is a $rows variable:

<?php if ($rows): ?>
  <div class="view-content">
    <?php print $rows; ?>
  </div>

But when I place that into my node template it doesnt work (probably because I need a preproccess?).

Am I going about this the wrong way? Is there an easier way to get views into another template file? I considered using a block. But I thought that once I nail this, then I don't have to mess with blocks.

FYI: I saw this post but I am not sure where to put the code that he recommended.

Thanks! I really appreciate it.


texts: Views table aggregation with counts per value of a field

texts:
A person can log multiple cases: Case 1, Case 2, Case 3

a case can have multiple states: New, Active, Resolved

Using a views table I want to generate a view where each person has one row, and I can see how many new, Active and Resolved cases each has:

Person   | States
Person 1 | New(1), Active(3), Resolved (13)
Person 2 | New(5), Active(3), Resolved (1)

Or something like this:

Person   | New | Active | Resolved
Person 1 | 1   | 3      | 13
Person 2 | 5   | 3      | 1

With normal aggregation all I can achieve is:

Person   | Cases
Person 1 | 17
Person 2 | 9

Surely I am missing something?


texts: How can I make the summary field required?

texts: Is there a way to make the summary field required by default in the node form?


texts: EntityQuery condition on translation status

texts:
Im currently using Drupal::entityQuery() to build a list of node.

I need to be able to query only contentEntities that have a specific translation not published. I struggle because I don't know how to make a condition on an entity translated field/property.

to sum up:
How to query all nodes that have 'de' translation AND which their 'de' translation are not published?

Is there a way to do it with Drupal::entityQuery() or should I directly go with altering the query with QueryInterface::addTag() where I would be able to customize the query?


texts:
I am trying to add a link to a managed pdf file to the footer menu. Right now I am using a controller which uses a specific route in order to download the file:

// src/Controller/DownloadController.php
class DownloadController extends ControllerBase {
  public function downloadPdf() {
    $config = \Drupal::config('example.settings');
    $pdf = $config->get('pdf');
    if ($pdf) {
      $file = File::load($pdf[0]);
      $filename = $file->getFileName();
      header("Content-Type: application/pdf");
      header("Content-Disposition: attachment;filename=$filename");
      print file_get_contents($file->getFileUri());
    }
  }
}

// example.routing.yml
example.download:
  path: 'example/download'
  defaults:
    _controller: '\Drupal\example\Controller\DownloadController::downloadPdf'
    _title: 'Download PDF'
  requirements:
    _permission: 'access content'

After I have activated the module I added a new link named Download PDF to the footer menu. This link points to example/download, this seems to work, but I was wondering if there is a better approach. If possible, I would like to add the path to the file to new menu item instead.


texts: Expand children menu items with parent link, without javascript

texts:
I've build a main-menu, and a sub-menu with Menu block. The sub-menu shows up if I'm on the article with the represented link. It works like it should.

Question: How can can I expand all childrens of a parent menu-link without Javascript?

A short wireframe for the overview.


texts:
How to alter the message shown - "xyz" added to your cart, when we add an item to cart in Drupal 8 Commerce 2x.

I saw Drupal\commerce_cart\EventSubscriber where the function displayAddToCartMessage(CartEntityAddEvent $event) is written which is responsible for showing the message, is there any method to override it.


texts: Allowing a user role to edit only their own content

texts:
I am having some difficulty setting up a user role that can access the admin/content/node section of the site but only view their own content.

For the user role i have some permissions set like so (events is a custom content type)

create events content
delete own events content
edit own events content

The admin/content/node will not appear unless i set a permission.

administer nodes

This allows the user role to create, edit, delete any content. Definitely not what i need!

Reference:

Permissions Reference
Possible duplicate

Can anyone shed some light on how to allow user roles to only access their own content?


texts: How to display a custom render element after an existing one?

texts:
So I've implemented hook_ENTITY_TYPE_view hook.

In there I add a view mode to the $build array:

$build['sessions'] = array(
  [
    "#markup" => "
Sessies
",
    "content" => array(
      Drupal::entityManager()->getViewBuilder('node')->viewMultiple($nodes, 'speaker_sessions')
    )
  ]
);

What happends now is that this will allways be rendered before all the other content. How can I manipulate this? Adding #weight to this element does not seems to effect the other content.


texts:
In the past I always ensured that I had AutoMenu module installed on any Drupal 6 site I created. This module afforded me the following:

The ability to auto-create the menu item entry (per content type) when a new node is created (instead of manually clicking Provide a menu link), and
(optionally) Automatically set the newly created menu item to disabled.

These 2 features with D6 sites have always allowed me to not worry about another content-editor users messing up the hierarchy of the site. Plus it played well with my menus and breadcrumbs.

I have been desperately trying to get similar functionality working in D7, but haven't had much luck so far. There was an unofficial port of the said module to D7 but after trying it, it gave some errors.

Please can you suggest a way in Drupal 7 for me to achieve the same? Thanks!


texts: How can I write users table data in custom file?

texts:
I have a number of users in my site,I have developed custom module for drupal mail functionality.

But I want to write test cases for custom module.

then here is the problem is how can I get the (db_select) users table data and write down in .test file.

for example in .module file we use like this:

$select = db_select('{users}', 'users');
$select -> addField('users', 'name', 'users_name');
$select -> addField('users', 'uid', 'uid');
$select -> addField('users', 'mail', 'users_mail');
$select -> addField('users', 'created', 'users_created');
$select -> addField('users', 'access', 'users_access');
$select -> addField('user_relationships', 'requester_id', 'requester_id');
$select -> addField('users_roles', 'rid', 'role_id');
$select -> addField('users_user_relationships', 'mail', 'users_user_relationships_mail');
$select -> leftjoin('user_relationships', 'user_relationships', "users.uid=user_relationships.requestee_id");
$select -> leftjoin('users', 'users_user_relationships', "user_relationships.requester_id=users_user_relationships.uid");
$select -> innerjoin('users_roles', 'users_roles', "users.uid = users_roles.uid");
$select -> condition('users.status', 0, '<>');
$select -> condition('users_roles.rid', array(
  '4',
  '5'
), 'IN');
$subresult = $select -> execute();

and i have wrote .test file like this

<?php
class BiTestMailsTests extends DrupalWebTestCase {
protected $privileged_user;
public static function getInfo() {
  return array(
    'name' => 'Test Mails',
    'description' => 'Tests for the mail module.',
    'group' => 'Test Mail Group',
 );
 }
public function setUp() {
   parent::setUp(array('mails'));

   }

public function testmail() {
    // Create an administrative user.
    $account = $this->drupalCreateUser(array('administer actions'));
    $this->drupalLogin($account);

      //database files
    $results= db_select('users','u')->fields('u',array('uid','name','mail','created','access'))->execute()->fetchAll();
    if($results){
     foreach($results as $res){
     $user_fields = user_load($res -> uid);
     $this->verbose('language:'.$language);
     $string= 'uid:'.$res->uid.' ,name:'.$res->name.' ,mail:'.$res->mail.',created date:'.$res->created.',Access:'.$res->access.'\n\r';
     $this->verbose($string);
    }
    }
    }
    }

but temporary user created and that values are getting.
i don't want temp values,i want database USERS table values.
How can I write down users information(name and email) in .test file?


texts: How to use galleria to create slideshow of Images in a Node

texts:
Can http://drupal.org/project/views_galleria be used to create a slideshow of images in an image field on the node display page (i.e. /node/*)?

When I go to "Manage Display" for the content type, I do not see "..Galleria.." as one of the display options for the image field that can take multiple images?

I am able to use http://drupal.org/project/views_slideshow but it is not as nice.

Any recommendations of other decent looking slideshow modules is also welcome


texts:
I'm trying to link a field in my spreadsheet file to a user that is previously created with a migration from the same spreadsheet. The Backup column consists of multiple names divided by the backward slash (Firstname Lastname/Firstname Lastname)
migrate_plus.migration.profiles.yml:
process:
  field_backup:
    -
      plugin: explode
      delimiter: '/'
      source: 'Backup'
    -
      plugin: entity_lookup
      value_key: name
      ignore_case: true
      entity_type: user
      bundle_key: uid
      bundle: people

migrate_plus.migration.users.yml:
process:
    name:
      plugin: concat
      source:
        - 'Firstname'
        - 'Lastname'
      delimiter: ' '

The backup field is just skipped when migrating the profiles. The only error I'm getting is when i go to a profile page and check the log messages.

User error: "attributes" is an invalid render array key in
Drupal\Core\Render\Element::children() (regel 97 van
/var/www/html/web/core/lib/Drupal/Core/Render/Element.php) #0
/var/www/html/web/core/includes/bootstrap.inc(587):
_drupal_error_handler_real(256, '"attributes" is...', '/var/www/html/w...', 97, Array) #1 [internal function]:
_drupal_error_handler(256, '"attributes" is...', '/var/www/html/w...', 97, Array) #2
/var/www/html/web/core/lib/Drupal/Core/Render/Element.php(97):
trigger_error('"attributes" is...', 256) #3
...

Can you not use entity_lookup for users or am I doing something wrong in my configuration?
Any help would be much appreciated


texts: How do I set permission for a custom page to be based on node access?

texts:
I have added pages using hook_menu like so:

function dynamic_entries_menu() {
    $items = array();
    $items['entries/get'] = array(
            'title' => 'Dynamic Entries',
            'page callback' => 'dynamic_entries_get_entry',
            'type' => MENU_CALLBACK
    );
    return $items;
}

A node ID is added to the end of the URL. For example, /entries/get/10. I want to allow access to this page to anyone who has access to the requested node. How do I do that?


texts: How to change the #size property of a select list of a selective exposed views filter?

texts:
I have a view with an exposed filter that is selective. Below is part of the array with the properties of the field. I need to set the #size to 20 but the code I'm using does nothing. Should be possible or not in this case?

$form array:

array(
  #info =>  array()
  name_selective    =>  array(
    #type   =>  select
    #options    =>  array()
    #default_value  =>  All
    #size   =>  null
    #validated  =>  true

My code:

function MYMODULE_form_views_exposed_form_alter(&$form, &$form_state) {
  $form['name_selective']['#size'] = 20;
}


texts: Drupal fullcalendar integration -> JSON Formatting?

texts:
I am working on a custom fullcalendar (http://fullcalendar.io/) implemenation for a custom module of mine.

I have created an hook_menu that will provide the json output that contains the events that need to be placed onto the calendar:

function mymodule_fullcalendar_measurement_jsonfeed() {
$json = array(
 '0' => array(
   'id' => '182',
   'title'=>'My Event',
   'start'=>'2015-02-16 13:00:00',
   'end'=>'2015-02-16 16:00:00',
   'description' => 'event desc',)
 );

  $jsonstring = drupal_json_encode($json);
  drupal_json_output($jsonstring);
}

And an ajax call to the hook_menu like below:

events : '/my_module_fullcalendar/jsonfeed',

This returns a json string like this:

 [{"id":"182","title":"My Event","start":"2015-02-16 13:00:00","end":"2015-02-16 16:00:00","description":"event desc"}]

The fullcalendar does not recognise this format, because it expects an event object.

I tried to use eventDataTransform to convert this into a correctly formatted object (as stated here: http://fullcalendar.io/docs/event_data/eventDataTransform/), but not luck so far.

I'm pretty sure that this is a formatting problem, because when i change the full calendar jquery events property like this:

events: my_events

And use a variable to create a dummy object:

        var my_events = {
      events: [
        {
          title: 'event 1',
          start: '2015-01-04',
          color: 'tomato'
        },
        {
          title: 'event 2',
          start: '2015-01-09'
        },
        {
          title: 'event 3',
          start: '2015-01-09'
        }
      ],

Everything works perfectly...

For the record i am working with full calendar 2.2.7

Thanks so much!


texts: not able to map all my product Attributes in commerce feeds

texts:
I'm using Feeds commerce to import all my product variation.

Here is my product variation definition

SKU
Price
Color
Size
Images

In the Feed Importer, I'm not able to map the Color,Size and Images. Anybody know why theses fields attribute is not showing up in the mapping dropdown.

Thanks


texts:
I'm using yamlform in my Drupal 8 site and I want to add a new setting (i.e General Settings, Form Display etc) to each of my fields based on if I have a handler attached to my form.

I have used the

function prepare()

method for this in my custom elements, but I would like to add it to all existing elements as well, there are several hooks available but I'm not sure which one would be most appropriate.

I realise that yamlform gives you a custom settings box, but I need something a bit more obvious for my non-tech end users.

Thanks.


texts: Drupal 8 paragraph access in views-view twig file

texts:
1.) I have added a paragrah with multiple field in my node form

2.) Now i have created a View and added the paragraph field and selected the Formatter as Rendered Entity

3.) In the preview section i can see all my paragraph data , as my twig debug is on i can see file suggestions where i can override the paragraph file

4.) But i want to access my paragraphs fields inside the views-view--unformatted-{{ view_machine_name }}.html.twig file

5.) I access the normal fields inside my content type using

view.field.{{ machine_name }}.getvalue(view.result[0])

6.) I can access the paragraph complete section by

view.field.{{ paragraph_machine_name }}.original_value

How can i access the fields inside the paragraph in this view file


texts: After reinstalling Commerce kickstart I can't get editors to be seen

texts:
Drupal 7.25 with latest Commerce Kickstart just won't show editors after reinstall.  Tried CKeditor 3.6 and 3.5. Tinymce also.

I went through all the help install files I could find a solution.  What am I missing?


texts:
I want to display a text field on a content type which is simply a paragraph of text (non-editable). Is it possible to add such a field.

The context: I have a node/add form available to anonymous users so that they can create a content type of 'contact form'.

I am using conditional fields to display certain fields based on the choices made in creating the contact form.

I would like to be able to add a 'message' that displays if they select a certain field.

For example: if the problem selected from a  select box is 'forgotten password' then the paragraph message would appear directing the user to the retrieve password page via a link.


texts: PHP error - function redeclared form only on edit

texts:
I'm using Drupal 6. I don't know why but, since three days ago, I can't edit nodes with PHP filter that creates forms (using forms api). I get the next PHP error:

PHP Fatal error:  Cannot redeclare form_all_node_type() (previously declared in .../includes/common.inc (1769) : eval()'d code:12) in ../includes/common.inc (1769) : eval()'d code on line 25, referer: ....

I can edit any other nodes, but if the node has PHP filter and It creates a form (using form api), I can't edit it. I have checked it with all nodes that creates forms. Although, if you navigate to the node, the form runs good without error. The problem is only when editing the node. If the node has PHP filter but It doesn't create forms, I can edit it.

I have read this post "redeclare error" on drupal web, but It doesn't apply to my question.

Thanks in advance.

UPDATE:
I'll try to be more accurate. When I navigate to the node, the form is created, then thouse functions aren't redeclared, and the form is rendered.
Where is the difference when editing? I guess when I'm editing, thouse functions aren't running code, then It should be only text. Then, why I get this error?
Is there any db table I should truncate?


texts: Which is a better practice in Drupal 8 to get field value from an entity?

texts:
I have a product variation entity from which I need to retrieve SKU value.
I am able to get the value from the below lines, but I want to know which is a better practice and why.

$entity->getSKU();
$entity->sku->value;


texts: Outputting main menu in full in page.tpl.php

texts:
I'm using the code below to print my main menu in page.tpl.php:

<?php
$main_menu = menu_navigation_links('main-menu');
print theme('links', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'main-menu',
'class' => array('links', 'clearfix'),
),

'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
));
?>

However, it is only outputting the top-level menus of my navigation. Is there a piece of code I can add that will output submenus too?


texts:
I have a content type which contains field_state.  The nodes of this content type store the two letter abbreviation for the state in each node using field_state.  OH is Ohio, CA is California and so forth.  I need to render this field with the full spelling of the state name.  I have a PHP Array that contains all of the 50 mappings that I need like -- $state['CA'] = 'California'; This data structure is wrapped in a PHP function state_full_name($abbreviation).

I created a View which creates a block of everything I need -- except the full spelling of the state name.  I know how to apply a PHP functions to a specific Views field in both D6 and D7. The solution in D8 has been elusive for me.  I believe I need to use a Views plugin in some fashion.  Can you help?  Thanks!


texts: What are the alternatives for storing client side encrypted data?

texts:
I want to store client side encrypted data in Drupal 7, so that it is encrypted on the client end, and stored and transmitted in encrypted form. The password is never transmitted or stored on the server.
The only modules I have found which do this are CSE and Text jQuery Encode RC4 (+CCK) but they are for Drupal 6.
I need something that is user specific, so that different users can use different keys, rather than a single key or a set of keys used on the server end.
Are there any similar modules for Drupal 7?


texts: User's field autocomplete/autosuggest widget

texts:
I have a user field where multiple users can be added. Currently, I am using the auto-complete widget.

Is there a module that allows you to customize what can be additionally shown on autocomplete? I would imagine that you could add an 'autocomplete' view similar to full-page or teaser.
Something like Facebook's search. Providing more info like picture or residence of the user.